Skip to content

Commit

Permalink
remove messagegraph
Browse files Browse the repository at this point in the history
  • Loading branch information
isahers1 committed Aug 13, 2024
1 parent 28263d6 commit d3af073
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
17 changes: 14 additions & 3 deletions examples/rag/langgraph_agentic_rag.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,21 @@
"metadata": {},
"outputs": [],
"source": [
"import { MessageGraph } from \"@langchain/langgraph\";\n",
"import { StateGraph } from \"@langchain/langgraph\";\n",
"// Define the top-level State interface\n",
"interface State {\n",
" messages: BaseMessage[];\n",
"}\n",
"\n",
"// Define a new graph\n",
"const workflow = new MessageGraph()\n",
"// Define the graph\n",
"const workflow = new StateGraph<State>({\n",
" channels: {\n",
" messages: {\n",
" value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),\n",
" default: () => [],\n",
" },\n",
" },\n",
"})\n",
" // Define the nodes which we'll cycle between.\n",
" .addNode(\"agent\", agent)\n",
" .addNode(\"retrieve\", retrieve)\n",
Expand Down
16 changes: 14 additions & 2 deletions examples/reflection/reflection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@
"metadata": {},
"outputs": [],
"source": [
"import { END, MemorySaver, MessageGraph, START } from \"@langchain/langgraph\";\n",
"import { END, MemorySaver, StateGraph, START } from \"@langchain/langgraph\";\n",
"\n",
"const generationNode = async (messages: BaseMessage[]) => {\n",
" return [await essayGenerationChain.invoke({ messages })];\n",
Expand All @@ -782,8 +782,20 @@
" return [new HumanMessage({ content: res.content })];\n",
"};\n",
"\n",
"// Define the top-level State interface\n",
"interface State {\n",
" messages: BaseMessage[];\n",
"}\n",
"\n",
"// Define the graph\n",
"const workflow = new MessageGraph()\n",
"const workflow = new StateGraph<State>({\n",
" channels: {\n",
" messages: {\n",
" value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),\n",
" default: () => [],\n",
" },\n",
" },\n",
"})\n",
" .addNode(\"generate\", generationNode)\n",
" .addNode(\"reflect\", reflectionNode)\n",
" .addEdge(START, \"generate\");\n",
Expand Down

0 comments on commit d3af073

Please sign in to comment.