mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-29 06:23:20 +00:00
[UPDATE] Valyu 0.2.0 langchain package (#31363)
docs: update Valyu integration notebooks to reflect current langchain-valyu package implementation Updated the Valyu integration documentation notebooks to align with the current implementation of the langchain-valyu package. The changes include: - Updated ValyuContextRetriever to ValyuRetriever class name - Changed parameter name from similarity_threshold to relevance_threshold - Removed query_rewrite parameter from search tool examples - Added start_date and end_date parameters for time filtering - Updated default values to match current implementation (relevance_threshold: 0.5) - Enhanced parameter documentation with proper descriptions and constraints - Updated section titles to reflect "Deep Search" functionality
This commit is contained in:
parent
5a13ad02ca
commit
60119b9ba6
@ -4,13 +4,12 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# ValyuContext\n",
|
"# Valyu Deep Search\n",
|
||||||
"\n",
|
|
||||||
">[Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.\n",
|
">[Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This notebook goes over how to use Valyu in LangChain.\n",
|
"This notebook goes over how to use Valyu in LangChain.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"First, get an Valyu API key and add it as an environment variable. Get $10 free credit by [signing up here](https://exchange.valyu.network/).\n",
|
"First, get an Valyu API key and add it as an environment variable. Get $10 free credit by [signing up here](https://platform.valyu.network/).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"## Setup\n",
|
"## Setup\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -43,12 +42,20 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain_valyu import ValyuContextRetriever\n",
|
"from langchain_valyu import ValyuRetriever\n",
|
||||||
"\n",
|
"\n",
|
||||||
"valyu_api_key = \"YOUR API KEY\"\n",
|
"valyu_api_key = \"YOUR API KEY\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Create a new instance of the ValyuContextRetriever\n",
|
"# Create a new instance of the ValyuRetriever\n",
|
||||||
"valyu_retriever = ValyuContextRetriever(valyu_api_key=valyu_api_key)\n",
|
"valyu_retriever = ValyuRetriever(\n",
|
||||||
|
" k=5,\n",
|
||||||
|
" search_type=\"all\",\n",
|
||||||
|
" relevance_threshold=0.5,\n",
|
||||||
|
" max_price=20.0,\n",
|
||||||
|
" start_date=\"2024-01-01\",\n",
|
||||||
|
" end_date=\"2024-12-31\",\n",
|
||||||
|
" valyu_api_key=valyu_api_key,\n",
|
||||||
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Search for a query and save the results\n",
|
"# Search for a query and save the results\n",
|
||||||
"docs = valyu_retriever.invoke(\"What are the benefits of renewable energy?\")\n",
|
"docs = valyu_retriever.invoke(\"What are the benefits of renewable energy?\")\n",
|
||||||
@ -84,9 +91,10 @@
|
|||||||
" query=\"What are agentic search-enhanced large reasoning models?\",\n",
|
" query=\"What are agentic search-enhanced large reasoning models?\",\n",
|
||||||
" search_type=\"all\",\n",
|
" search_type=\"all\",\n",
|
||||||
" max_num_results=5,\n",
|
" max_num_results=5,\n",
|
||||||
" similarity_threshold=0.4,\n",
|
" relevance_threshold=0.5,\n",
|
||||||
" query_rewrite=False,\n",
|
|
||||||
" max_price=20.0,\n",
|
" max_price=20.0,\n",
|
||||||
|
" start_date=\"2024-01-01\",\n",
|
||||||
|
" end_date=\"2024-12-31\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"print(\"Search Results:\", search_results)"
|
"print(\"Search Results:\", search_results)"
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
"\n",
|
"\n",
|
||||||
">[Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.\n",
|
">[Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This notebook goes over how to use Valyu context tool in LangChain.\n",
|
"This notebook goes over how to use Valyu deep search tool in LangChain.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"First, get an Valyu API key and add it as an environment variable. Get $10 free credit by [signing up here](https://exchange.valyu.network/).\n",
|
"First, get an Valyu API key and add it as an environment variable. Get $10 free credit by [signing up here](https://platform.valyu.network/).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"## Setup\n",
|
"## Setup\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -57,22 +57,25 @@
|
|||||||
" The number of top results to return for each query.\n",
|
" The number of top results to return for each query.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- `search_type: str = \"all\"` \n",
|
"- `search_type: str = \"all\"` \n",
|
||||||
" The type of search to perform. Options may include \"all\", \"web\", \"proprietary\", etc., depending on your use case.\n",
|
" The type of search to perform: 'all', 'proprietary', or 'web'. Defaults to 'all'.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- `similarity_threshold: float = 0.4` \n",
|
"- `relevance_threshold: float = 0.5` \n",
|
||||||
" The minimum similarity score (between 0 and 1) required for a document to be considered relevant.\n",
|
" The minimum relevance score (between 0 and 1) required for a document to be considered relevant. Defaults to 0.5.\n",
|
||||||
"\n",
|
|
||||||
"- `query_rewrite: bool = False` \n",
|
|
||||||
" Whether to enable automatic rewriting of the query to improve search results.\n",
|
|
||||||
" \n",
|
" \n",
|
||||||
"- `max_price: float = 20.0`\n",
|
"- `max_price: float = 20.0`\n",
|
||||||
" The maximum price (in USD) you are willing to spend per query.\n",
|
" The maximum price (in USD) you are willing to spend per query. Defaults to 20.0.\n",
|
||||||
|
"\n",
|
||||||
|
"- `start_date: Optional[str] = None`\n",
|
||||||
|
" Start date for time filtering in YYYY-MM-DD format (optional).\n",
|
||||||
|
"\n",
|
||||||
|
"- `end_date: Optional[str] = None`\n",
|
||||||
|
" End date for time filtering in YYYY-MM-DD format (optional).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- `client: Optional[Valyu] = None` \n",
|
"- `client: Optional[Valyu] = None` \n",
|
||||||
" An optional custom Valyu client instance. If not provided, a new client will be created internally.\n",
|
" An optional custom Valyu client instance. If not provided, a new client will be created internally.\n",
|
||||||
" \n",
|
" \n",
|
||||||
"- `valyu_api_key: Optional[str] = None` \n",
|
"- `valyu_api_key: Optional[str] = None` \n",
|
||||||
" Your Valyu API key. If not provided, the retriever will look for the `VALYU_API_KEY` environment variable.\n"
|
" Your Valyu API key. If not provided, the retriever will look for the `VALYU_API_KEY` environment variable."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -81,14 +84,15 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain_valyu import ValyuContextRetriever\n",
|
"from langchain_valyu import ValyuRetriever\n",
|
||||||
"\n",
|
"\n",
|
||||||
"retriever = ValyuContextRetriever(\n",
|
"retriever = ValyuRetriever(\n",
|
||||||
" k=5,\n",
|
" k=5,\n",
|
||||||
" search_type=\"all\",\n",
|
" search_type=\"all\",\n",
|
||||||
" similarity_threshold=0.4,\n",
|
" relevance_threshold=0.5,\n",
|
||||||
" query_rewrite=False,\n",
|
|
||||||
" max_price=20.0,\n",
|
" max_price=20.0,\n",
|
||||||
|
" start_date=\"2024-01-01\",\n",
|
||||||
|
" end_date=\"2024-12-31\",\n",
|
||||||
" client=None,\n",
|
" client=None,\n",
|
||||||
" valyu_api_key=os.environ[\"VALYU_API_KEY\"],\n",
|
" valyu_api_key=os.environ[\"VALYU_API_KEY\"],\n",
|
||||||
")"
|
")"
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"This notebook goes over how to use Valyu context tool in LangChain.\n",
|
"This notebook goes over how to use Valyu context tool in LangChain.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"First, get an Valyu API key and add it as an environment variable. Get $10 free credit by [signing up here](https://exchange.valyu.network/).\n",
|
"First, get an Valyu API key and add it as an environment variable. Get $10 free credit by [signing up here](https://platform.valyu.network/).\n",
|
||||||
"\n",
|
"\n",
|
||||||
"## Overview\n",
|
"## Overview\n",
|
||||||
"\n",
|
"\n",
|
Loading…
Reference in New Issue
Block a user