Merge branch 'main' into v1

This commit is contained in:
Sydney Runkle
2025-07-08 09:55:13 -04:00
40 changed files with 798 additions and 1106 deletions
@@ -112,7 +112,7 @@ This tells the graph to terminate after running the chatbot node.
## 6. Compile the graph
Before running the graph, we'll need to compile it. We can do so by calling `compile()`
on the graph builder. This creates a `CompiledGraph` we can invoke on our state.
on the graph builder. This creates a `CompiledStateGraph` we can invoke on our state.
```python
graph = graph_builder.compile()
@@ -23,12 +23,16 @@ pip install -U langchain-tavily
Configure your environment with your search engine API key:
```bash
```python
def _set_env(var: str):
if not os.environ.get(var):
os.environ[var] = getpass.getpass(f"{var}: ")
_set_env("TAVILY_API_KEY")
```
```
TAVILY_API_KEY: ········
os.environ["TAVILY_API_KEY"]: "········"
```
## 3. Define the tool
@@ -49,7 +49,7 @@
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langgraph langchain_community langchain_anthropic langchain_experimental"
"%pip install -U langgraph langchain_community langchain_anthropic langchain-tavily langchain_experimental"
]
},
{
@@ -121,10 +121,10 @@
"from typing import Annotated, List\n",
"\n",
"from langchain_community.document_loaders import WebBaseLoader\n",
"from langchain_community.tools.tavily_search import TavilySearchResults\n",
"from langchain_tavily import TavilySearch\n",
"from langchain_core.tools import tool\n",
"\n",
"tavily_tool = TavilySearchResults(max_results=5)\n",
"tavily_tool = TavilySearch(max_results=5)\n",
"\n",
"\n",
"@tool\n",
@@ -37,7 +37,7 @@
"outputs": [],
"source": [
"%%capture --no-stderr\n",
"%pip install -U langchain_community langchain_anthropic langchain_experimental matplotlib langgraph"
"%pip install -U langchain_community langchain_anthropic langchain-tavily langchain_experimental matplotlib langgraph"
]
},
{
@@ -92,11 +92,11 @@
"source": [
"from typing import Annotated\n",
"\n",
"from langchain_community.tools.tavily_search import TavilySearchResults\n",
"from langchain_tavily import TavilySearch\n",
"from langchain_core.tools import tool\n",
"from langchain_experimental.utilities import PythonREPL\n",
"\n",
"tavily_tool = TavilySearchResults(max_results=5)\n",
"tavily_tool = TavilySearch(max_results=5)\n",
"\n",
"# Warning: This executes code locally, which can be unsafe when not sandboxed\n",
"\n",
File diff suppressed because one or more lines are too long