This repo includes a demo chat application built using OpenAI & Langchain that is pre-instrumented for observation with Okahu AI Observability cloud. You can fork this repo and run the app in Github Codespaces to get started quickly.
To try this chatbot
- Fork this repo and run in the Github Codespace
- To run this on Mac
- Install python dependencies:
pip install -r requirement.txt
- Remove libmagic:
pip uninstall python-magic
- Install python dependencies:
- To run this on Windows
- Install python dependencies:
pip install -r requirement.txt
- Install python dependencies:
You'll need
- An OpenAI subscription and an API key to OpenAI developer platform
- An Okahu tenant and API key to Okahu AI Observability Cloud
- Copy the file botenv.sh.template to botenv.sh
- Edit the botenv.sh file to add the OpenAI API Key and Okahu API key and save
This application is an interactive chatbot that answers questions about coffee and built with a RAG design pattern. Workflow is a python program using Langchain LLM orchestration framework. The vector dataset is built using text-embedding-3-large embedding model from OpenAI from a local dataset about coffee. The vector data is stored in a local filebased Chroma vectorDB. The app uses OpenAI gpt-4o-mini model for inference.
To try Okahu from the Github Codespace
-
Run the pre-instrumented chatbot app with following command from top level directory
python lc-openai-with-okahu.py
-
View the workflow discovered by Okahu AI Observability Cloud with following commands with your Okahu API key
- Discover all components
curl --location --request PUT 'https://api.okahu.ai/api/v1/discovery' --header 'x-api-key: <YOUR_OKAHU_API_KEY>;'
- Get discovered components
curl --location 'https://api.okahu.ai/api/v1/components' --header 'x-api-key: <YOUR_OKAHU_API_KEY>;'
Check out Okahu AI Observability Cloud API docs here
- Discover all components
$ python lc-openai-with-okahu.py
Ask a coffee question [Press return to exit]: What is an americano?
An americano is a type of coffee drink that is made by diluting an espresso shot with hot water at a 1:3 to 1:4 ratio, resulting in a drink that retains the complex flavors of espresso, but in a lighter way.
To run the chatbot app without Okahu instrumentation, use the command python lc-openai.py
To understand how Okahu instrumentation works, compare the lc-openai.py and lc-openai-with-okahu.py