mongodb-rag-core
Version:
Common elements used by MongoDB Chatbot Framework components.
45 lines (41 loc) • 1.64 kB
TypeScript
import { Document } from "langchain/document";
import { GithubRepoLoaderParams } from "@langchain/community/document_loaders/web/github";
import { Page } from "../contentStore";
import { DataSource } from "./DataSource";
import { MakeGitDataSourceParams } from "./GitDataSource";
export type MakeGitHubDataSourceArgs<SourceType extends string = string> = {
/**
The data source name.
*/
name: string;
/**
The GitHub repo URL.
*/
repoUrl: string;
/**
Filter function to filter out files from the repo. Using this overrides the
`repoLoaderOptions.ignorePaths` option.
Note that file paths will have a leading slash (e.g. `/somedir/somefile.txt`).
*/
filter?: MakeGitDataSourceParams["filter"];
/**
The branch to fetch.
*/
repoLoaderOptions?: Partial<GithubRepoLoaderParams>;
/**
Handle a given file in the repo.
Any number of Pages can be returned for a given file. The exact details
depend on the given repo.
Return undefined to skip this document.
Page sourceName will be overridden by the name passed to
makeGitHubDataSource.
*/
handleDocumentInRepo(document: Document<{
source: string;
}>): Promise<undefined | Omit<Page<SourceType>, "sourceName"> | Omit<Page<SourceType>, "sourceName">[]>;
};
/**
Loads an arbitrary GitHub repo and converts its contents into pages.
*/
export declare const makeGitHubDataSource: ({ name, repoUrl, filter, repoLoaderOptions, handleDocumentInRepo, }: MakeGitHubDataSourceArgs) => DataSource;
//# sourceMappingURL=GitHubDataSource.d.ts.map