/langGraphDemo

Project showing some LangChain agent and LangGraph graph examples

Primary LanguagePython

LangGraph demo

This repository shows a number of AI powered LangChain agent and LangGraph graph examples. There are two other sister repositories that show additional LangChain functionality:

  • LangChainDemo shows a number of examples of using LangServe, LangChain and LangSmith
  • LangChainDemoClient shows a few simple frontend applications (Gradio, Streamlit, ChainLit) to connect to the LangServe application

Quick start

Make sure you have an API for OpenAI and one for Groq as there are examples using one or the other platform inference points.

Assuming that you have Poetry installed, you can set up the project as shown below:

git clone https://github.com/camba1/langGraphDemo.git
cd langGraphDemo
poetry install
poetry shell
export OPENAI_API_KEY=<YOUR OPENAI_API_KEY>
export GROQ_API_KEY=<YOUR GROQ_API_KEY>    

If you want to trace how your application is working, you can set up LangSmith setting up the three environment variables shown below:

export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=<YOUR LANGCHAIN_API_KEY>
export LANGCHAIN_PROJECT=<A_NAME_FOR_YOUR_PROJECT_CAN_BE_ANYTHING> 

Then you can run the different examples as follows:

  • calculate: Interact with OpenAI and run a graph that does simple math. Run with: python app/calculate.py
  • groqAgent: Uses Groq to call tools using Mixtral-8x7B. Run using: python app/groqAgent.py
  • SimpleGraph: A very simple graph that runs Using OpenAI. Run with: python app/simpleGraph.py