Skip to main content

Posts

Showing posts with the label Google Generative AI

Stateful LLM Chatbot Server with Gemini 2.5 Pro using LangGraph

  In this tutorial, we upgrade the   stateless chatbot server   by adding stateful memory support using   LangGraph . This enables more human-like, multi-turn conversations where the model remembers previous messages. Key Features of This Upgrade Powered by  Gemini 2.5 Pro  via LangChain's integration Uses  LangGraph's MemorySaver  for session memory Built with  Flask  and CORS enabled Maintains per-user conversation history using  thread_id Difference from the Stateless Version The main differences from the stateless version are: State Management:  Introduces a  State  class using  TypedDict  to track conversation history via  messages . LangGraph Integration:  Defines a stateful workflow using  StateGraph  and persists memory using  MemorySaver . Session Memory:  Associates chat sessions with a unique  thread_id  (e.g.,  user_124 ) using LangGraph's  config...