Langchain Chat Assistant using Chainlit App

Hey there! If you’re excited about building your own AI assistant using Langchain and Chainlit, you’re in the right place. In this post, I’ll walk you through the steps to set up a simple yet powerful AI assistant. Let’s dive in!

Demo


This content originally appeared on DEV Community and was authored by Yash Jivani

Hey there! If you're excited about building your own AI assistant using Langchain and Chainlit, you're in the right place. In this post, I'll walk you through the steps to set up a simple yet powerful AI assistant. Let’s dive in!

Demo

This is Video Demo recording.

Steps to Configure

Follow these steps to configure the app on your machine!

1. Clone Git Repo

git clone https://github.com/jivaniyash/langchain-chat-assistant.git
cd ./langchain-chat-assistant

2. Create & Activate Virtual Env

sudo apt install python3.11-venv
python3 -m venv .venv
source ./.venv/bin/activate
python3 -m pip install --upgrade pip

3. Install Packages

pip install chainlit langchain_openai langchain

4. Run the script

chainlit run ./app/main_openai.py -w

-w flag to enable auto-reloading

This will open a web browser automatically. If not, please copy this link - localhost:8000 into the web browser.

Customize

  • Now, you can customize your app to specific use cases by changing System Prompt from ./utils/systemPrompt.md.

  • Add New Functions to tailor your use-cases from ./utils/functions.py. Also, if you need to connect using local database, csv, or Excel or any other data files; add those files under ./assests/ directory. fetchFromLocalDB function explains how to configure adding new data sources.

Run Local LLM using OLLAMA APIs

If you want to run your assistant using local LLM running in OLLAMA, please follow these steps.

And there you have it! You can now build and run your own AI assistant using OpenAI or OLLAMA. Enjoy exploring the possibilities!

Please look at my GitHub Repo to get a glance over the files.


This content originally appeared on DEV Community and was authored by Yash Jivani


Print Share Comment Cite Upload Translate Updates
APA

Yash Jivani | Sciencx (2024-08-21T17:13:41+00:00) Langchain Chat Assistant using Chainlit App. Retrieved from https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/

MLA
" » Langchain Chat Assistant using Chainlit App." Yash Jivani | Sciencx - Wednesday August 21, 2024, https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/
HARVARD
Yash Jivani | Sciencx Wednesday August 21, 2024 » Langchain Chat Assistant using Chainlit App., viewed ,<https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/>
VANCOUVER
Yash Jivani | Sciencx - » Langchain Chat Assistant using Chainlit App. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/
CHICAGO
" » Langchain Chat Assistant using Chainlit App." Yash Jivani | Sciencx - Accessed . https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/
IEEE
" » Langchain Chat Assistant using Chainlit App." Yash Jivani | Sciencx [Online]. Available: https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/. [Accessed: ]
rf:citation
» Langchain Chat Assistant using Chainlit App | Yash Jivani | Sciencx | https://www.scien.cx/2024/08/21/langchain-chat-assistant-using-chainlit-app/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.