A conversational AI assistant that helps users verify their contract details (like Contract ID and address) using natural language. Built with LangGraph, LangChain, and OpenAI’s GPT-4o, this bot automates the first step of many customer service workflows—saving time and improving the user experience.
- Dynamic stateful conversation flow using LangGraph
- Tool invocation with LangChain's tool bindings
- Word-by-word streaming output for more human-like responses
- Structured response parsing with validation
- Custom contract address lookup tool
- LangGraph
- LangChain
- OpenAI GPT-4o
- Python 3.10+
- Pydantic / TypedDict for schema definitions
- Python 3.10 or newer
- OpenAI API key with access to GPT-4o
Install dependencies:
pip install langchain langgraph openai typing-extensions pydantic🔑 Setup Create an .env file or pass your OpenAI key directly:
llm = init_chat_model(
"gpt-4o",
model_provider="openai",
api_key="your-openai-key-here"
)Run the assistant:
python main.pyThe bot will stream responses and guide you through confirming your contract address.
🧠 How It Works The assistant greets the user and requests a Contract ID.
If the ID matches a known value, the tool retrieves the address.
The assistant confirms the address with the user using structured output.
If confirmed, it proceeds to the next step (or loops back if not).
The flow is managed via a LangGraph state machine, with nodes like:
welcome_user
get_users_input
user_confirm
finish_conversation
✅ Example IDs to Test Try using one of these when prompted:
XZ222321 → Schönbrunner Schloßstraße 47, 1130 Wien, Austria
XZ222322 → Stephansplatz 3, 1010 Wien, Austria
XZ222323 → Prinz Eugen-Straße 27, 1030 Wien, Austria
📌 License MIT License
🙌 Acknowledgements Thanks to the teams behind LangChain and OpenAI for making such powerful tools accessible to developers.
💬 Questions or Ideas? Feel free to open an issue or connect on LinkedIn to discuss improvements or collaborations.