@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 6.48 kB
Source Map (JSON)
{"version":3,"file":"github.d.cts","names":["Ignore","Document","AsyncCaller","AsyncCallerParams","BaseDocumentLoader","UnknownHandling","GithubFile","GithubRepoLoaderParams","RegExp","GithubRepoLoader","accessToken","baseUrl","apiUrl","branch","recursive","processSubmodules","unknown","ignoreFiles","ignorePaths","verbose","maxConcurrency","maxRetries","Promise","AsyncGenerator"],"sources":["../../../src/document_loaders/web/github.d.ts"],"sourcesContent":["import { Ignore } from \"ignore\";\nimport { Document } from \"@langchain/core/documents\";\nimport { AsyncCaller, AsyncCallerParams } from \"@langchain/core/utils/async_caller\";\nimport { BaseDocumentLoader } from \"@langchain/core/document_loaders/base\";\nimport { UnknownHandling } from \"@langchain/classic/document_loaders/fs/directory\";\n/**\n * An interface that represents a file in a GitHub repository. It has\n * properties for the file name, path, SHA, size, URLs, type, and links.\n */\nexport interface GithubFile {\n name: string;\n path: string;\n sha: string;\n size: number;\n url: string;\n html_url: string;\n git_url: string;\n download_url: string;\n type: string;\n _links: {\n self: string;\n git: string;\n html: string;\n };\n}\n/**\n * An interface that represents the parameters for the GithubRepoLoader\n * class. It extends the AsyncCallerParams interface and adds additional\n * properties specific to the GitHub repository loader.\n */\nexport interface GithubRepoLoaderParams extends AsyncCallerParams {\n /**\n * The base URL of the GitHub instance.\n * To be used when you are not targeting github.com, e.g. a GitHub Enterprise instance.\n */\n baseUrl?: string;\n /**\n * The API endpoint URL of the GitHub instance.\n * To be used when you are not targeting github.com, e.g. a GitHub Enterprise instance.\n */\n apiUrl?: string;\n branch?: string;\n recursive?: boolean;\n /**\n * Set to true to recursively process submodules. Is only effective, when recursive=true.\n */\n processSubmodules?: boolean;\n unknown?: UnknownHandling;\n accessToken?: string;\n ignoreFiles?: (string | RegExp)[];\n ignorePaths?: string[];\n verbose?: boolean;\n /**\n * The maximum number of concurrent calls that can be made. Defaults to 2.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 2.\n */\n maxRetries?: number;\n}\n/**\n * A class that extends the BaseDocumentLoader and implements the\n * GithubRepoLoaderParams interface. It represents a document loader for\n * loading files from a GitHub repository.\n */\nexport declare class GithubRepoLoader extends BaseDocumentLoader implements GithubRepoLoaderParams {\n baseUrl: string;\n apiUrl: string;\n private readonly owner;\n private readonly repo;\n private readonly initialPath;\n private headers;\n branch: string;\n recursive: boolean;\n processSubmodules: boolean;\n unknown: UnknownHandling;\n accessToken?: string;\n ignoreFiles: (string | RegExp)[];\n ignore?: Ignore;\n verbose?: boolean;\n maxConcurrency?: number;\n maxRetries?: number;\n protected caller: AsyncCaller;\n ignorePaths?: string[];\n private submoduleInfos;\n constructor(githubUrl: string, { accessToken, baseUrl, apiUrl, branch, recursive, processSubmodules, unknown, ignoreFiles, ignorePaths, verbose, maxConcurrency, maxRetries, ...rest }?: GithubRepoLoaderParams);\n /**\n * Extracts the owner, repository, and path from a GitHub URL.\n * @param url The GitHub URL to extract information from.\n * @returns An object containing the owner, repository, and path extracted from the GitHub URL.\n */\n private extractOwnerAndRepoAndPath;\n /**\n * Fetches the files from the GitHub repository and creates Document\n * instances for each file. It also handles error handling based on the\n * unknown handling option.\n * @returns A promise that resolves to an array of Document instances.\n */\n load(): Promise<Document[]>;\n /**\n * Asynchronously streams documents from the entire GitHub repository.\n * It is suitable for situations where processing large repositories in a memory-efficient manner is required.\n * @yields Yields a Promise that resolves to a Document object for each file or submodule content found in the repository.\n */\n loadAsStream(): AsyncGenerator<Document, void, undefined>;\n private getSubmoduleInfo;\n private parseGitmodules;\n private loadSubmodule;\n private loadSubmoduleAsStream;\n /**\n * Determines whether a file or directory should be ignored based on its\n * path and type.\n * @param path The path of the file or directory.\n * @param fileType The type of the file or directory.\n * @returns A boolean indicating whether the file or directory should be ignored.\n */\n protected shouldIgnore(path: string, fileType: string): boolean;\n private fetchFileContentWrapper;\n private getCurrentDirectoryFilePromises;\n private processRepo;\n private processRepoAsStream;\n private processDirectory;\n private processDirectoryAsStream;\n private fetchRepoFiles;\n private fetchFileContent;\n /**\n * Handles errors based on the unknown handling option.\n * @param message The error message.\n * @returns void\n */\n private handleError;\n /**\n * Logs the given message to the console, if parameter 'verbose' is set to true.\n * @param message the message to be logged.\n */\n private log;\n}\n//# sourceMappingURL=github.d.ts.map"],"mappings":";;;;;;;;;;AASA;AAqBA;AAiBcK,UAtCGC,UAAAA,CAsCHD;EAEcG,IAAAA,EAAAA,MAAAA;EAnBoBL,IAAAA,EAAAA,MAAAA;EAAiB,GAAA,EAAA,MAAA;EAqC5CM,IAAAA,EAAAA,MAAAA;EAURJ,GAAAA,EAAAA,MAAAA;EAEcG,QAAAA,EAAAA,MAAAA;EACdR,OAAAA,EAAAA,MAAAA;EAISE,YAAAA,EAAAA,MAAAA;EAGeQ,IAAAA,EAAAA,MAAAA;EAAaC,MAAAA,EAAAA;IAASC,IAAAA,EAAAA,MAAAA;IAAQC,GAAAA,EAAAA,MAAAA;IAAQC,IAAAA,EAAAA,MAAAA;EAAWC,CAAAA;;;;;;;AAAuGR,UAzD5KA,sBAAAA,SAA+BJ,iBAyD6II,CAAAA;EAazKN;;;;EAjC0BG,OAAAA,CAAAA,EAAAA,MAAAA;EAA8BG;AAAsB;;;;;;;;;;YApBpFF;;0BAEcG;;;;;;;;;;;;;;;;;;cAkBPC,gBAAAA,SAAyBL,kBAAAA,YAA8BG;;;;;;;;;;WAU/DF;;yBAEcG;WACdR;;;;oBAISE;;;;;;;;;;;;;;;;;MAGuKK;;;;;;;;;;;;;UAajLe,QAAQrB;;;;;;kBAMAsB,eAAetB"}