Skip to content

Commit 60119b9

Browse files
authored
[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
1 parent 5a13ad0 commit 60119b9

File tree

3 files changed

+35
-23
lines changed

3 files changed

+35
-23
lines changed

docs/docs/integrations/providers/valyu.ipynb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# ValyuContext\n",
8-
"\n",
7+
"# Valyu Deep Search\n",
98
">[Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.\n",
109
"\n",
1110
"This notebook goes over how to use Valyu in LangChain.\n",
1211
"\n",
13-
"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",
12+
"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",
1413
"\n",
1514
"## Setup\n",
1615
"\n",
@@ -43,12 +42,20 @@
4342
"metadata": {},
4443
"outputs": [],
4544
"source": [
46-
"from langchain_valyu import ValyuContextRetriever\n",
45+
"from langchain_valyu import ValyuRetriever\n",
4746
"\n",
4847
"valyu_api_key = \"YOUR API KEY\"\n",
4948
"\n",
50-
"# Create a new instance of the ValyuContextRetriever\n",
51-
"valyu_retriever = ValyuContextRetriever(valyu_api_key=valyu_api_key)\n",
49+
"# Create a new instance of the ValyuRetriever\n",
50+
"valyu_retriever = ValyuRetriever(\n",
51+
" k=5,\n",
52+
" search_type=\"all\",\n",
53+
" relevance_threshold=0.5,\n",
54+
" max_price=20.0,\n",
55+
" start_date=\"2024-01-01\",\n",
56+
" end_date=\"2024-12-31\",\n",
57+
" valyu_api_key=valyu_api_key,\n",
58+
")\n",
5259
"\n",
5360
"# Search for a query and save the results\n",
5461
"docs = valyu_retriever.invoke(\"What are the benefits of renewable energy?\")\n",
@@ -84,9 +91,10 @@
8491
" query=\"What are agentic search-enhanced large reasoning models?\",\n",
8592
" search_type=\"all\",\n",
8693
" max_num_results=5,\n",
87-
" similarity_threshold=0.4,\n",
88-
" query_rewrite=False,\n",
94+
" relevance_threshold=0.5,\n",
8995
" max_price=20.0,\n",
96+
" start_date=\"2024-01-01\",\n",
97+
" end_date=\"2024-12-31\",\n",
9098
")\n",
9199
"\n",
92100
"print(\"Search Results:\", search_results)"

docs/docs/integrations/retrievers/valyu.ipynb

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"\n",
99
">[Valyu](https://www.valyu.network/) allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.\n",
1010
"\n",
11-
"This notebook goes over how to use Valyu context tool in LangChain.\n",
11+
"This notebook goes over how to use Valyu deep search tool in LangChain.\n",
1212
"\n",
13-
"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",
13+
"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",
1414
"\n",
1515
"## Setup\n",
1616
"\n",
@@ -57,22 +57,25 @@
5757
" The number of top results to return for each query.\n",
5858
"\n",
5959
"- `search_type: str = \"all\"` \n",
60-
" The type of search to perform. Options may include \"all\", \"web\", \"proprietary\", etc., depending on your use case.\n",
60+
" The type of search to perform: 'all', 'proprietary', or 'web'. Defaults to 'all'.\n",
6161
"\n",
62-
"- `similarity_threshold: float = 0.4` \n",
63-
" The minimum similarity score (between 0 and 1) required for a document to be considered relevant.\n",
64-
"\n",
65-
"- `query_rewrite: bool = False` \n",
66-
" Whether to enable automatic rewriting of the query to improve search results.\n",
62+
"- `relevance_threshold: float = 0.5` \n",
63+
" The minimum relevance score (between 0 and 1) required for a document to be considered relevant. Defaults to 0.5.\n",
6764
" \n",
6865
"- `max_price: float = 20.0`\n",
69-
" The maximum price (in USD) you are willing to spend per query.\n",
66+
" The maximum price (in USD) you are willing to spend per query. Defaults to 20.0.\n",
67+
"\n",
68+
"- `start_date: Optional[str] = None`\n",
69+
" Start date for time filtering in YYYY-MM-DD format (optional).\n",
70+
"\n",
71+
"- `end_date: Optional[str] = None`\n",
72+
" End date for time filtering in YYYY-MM-DD format (optional).\n",
7073
"\n",
7174
"- `client: Optional[Valyu] = None` \n",
7275
" An optional custom Valyu client instance. If not provided, a new client will be created internally.\n",
7376
" \n",
7477
"- `valyu_api_key: Optional[str] = None` \n",
75-
" Your Valyu API key. If not provided, the retriever will look for the `VALYU_API_KEY` environment variable.\n"
78+
" Your Valyu API key. If not provided, the retriever will look for the `VALYU_API_KEY` environment variable."
7679
]
7780
},
7881
{
@@ -81,14 +84,15 @@
8184
"metadata": {},
8285
"outputs": [],
8386
"source": [
84-
"from langchain_valyu import ValyuContextRetriever\n",
87+
"from langchain_valyu import ValyuRetriever\n",
8588
"\n",
86-
"retriever = ValyuContextRetriever(\n",
89+
"retriever = ValyuRetriever(\n",
8790
" k=5,\n",
8891
" search_type=\"all\",\n",
89-
" similarity_threshold=0.4,\n",
90-
" query_rewrite=False,\n",
92+
" relevance_threshold=0.5,\n",
9193
" max_price=20.0,\n",
94+
" start_date=\"2024-01-01\",\n",
95+
" end_date=\"2024-12-31\",\n",
9296
" client=None,\n",
9397
" valyu_api_key=os.environ[\"VALYU_API_KEY\"],\n",
9498
")"

docs/docs/integrations/tools/valyu_context.ipynb renamed to docs/docs/integrations/tools/valyu_search.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"This notebook goes over how to use Valyu context tool in LangChain.\n",
1212
"\n",
13-
"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",
13+
"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",
1414
"\n",
1515
"## Overview\n",
1616
"\n",

0 commit comments

Comments
 (0)