@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 3.87 kB
Source Map (JSON)
{"version":3,"file":"searchapi.d.ts","names":["Tool","JSONPrimitive","JSONValue","JSONObject","JSONArray","Array","SearchApiParameters","SearchApi","_langchain_core_load_serializable6","SerializedNotImplemented","Partial","Promise"],"sources":["../../src/tools/searchapi.d.ts"],"sourcesContent":["import { Tool } from \"@langchain/core/tools\";\ntype JSONPrimitive = string | number | boolean | null;\ntype JSONValue = JSONPrimitive | JSONObject | JSONArray;\ninterface JSONObject {\n [key: string]: JSONValue;\n}\ninterface JSONArray extends Array<JSONValue> {\n}\n/**\n * SearchApiParameters Type Definition.\n *\n * For more parameters and supported search engines, refer specific engine documentation:\n * Google - https://www.searchapi.io/docs/google\n * Google News - https://www.searchapi.io/docs/google-news\n * Google Scholar - https://www.searchapi.io/docs/google-scholar\n * YouTube Transcripts - https://www.searchapi.io/docs/youtube-transcripts\n * and others.\n *\n */\nexport type SearchApiParameters = {\n [key: string]: JSONValue;\n};\n/**\n * SearchApi Class Definition.\n *\n * Provides a wrapper around the SearchApi.\n *\n * Ensure you've set the SEARCHAPI_API_KEY environment variable for authentication.\n * You can obtain a free API key from https://www.searchapi.io/.\n * @example\n * ```typescript\n * const searchApi = new SearchApi(\"your-api-key\", {\n * engine: \"google_news\",\n * });\n * const agent = RunnableSequence.from([\n * ChatPromptTemplate.fromMessages([\n * [\"ai\", \"Answer the following questions using a bulleted list markdown format.\"\"],\n * [\"human\", \"{input}\"],\n * ]),\n * new ChatOpenAI({ model: \"gpt-4o-mini\", temperature: 0 }),\n * (input: BaseMessageChunk) => ({\n * log: \"test\",\n * returnValues: {\n * output: input,\n * },\n * }),\n * ]);\n * const executor = AgentExecutor.fromAgentAndTools({\n * agent,\n * tools: [searchApi],\n * });\n * const res = await executor.invoke({\n * input: \"What's happening in Ukraine today?\"\",\n * });\n * console.log(res);\n * ```\n */\nexport declare class SearchApi extends Tool {\n static lc_name(): string;\n /**\n * Converts the SearchApi instance to JSON. This method is not implemented\n * and will throw an error if called.\n * @returns Throws an error.\n */\n toJSON(): import(\"@langchain/core/load/serializable\").SerializedNotImplemented;\n protected apiKey: string;\n protected params: Partial<SearchApiParameters>;\n constructor(apiKey?: string | undefined, params?: Partial<SearchApiParameters>);\n name: string;\n /**\n * Builds a URL for the SearchApi request.\n * @param parameters The parameters for the request.\n * @returns A string representing the built URL.\n */\n protected buildUrl(searchQuery: string): string;\n /** @ignore */\n /**\n * Calls the SearchAPI.\n *\n * Accepts an input query and fetches the result from SearchApi.\n *\n * @param {string} input - Search query.\n * @returns {string} - Formatted search results or an error message.\n *\n * NOTE: This method is the core search handler and processes various types\n * of search results including Google organic results, videos, jobs, and images.\n */\n _call(input: string): Promise<any>;\n description: string;\n}\nexport {};\n//# sourceMappingURL=searchapi.d.ts.map"],"mappings":";;;;KACKC,aAAAA;KACAC,SAAAA,GAAYD,gBAAgBE,aAAaC;UACpCD,UAAAA;EAFLF,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAGcC,SAHD;AAAA;UAKRE,SAAAA,SAAkBC,KAJXJ,CAIiBC,SAJjBD,CAAAA,CAAAA;;AAAsC;AAAA;AAE3B;AAe5B;AAsCA;;;;;;AA8B0BU,KApEdL,mBAAAA,GAoEcK;EA9BaX,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EArCpBE,SAqCoBF;AAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAtBO,SAAAA,SAAkBP,IAAAA;;;;;;;YAATQ,kCAAAA,CAO4BC;;oBAEpCC,QAAQJ;oDACwBI,QAAQJ;;;;;;;;;;;;;;;;;;;;wBAoBpCK"}