Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06a8e5e

Browse files
committed
updated langgraph version
1 parent 4c77b07 commit 06a8e5e

File tree

6 files changed

+787
-753
lines changed

6 files changed

+787
-753
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Install dependencies
5353
Start the flask server
5454

5555
```bash
56-
poetry run app.py
56+
poetry run main.py
5757
```
5858

5959

graph/graph.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
from graph.consts import GENERATE, GRADE_DOCUMENTS, RETRIEVE, WEBSEARCH
88
from graph.nodes import generate, grade_documents, retrieve, web_search
99
from graph.state import GraphState
10+
from langgraph.checkpoint.sqlite import SqliteSaver
11+
from langgraph.checkpoint import MemorySaver
12+
1013

1114
load_dotenv()
15+
memory = SqliteSaver.from_conn_string(":memory:")
16+
memory = MemorySaver()
1217

1318

1419
def decide_to_generate(state):
@@ -96,6 +101,6 @@ def route_question(state: GraphState) -> str:
96101
)
97102

98103

99-
app = workflow.compile()
104+
app = workflow.compile(checkpointer=memory)
100105

101106
app.get_graph().draw_mermaid_png(output_file_path="graph.png")

langgraph.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"graphs": {
3+
"agent": "./graph/graph.py:app"
4+
},
5+
"env": ".env",
6+
"dependencies": ["."]
7+
}

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
question1 = "What are the types of agent memory?"
99
inputs = {"question": question1}
1010

11-
for output in app.stream(inputs):
11+
for output in app.stream(inputs, config={"configurable": {"thread_id": "2"}}):
1212
for key, value in output.items():
1313
pprint(f"Finished running: {key}:")
1414
pprint(value["generation"])

0 commit comments

Comments
 (0)