From 0e0094d6abbda82d95d0a1af04e90da6660516cd Mon Sep 17 00:00:00 2001 From: Joshua Carroll Date: Thu, 8 Aug 2024 20:04:27 -0700 Subject: [PATCH] Update to langgraph 0.2 compatibility --- README.md | 2 +- agent/research_assistant.py | 2 +- requirements.txt | 5 +++-- service/service.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c510072..535f36b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# AI Agent Service Toolkit +# 🧰 AI Agent Service Toolkit This repository provides a blueprint and full toolkit for a LangGraph-based agent service architecture. It includes a [LangGraph](https://langchain-ai.github.io/langgraph/) agent, a [FastAPI](https://fastapi.tiangolo.com/) service to serve it, a client to interact with the service, and a [Streamlit](https://streamlit.io/) app that uses the client to provide a chat interface. diff --git a/agent/research_assistant.py b/agent/research_assistant.py index bfc2fad..94a9783 100644 --- a/agent/research_assistant.py +++ b/agent/research_assistant.py @@ -5,7 +5,7 @@ from langchain_core.language_models.chat_models import BaseChatModel from langchain_core.messages import AIMessage, SystemMessage, RemoveMessage from langchain_core.runnables import RunnableConfig, RunnableLambda -from langgraph.checkpoint import MemorySaver +from langgraph.checkpoint.memory import MemorySaver from langgraph.graph import END, StateGraph, MessagesState from langgraph.managed import IsLastStep from langgraph.prebuilt import ToolNode diff --git a/requirements.txt b/requirements.txt index 3530b67..d6fb1ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ # IMPORTANT: This also requires using python < 3.12.4 aiohttp~=3.10.0 -aiosqlite~=0.20.0 arxiv~=2.1.3 duckduckgo-search~=6.2.6 fastapi<0.100.0 @@ -13,7 +12,9 @@ langchain-core~=0.2.26 langchain-community~=0.2.11 langchain-openai~=0.1.20 langchain-groq~=0.1.9 -langgraph==0.1.19 +langgraph~=0.2.3 +langgraph-checkpoint~=1.0.2 +langgraph-checkpoint-sqlite~=1.0.0 langsmith~=0.1.96 numexpr~=2.10.1 pydantic~=1.10.17 diff --git a/service/service.py b/service/service.py index d4a886f..b8df69f 100644 --- a/service/service.py +++ b/service/service.py @@ -8,7 +8,7 @@ from fastapi.responses import StreamingResponse from langchain_core.callbacks import AsyncCallbackHandler from langchain_core.runnables import RunnableConfig -from langgraph.checkpoint.aiosqlite import AsyncSqliteSaver +from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver from langgraph.graph.graph import CompiledGraph from langsmith import Client as LangsmithClient