Skip to content

The agent engineering platform.

[UPDATE] Valyu 0.2.0 langchain package (#31363)

Alexander Ng60119b9ba660
diff --git a/docs/docs/integrations/providers/valyu.ipynb b/docs/docs/integrations/providers/valyu.ipynb
index ca50d5018a..f112b8b280 100644
--- a/docs/docs/integrations/providers/valyu.ipynb
+++ b/docs/docs/integrations/providers/valyu.ipynb
@@ -4,13 +4,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "# ValyuContext\n",
- "\n",
+ "# Valyu Deep Search\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",
"This notebook goes over how to use Valyu in LangChain.\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",
"## Setup\n",
"\n",
@@ -43,12 +42,20 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain_valyu import ValyuContextRetriever\n",
+ "from langchain_valyu import ValyuRetriever\n",
"\n",
"valyu_api_key = \"YOUR API KEY\"\n",
"\n",
- "# Create a new instance of the ValyuContextRetriever\n",
- "valyu_retriever = ValyuContextRetriever(valyu_api_key=valyu_api_key)\n",
+ "# Create a new instance of the ValyuRetriever\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",
"# Search for a query and save the results\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",
" search_type=\"all\",\n",
" max_num_results=5,\n",
- " similarity_threshold=0.4,\n",
- " query_rewrite=False,\n",
+ " relevance_threshold=0.5,\n",
" max_price=20.0,\n",
+ " start_date=\"2024-01-01\",\n",
+ " end_date=\"2024-12-31\",\n",
")\n",
"\n",
"print(\"Search Results:\", search_results)"
diff --git a/docs/docs/integrations/retrievers/valyu.ipynb b/docs/docs/integrations/retrievers/valyu.ipynb
index eb663ec8fc..b93bab51f4 100644
--- a/docs/docs/integrations/retrievers/valyu.ipynb
+++ b/docs/docs/integrations/retrievers/valyu.ipynb
@@ -8,9 +8,9 @@
"\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",
- "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",
- "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",
"## Setup\n",
"\n",
@@ -57,22 +57,25 @@
" The number of top results to return for each query.\n",
"\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",
- "- `similarity_threshold: float = 0.4` \n",
- " The minimum similarity score (between 0 and 1) required for a document to be considered relevant.\n",
- "\n",
- "- `query_rewrite: bool = False` \n",
- " Whether to enable automatic rewriting of the query to improve search results.\n",
+ "- `relevance_threshold: float = 0.5` \n",
+ " The minimum relevance score (between 0 and 1) required for a document to be considered relevant. Defaults to 0.5.\n",
" \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",
"- `client: Optional[Valyu] = None` \n",
" An optional custom Valyu client instance. If not provided, a new client will be created internally.\n",
" \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": {},
"outputs": [],
"source": [
- "from langchain_valyu import ValyuContextRetriever\n",
+ "from langchain_valyu import ValyuRetriever\n",
"\n",
- "retriever = ValyuContextRetriever(\n",
+ "retriever = ValyuRetriever(\n",
" k=5,\n",
" search_type=\"all\",\n",
- " similarity_threshold=0.4,\n",
- " query_rewrite=False,\n",
+ " relevance_threshold=0.5,\n",
" max_price=20.0,\n",
+ " start_date=\"2024-01-01\",\n",
+ " end_date=\"2024-12-31\",\n",
" client=None,\n",
" valyu_api_key=os.environ[\"VALYU_API_KEY\"],\n",
")"
diff --git a/docs/docs/integrations/tools/valyu_context.ipynb b/docs/docs/integrations/tools/valyu_search.ipynb
similarity index 98%
rename from docs/docs/integrations/tools/valyu_context.ipynb
rename to docs/docs/integrations/tools/valyu_search.ipynb
index bfbccd6105..f0b08e681e 100644
--- a/docs/docs/integrations/tools/valyu_context.ipynb
+++ b/docs/docs/integrations/tools/valyu_search.ipynb
@@ -10,7 +10,7 @@
"\n",
"This notebook goes over how to use Valyu context tool in LangChain.\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",
"## Overview\n",
"\n",