UNPKG

@langchain/community

Version:
1 lines • 14 kB
{"version":3,"file":"serpapi.d.ts","names":["Tool","BaseParameters","SerpAPIParameters","UrlParameters","Record","SerpAPI","P","_langchain_core_load_serializable3","SerializedNotImplemented","Partial","Promise"],"sources":["../../src/tools/serpapi.d.ts"],"sourcesContent":["import { Tool } from \"@langchain/core/tools\";\n/**\n * This does not use the `serpapi` package because it appears to cause issues\n * when used in `jest` tests. Part of the issue seems to be that the `serpapi`\n * package imports a wasm module to use instead of native `fetch`, which we\n * don't want anyway.\n *\n * NOTE: you must provide location, gl and hl or your region and language will\n * may not match your location, and will not be deterministic.\n */\ninterface BaseParameters {\n /**\n * Parameter defines the device to use to get the results. It can be set to\n * `desktop` (default) to use a regular browser, `tablet` to use a tablet browser\n * (currently using iPads), or `mobile` to use a mobile browser (currently\n * using iPhones).\n */\n device?: \"desktop\" | \"tablet\" | \"mobile\";\n /**\n * Parameter will force SerpApi to fetch the Google results even if a cached\n * version is already present. A cache is served only if the query and all\n * parameters are exactly the same. Cache expires after 1h. Cached searches\n * are free, and are not counted towards your searches per month. It can be set\n * to `false` (default) to allow results from the cache, or `true` to disallow\n * results from the cache. `no_cache` and `async` parameters should not be used together.\n */\n no_cache?: boolean;\n /**\n * Specify the client-side timeout of the request. In milliseconds.\n */\n timeout?: number;\n}\nexport interface SerpAPIParameters extends BaseParameters {\n /**\n * Search Query\n * Parameter defines the query you want to search. You can use anything that you\n * would use in a regular Google search. e.g. `inurl:`, `site:`, `intitle:`. We\n * also support advanced search query parameters such as as_dt and as_eq. See the\n * [full list](https://serpapi.com/advanced-google-query-parameters) of supported\n * advanced search query parameters.\n */\n q: string;\n /**\n * Location\n * Parameter defines from where you want the search to originate. If several\n * locations match the location requested, we'll pick the most popular one. Head to\n * [/locations.json API](https://serpapi.com/locations-api) if you need more\n * precise control. location and uule parameters can't be used together. Avoid\n * utilizing location when setting the location outside the U.S. when using Google\n * Shopping and/or Google Product API.\n */\n location?: string;\n /**\n * Encoded Location\n * Parameter is the Google encoded location you want to use for the search. uule\n * and location parameters can't be used together.\n */\n uule?: string;\n /**\n * Google Place ID\n * Parameter defines the id (`CID`) of the Google My Business listing you want to\n * scrape. Also known as Google Place ID.\n */\n ludocid?: string;\n /**\n * Additional Google Place ID\n * Parameter that you might have to use to force the knowledge graph map view to\n * show up. You can find the lsig ID by using our [Local Pack\n * API](https://serpapi.com/local-pack) or [Local Places Results\n * API](https://serpapi.com/local-results).\n * lsig ID is also available via a redirect Google uses within [Google My\n * Business](https://www.google.com/business/).\n */\n lsig?: string;\n /**\n * Google Knowledge Graph ID\n * Parameter defines the id (`KGMID`) of the Google Knowledge Graph listing you\n * want to scrape. Also known as Google Knowledge Graph ID. Searches with kgmid\n * parameter will return results for the originally encrypted search parameters.\n * For some searches, kgmid may override all other parameters except start, and num\n * parameters.\n */\n kgmid?: string;\n /**\n * Google Cached Search Parameters ID\n * Parameter defines the cached search parameters of the Google Search you want to\n * scrape. Searches with si parameter will return results for the originally\n * encrypted search parameters. For some searches, si may override all other\n * parameters except start, and num parameters. si can be used to scrape Google\n * Knowledge Graph Tabs.\n */\n si?: string;\n /**\n * Domain\n * Parameter defines the Google domain to use. It defaults to `google.com`. Head to\n * the [Google domains page](https://serpapi.com/google-domains) for a full list of\n * supported Google domains.\n */\n google_domain?: string;\n /**\n * Country\n * Parameter defines the country to use for the Google search. It's a two-letter\n * country code. (e.g., `us` for the United States, `uk` for United Kingdom, or\n * `fr` for France). Head to the [Google countries\n * page](https://serpapi.com/google-countries) for a full list of supported Google\n * countries.\n */\n gl?: string;\n /**\n * Language\n * Parameter defines the language to use for the Google search. It's a two-letter\n * language code. (e.g., `en` for English, `es` for Spanish, or `fr` for French).\n * Head to the [Google languages page](https://serpapi.com/google-languages) for a\n * full list of supported Google languages.\n */\n hl?: string;\n /**\n * Set Multiple Languages\n * Parameter defines one or multiple languages to limit the search to. It uses\n * `lang_{two-letter language code}` to specify languages and `|` as a delimiter.\n * (e.g., `lang_fr|lang_de` will only search French and German pages). Head to the\n * [Google lr languages page](https://serpapi.com/google-lr-languages) for a full\n * list of supported languages.\n */\n lr?: string;\n /**\n * as_dt\n * Parameter controls whether to include or exclude results from the site named in\n * the as_sitesearch parameter.\n */\n as_dt?: string;\n /**\n * as_epq\n * Parameter identifies a phrase that all documents in the search results must\n * contain. You can also use the [phrase\n * search](https://developers.google.com/custom-search/docs/xml_results#PhraseSearchqt)\n * query term to search for a phrase.\n */\n as_epq?: string;\n /**\n * as_eq\n * Parameter identifies a word or phrase that should not appear in any documents in\n * the search results. You can also use the [exclude\n * query](https://developers.google.com/custom-search/docs/xml_results#Excludeqt)\n * term to ensure that a particular word or phrase will not appear in the documents\n * in a set of search results.\n */\n as_eq?: string;\n /**\n * as_lq\n * Parameter specifies that all search results should contain a link to a\n * particular URL. You can also use the\n * [link:](https://developers.google.com/custom-search/docs/xml_results#BackLinksqt)\n * query term for this type of query.\n */\n as_lq?: string;\n /**\n * as_nlo\n * Parameter specifies the starting value for a search range. Use as_nlo and as_nhi\n * to append an inclusive search range.\n */\n as_nlo?: string;\n /**\n * as_nhi\n * Parameter specifies the ending value for a search range. Use as_nlo and as_nhi\n * to append an inclusive search range.\n */\n as_nhi?: string;\n /**\n * as_oq\n * Parameter provides additional search terms to check for in a document, where\n * each document in the search results must contain at least one of the additional\n * search terms. You can also use the [Boolean\n * OR](https://developers.google.com/custom-search/docs/xml_results#BooleanOrqt)\n * query term for this type of query.\n */\n as_oq?: string;\n /**\n * as_q\n * Parameter provides search terms to check for in a document. This parameter is\n * also commonly used to allow users to specify additional terms to search for\n * within a set of search results.\n */\n as_q?: string;\n /**\n * as_qdr\n * Parameter requests search results from a specified time period (quick date\n * range). The following values are supported:\n * `d[number]`: requests results from the specified number of past days. Example\n * for the past 10 days: `as_qdr=d10`\n * `w[number]`: requests results from the specified number of past weeks.\n * `m[number]`: requests results from the specified number of past months.\n * `y[number]`: requests results from the specified number of past years. Example\n * for the past year: `as_qdr=y`\n */\n as_qdr?: string;\n /**\n * as_rq\n * Parameter specifies that all search results should be pages that are related to\n * the specified URL. The parameter value should be a URL. You can also use the\n * [related:](https://developers.google.com/custom-search/docs/xml_results#RelatedLinksqt)\n * query term for this type of query.\n */\n as_rq?: string;\n /**\n * as_sitesearch\n * Parameter allows you to specify that all search results should be pages from a\n * given site. By setting the as_dt parameter, you can also use it to exclude pages\n * from a given site from your search resutls.\n */\n as_sitesearch?: string;\n /**\n * Advanced Search Parameters\n * (to be searched) parameter defines advanced search parameters that aren't\n * possible in the regular query field. (e.g., advanced search for patents, dates,\n * news, videos, images, apps, or text contents).\n */\n tbs?: string;\n /**\n * Adult Content Filtering\n * Parameter defines the level of filtering for adult content. It can be set to\n * `active`, or `off` (default).\n */\n safe?: string;\n /**\n * Exclude Auto-corrected Results\n * Parameter defines the exclusion of results from an auto-corrected query that is\n * spelled wrong. It can be set to `1` to exclude these results, or `0` to include\n * them (default).\n */\n nfpr?: string;\n /**\n * Results Filtering\n * Parameter defines if the filters for 'Similar Results' and 'Omitted Results' are\n * on or off. It can be set to `1` (default) to enable these filters, or `0` to\n * disable these filters.\n */\n filter?: string;\n /**\n * Search Type\n * (to be matched) parameter defines the type of search you want to do.\n * It can be set to:\n * `(no tbm parameter)`: regular Google Search,\n * `isch`: [Google Images API](https://serpapi.com/images-results),\n * `lcl` - [Google Local API](https://serpapi.com/local-results)\n * `vid`: [Google Videos API](https://serpapi.com/videos-results),\n * `nws`: [Google News API](https://serpapi.com/news-results),\n * `shop`: [Google Shopping API](https://serpapi.com/shopping-results),\n * or any other Google service.\n */\n tbm?: string;\n /**\n * Result Offset\n * Parameter defines the result offset. It skips the given number of results. It's\n * used for pagination. (e.g., `0` (default) is the first page of results, `10` is\n * the 2nd page of results, `20` is the 3rd page of results, etc.).\n * Google Local Results only accepts multiples of `20`(e.g. `20` for the second\n * page results, `40` for the third page results, etc.) as the start value.\n */\n start?: number;\n /**\n * Number of Results\n * Parameter defines the maximum number of results to return. (e.g., `10` (default)\n * returns 10 results, `40` returns 40 results, and `100` returns 100 results).\n */\n num?: string;\n /**\n * Page Number (images)\n * Parameter defines the page number for [Google\n * Images](https://serpapi.com/images-results). There are 100 images per page. This\n * parameter is equivalent to start (offset) = ijn * 100. This parameter works only\n * for [Google Images](https://serpapi.com/images-results) (set tbm to `isch`).\n */\n ijn?: string;\n}\ntype UrlParameters = Record<string, string | number | boolean | undefined | null>;\n/**\n * Wrapper around SerpAPI.\n *\n * To use, you should have the `serpapi` package installed and the SERPAPI_API_KEY environment variable set.\n */\nexport declare class SerpAPI extends Tool {\n static lc_name(): string;\n toJSON(): import(\"@langchain/core/load/serializable\").SerializedNotImplemented;\n protected key: string;\n protected params: Partial<SerpAPIParameters>;\n protected baseUrl: string;\n constructor(apiKey?: string | undefined, params?: Partial<SerpAPIParameters>, baseUrl?: string);\n name: string;\n /**\n * Builds a URL for the SerpAPI request.\n * @param path The path for the request.\n * @param parameters The parameters for the request.\n * @param baseUrl The base URL for the request.\n * @returns A string representing the built URL.\n */\n protected buildUrl<P extends UrlParameters>(path: string, parameters: P, baseUrl: string): string;\n /** @ignore */\n _call(input: string): Promise<any>;\n description: string;\n}\nexport {};\n//# sourceMappingURL=serpapi.d.ts.map"],"mappings":";;;;;;;;AAA6C;AAgC7C;AAkPC;AAOD;;;UA/QUC,cAAAA,CAmRYQ;EAEwCP;;;;;;EANrB,MAAA,CAAA,EAAA,SAAA,GAAA,QAAA,GAAA,QAAA;;;;;;;;;;;;;;;UAzPxBA,iBAAAA,SAA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmPtCE,aAAAA,GAAgBC;;;;;;cAMAC,OAAAA,SAAgBL,IAAAA;;YAATO,kCAAAA,CAE8BC;;oBAEpCC,QAAQP;;oDAEwBO,QAAQP;;;;;;;;;+BAS7BC,yCAAyCG;;wBAEhDI"}