Tried out the capability of Langhgraph with Ollama, and built a rag agent, with different state. Its like State Machine, where each state can transition into a different state on certain actions.
We depend on following packages that would need us to create account and get API keys. The packages are:
After we have an account in the above sites, let's update the .env.example file with the API keys and rename it to .env.
After we have the .env file updated we need to run npm install to install the dependencies. After that we can start the agent with npm start.
The question to the chat agent is hard coded in the main.ts for now.
Make sure you have Ollama server running locally.
The Agent consist of following
.
The State Graph has 4 states:
Here is what the 2 flows will output
Web Search
.
Using Document
.