UNPKG

@langchain/community

Version:
1 lines • 2.35 kB
{"version":3,"file":"serpapi.d.ts","names":["Document","BaseDocumentLoader","SerpAPIParameters","SerpAPILoader","Record","Promise"],"sources":["../../../src/document_loaders/web/serpapi.d.ts"],"sourcesContent":["import { Document } from \"@langchain/core/documents\";\nimport { BaseDocumentLoader } from \"@langchain/core/document_loaders/base\";\n/**\n * Interface representing the parameters for the SerpAPI loader. It\n * includes properties such as the search query and the API key.\n */\ninterface SerpAPIParameters {\n /**\n * Search Query\n */\n q: string;\n apiKey?: string;\n}\n/**\n * Class representing a document loader for loading search results from\n * the SerpAPI. It extends the BaseDocumentLoader class.\n * @example\n * ```typescript\n * const loader = new SerpAPILoader({ q: \"{query}\", apiKey: \"{apiKey}\" });\n * const docs = await loader.load();\n * ```\n */\nexport declare class SerpAPILoader extends BaseDocumentLoader {\n private apiKey;\n private searchQuery;\n constructor(params: SerpAPIParameters);\n /**\n * Builds the URL for the SerpAPI search request.\n * @returns The URL for the search request.\n */\n buildUrl(): string;\n /**\n * Extracts documents from the provided output.\n * @param output - The output to extract documents from.\n * @param responseType - The type of the response to extract documents from.\n * @returns An array of Documents.\n */\n private extractDocuments;\n /**\n * Processes the response data from the SerpAPI search request and converts it into an array of Documents.\n * @param data - The response data from the SerpAPI search request.\n * @returns An array of Documents.\n */\n processResponseData(data: Record<string, unknown>): Document[];\n private fetchData;\n /**\n * Loads the search results from the SerpAPI.\n * @returns An array of Documents representing the search results.\n * @throws An error if the search results could not be loaded.\n */\n load(): Promise<Document[]>;\n}\nexport {};\n//# sourceMappingURL=serpapi.d.ts.map"],"mappings":";;;;;;;AAC2E;AAqB3E;UAhBUE,iBAAAA,CAmBcA;EAkBME;;;EAOlBC,CAAAA,EAAAA,MAAAA;EA5B+BJ,MAAAA,CAAAA,EAAAA,MAAAA;AAAkB;;;;;;;;;;cAAxCE,aAAAA,SAAsBF,kBAAAA;;;sBAGnBC;;;;;;;;;;;;;;;;;;4BAkBME,0BAA0BJ;;;;;;;UAO5CK,QAAQL"}