Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions examples/agent_executor/base.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,15 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"id": "25789946",
"metadata": {},
"outputs": [],
"source": [
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"import { ToolNode } from \"@langchain/langgraph/prebuilt\";\n",
"\n",
"const tools = [new TavilySearchResults({ maxResults: 1 })];\n",
"\n",
"const tools = [new TavilySearch({ maxResults: 1 })];\n",
"const toolNode = new ToolNode<typeof AgentState.State>(tools);"
]
},
Expand Down
6 changes: 3 additions & 3 deletions examples/chat_agent_executor_with_function_calling/base.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "5cf3331e-ccb3-41c8-aeb9-a840a94d41e7",
"metadata": {},
"outputs": [],
"source": [
"import { ToolExecutor } from \"@langchain/langgraph/prebuilt\";\n",
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"\n",
"const tools = [new TavilySearchResults({ maxResults: 1 })];\n",
"const tools = [new TavilySearch({ maxResults: 1 })];\n",
"\n",
"const toolExecutor = new ToolExecutor({\n",
" tools,\n",
Expand Down
10 changes: 5 additions & 5 deletions examples/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -120,14 +120,14 @@
"process.env.OPENAI_API_KEY = \"sk-...\";\n",
"process.env.TAVILY_API_KEY = \"tvly-...\";\n",
"\n",
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"import { ChatOpenAI } from \"@langchain/openai\";\n",
"import { MemorySaver } from \"@langchain/langgraph\";\n",
"import { HumanMessage } from \"@langchain/core/messages\";\n",
"import { createReactAgent } from \"@langchain/langgraph/prebuilt\";\n",
"\n",
"// Define the tools for the agent to use\n",
"const agentTools = [new TavilySearchResults({ maxResults: 3 })];\n",
"const agentTools = [new TavilySearch({ maxResults: 3 })];\n",
"const agentModel = new ChatOpenAI({ temperature: 0 });\n",
"\n",
"// Initialize memory to persist state between graph runs\n",
Expand Down Expand Up @@ -246,14 +246,14 @@
"process.env.OPENAI_API_KEY = \"sk-...\";\n",
"process.env.TAVILY_API_KEY = \"tvly-...\";\n",
"\n",
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"import { ChatOpenAI } from \"@langchain/openai\";\n",
"import { HumanMessage, AIMessage } from \"@langchain/core/messages\";\n",
"import { ToolNode } from \"@langchain/langgraph/prebuilt\";\n",
"import { StateGraph, MessagesAnnotation } from \"@langchain/langgraph\";\n",
"\n",
"// Define the tools for the agent to use\n",
"const tools = [new TavilySearchResults({ maxResults: 3 })];\n",
"const tools = [new TavilySearch({ maxResults: 3 })];\n",
"const toolNode = new ToolNode(tools);\n",
"\n",
"// Create a model and give it access to the tools\n",
Expand Down
7 changes: 3 additions & 4 deletions examples/rag/langgraph_adaptive_rag_local.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "6c3c1c70-ff84-41e8-bf72-738ed52f2dde",
"metadata": {},
"outputs": [
Expand All @@ -569,10 +569,9 @@
}
],
"source": [
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"\n",
"const webSearchTool = new TavilySearchResults({ maxResults: 3 });\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"\n",
"const webSearchTool = [new TavilySearch({ maxResults: 3 })];\n",
"await webSearchTool.invoke(\"red robin\");"
]
},
Expand Down
6 changes: 3 additions & 3 deletions examples/rag/langgraph_crag_mistral.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"import { Document, DocumentInterface } from \"@langchain/core/documents\";\n",
"import { z } from \"zod\";\n",
"import { ChatPromptTemplate } from \"@langchain/core/prompts\";\n",
Expand Down Expand Up @@ -543,7 +543,7 @@
" const question = stateObject.question;\n",
" const documents = stateObject.documents;\n",
"\n",
" const tool = new TavilySearchResults();\n",
" const tool = new TavilySearch();\n",
" const docs = await tool.invoke(question);\n",
" const webResults = new Document({ pageContent: docs });\n",
" const newDocs = documents.concat(webResults);\n",
Expand Down
6 changes: 3 additions & 3 deletions examples/rewoo/rewoo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "91a33c89",
"metadata": {},
"outputs": [],
"source": [
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { TavilySearch } from \"@langchain/tavily\";\n",
"\n",
"const search = new TavilySearchResults();\n"
"const search = new TavilySearch();\n"
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions libs/langgraph/src/tests/tracing.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { test } from "vitest";
import { pull } from "langchain/hub";
import { ChatOpenAI } from "@langchain/openai";
import { TavilySearchResults } from "@langchain/community/tools/tavily_search";
import { TavilySearch } from "@langchain/tavily";
import {
ChatPromptTemplate,
MessagesPlaceholder,
Expand All @@ -30,7 +30,7 @@ import { createAgentExecutor } from "../prebuilt/agent_executor.js";
import { StateGraph, END, START } from "../index.js";

test.skip("Can invoke with tracing", async () => {
const tools = [new TavilySearchResults({ maxResults: 1 })];
const tools = [new TavilySearch({ maxResults: 1 })];

// Get the prompt to use - you can modify this!
const prompt = await pull<ChatPromptTemplate>(
Expand Down Expand Up @@ -138,7 +138,7 @@ test.skip("Can invoke with tracing", async () => {
});

test.skip("Can nest an agent executor", async () => {
const tools = [new TavilySearchResults({ maxResults: 3 })];
const tools = [new TavilySearch({ maxResults: 3 })];
const llm = new ChatOpenAI({
modelName: "gpt-4-1106-preview",
temperature: 0,
Expand Down Expand Up @@ -258,7 +258,7 @@ test.skip("Can nest an agent executor", async () => {
});

test.skip("Can nest a graph within a graph", async () => {
const tools = [new TavilySearchResults({ maxResults: 3 })];
const tools = [new TavilySearch({ maxResults: 3 })];
const llm = new ChatOpenAI({
modelName: "gpt-4-1106-preview",
temperature: 0,
Expand Down Expand Up @@ -376,7 +376,7 @@ test.skip("Can nest a graph within a graph", async () => {
});

test.skip("Should trace plan and execute flow", async () => {
const tools = [new TavilySearchResults({ maxResults: 3 })];
const tools = [new TavilySearch({ maxResults: 3 })];
// Get the prompt to use - you can modify this!
const prompt = await pull<ChatPromptTemplate>(
"hwchase17/openai-functions-agent"
Expand Down
Loading