https://github.com/poorvajasathasivam/llm-agent-chatbot
AI-powered assistant built using LangChain, FastAPI, and Streamlit. The chatbot interacts with users to answer questions using prompts and powerful AI models.
https://github.com/poorvajasathasivam/llm-agent-chatbot
fastapi groq-api langchain python streamlit tavily-api
Last synced: 3 months ago
JSON representation
AI-powered assistant built using LangChain, FastAPI, and Streamlit. The chatbot interacts with users to answer questions using prompts and powerful AI models.
- Host: GitHub
- URL: https://github.com/poorvajasathasivam/llm-agent-chatbot
- Owner: poorvajasathasivam
- Created: 2025-01-19T18:47:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-19T19:54:09.000Z (over 1 year ago)
- Last Synced: 2025-01-19T20:26:26.603Z (over 1 year ago)
- Topics: fastapi, groq-api, langchain, python, streamlit, tavily-api
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LangChain AI Assistant
This project is an AI-powered assistant built using **LangChain**, **FastAPI**, and **Streamlit**. The chatbot interacts with users to answer questions using prompts and powerful AI models.
## Features
- **LangChain AI Agent**: A trading assistant powered by LangChain's AI capabilities.
- **Model Selection**: Predefined set of AI models such as "llama3-70b-8192" and "mixtral-8x7b-32768" are available for querying.
- **Customizable System Prompt**: Set a custom system prompt to guide the AI's responses based on the user's needs.
- **Simple Frontend**: The frontend is built with Streamlit for easy interaction with the AI agent.

## Installation
### Prerequisites
- Python 3.7+
- Virtual environment (optional but recommended)
### Clone the repository
```bash
git clone https://github.com/poorvajasathasivam/llm-agent-chatbot.git
```
### Create a virtual environment and activate it (optional):
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
### Install the necessary dependencies:
```bash
pip install -r requirements.txt
```
### Ensure you have the following environment variables set:
**Set up environment variables:**
Create a .env file in the root directory to store the environment variables. Example .env:
- GROQ_API_KEY = your_groq_api_key
- TAVILY_API_KEY = your_tavily_api_key
### Run the FastAPI Backend
To run the FastAPI app:
```bash
python app.py
```
The backend will be available at http://127.0.0.1:8000.
### Run the Streamlit Frontend
To run the Streamlit frontend:
```bash
streamlit run ui.py
```
The frontend will open at http://localhost:8501 by default.
### Usage
Set the system prompt: In the Streamlit frontend, define a system prompt to guide the AI on how to respond to queries. Example:
```bash
You are a financial trading assistant that can help users with trading strategies, market trends, and other financial concepts.
```
**Select a model:** Choose one of the available models like "llama3-70b-8192" or "mixtral-8x7b-32768."
**Enter a message:** Type a trading-related question or prompt in the message input box.
**Click "Submit"**: The FastAPI backend will process the input using LangChain and the selected AI model and return a response.
**Example Queries**
- "Can you explain what a moving average is and how it is used in stock trading?"
- "What is the difference between short and long positions in trading?"
- "Tell me about risk management in trading."