mongodb-rag-core
Version:
Common elements used by MongoDB Chatbot Framework components.
52 lines • 2.36 kB
TypeScript
import { PageMetadata } from "../contentStore";
import { MakeGitHubDataSourceArgs } from "./GitHubDataSource";
export type MakeMdOnGithubDataSourceParams<SourceType extends string = string> = Omit<MakeGitHubDataSourceArgs<SourceType>, "handleDocumentInRepo"> & {
/**
Transform a filepath in the repo to a full URL for the corresponding Page object.
*/
pathToPageUrl: (pathInRepo: string, frontMatter?: Record<string, unknown>) => string;
filter?: MakeGitHubDataSourceArgs["filter"];
/**
Source type to be included in all pages.
*/
sourceType?: SourceType;
/**
Metadata to include with all Pages in DB.
*/
metadata?: PageMetadata;
/**
Front matter configuration. Looks for metadata by default.
@default
{ process: true, separator: "---", format: "yaml" }
*/
frontMatter?: {
/**
Whether to process front matter. Defaults to `true`.
*/
process: boolean;
/**
Separator character used by front matter. Usually "---" or "+++". Default is "---".
*/
separator?: string;
/**
Front matter format. Usually "yaml" or "toml". Default is "yaml".
*/
format?: string;
};
/**
Extract metadata from page content and front matter (if it exists). Added to the `Page.metadata` field.
If a key in the returned object from `extractMetadata()` is the same as a key in `metadata`,
the `extractMetadata()` key will override it.
*/
extractMetadata?: (pageContent: string, frontMatter?: Record<string, unknown>) => PageMetadata;
/**
Extract title from page content and front matter (if it exists). Added to the `Page.title` field.
If not specified, the first Markdown H1 (e.g. "# Some Title") in the page content will be used.
*/
extractTitle?: (pageContent: string, frontMatter?: Record<string, unknown>) => string | undefined;
};
/**
Loads an .md/.mdx docs site from a GitHub repo.
*/
export declare const makeMdOnGithubDataSource: <SourceType extends string = string>({ name, repoUrl, repoLoaderOptions, pathToPageUrl, filter, sourceType, metadata, frontMatter, extractMetadata, extractTitle, }: MakeMdOnGithubDataSourceParams<SourceType>) => Promise<import("./DataSource").DataSource>;
//# sourceMappingURL=MdOnGithubDataSource.d.ts.map