web_search
langroid/parsing/web_search.py
Utilities for web search.
NOTE: Using Google Search requires setting the GOOGLE_API_KEY and GOOGLE_CSE_ID
environment variables in your .env
file, as explained in the
README.
WebSearchResult(title, link, max_content_length=3500, max_summary_length=300)
¶
Class representing a Web Search result, containing the title, link, summary and full content of the result.
link (str): The link to the search result.
max_content_length (int): The maximum length of the full content.
max_summary_length (int): The maximum length of the summary.
Source code in langroid/parsing/web_search.py
metaphor_search(query, num_results=5)
¶
Method that makes an API call by Metaphor client that queries the top num_results links that matches the query. Returns a list of WebSearchResult objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The query body that users wants to make. |
required |
num_results |
int
|
Number of top matching results that we want to grab |
5
|
Source code in langroid/parsing/web_search.py
duckduckgo_search(query, num_results=5)
¶
Method that makes an API call by DuckDuckGo client that queries
the top num_results
links that matche the query. Returns a list
of WebSearchResult objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The query body that users wants to make. |
required |
num_results |
int
|
Number of top matching results that we want to grab |
5
|