https://github.com/sofyan48/ochabot
Rag Tools for Retrieval QA
https://github.com/sofyan48/ochabot
ai bot fastapi groq langchain langchain-python mistral model ocha openai rag retrieval
Last synced: 15 days ago
JSON representation
Rag Tools for Retrieval QA
- Host: GitHub
- URL: https://github.com/sofyan48/ochabot
- Owner: sofyan48
- License: mit
- Created: 2025-01-11T08:10:16.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-02-15T14:41:15.000Z (8 months ago)
- Last Synced: 2025-04-11T19:09:58.122Z (6 months ago)
- Topics: ai, bot, fastapi, groq, langchain, langchain-python, mistral, model, ocha, openai, rag, retrieval
- Language: Python
- Homepage: https://ocha.iank.me/docs
- Size: 271 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: .github/code_of_conduct.md
Awesome Lists containing this project
README
# OCHABOT GPT OR RAG (RTFM)
[](https://github.com/sofyan48/ochabot/actions/workflows/production.yml)## Description
this project used on my profile page: [iank.me](https://iank.me).
Based on mistral AI, OpenAI, Groq, langchain and chroma vector database, I'm still learning, and this is my first project in AI## Platform Support
### AI Platform
- OpenAI
- MistralAI
- Groq
- Deepseek
- Ollama### Embedding
- Huggingface
- Mistral
- Nvidia## Requirements
### Databse
- Redis (LLM Cache and setup)
- Postgree (History)
- ChromaDB (Vector Database)
- Elasticsearch (Vector Database)
### Storage
- Minio## How To Run
Running via poetry and activate virtualenvironment
```
poetry env activate
```
Run the serve
```
poetry run http serve
```
or
```
python main.py serve
```## Dependency
```
docker compose up
```## Install Requirement
```
poetry install
```## Environment Setup
```
cp env.example .env
```
please setup APP_ENVIRONTMENT to local if you setup on development mode## Migration
Im using alembic migration via poetry custom command
```
poetry run db:migrate create "your table name"
```
up migration
```
poetry run db:migrate up
```
downgrade migration
```
poetry run db:migrate down "your revision"
```## Swagger
```
http://localhost:8081/docs
```## Default User
```
username: admin
password: admin
```## Socket
url:
```
localhost:8081/ex/v1/chat/ws/{client_id}
```
payload:
```
{
"chat": "hello",
"collection": "ocha_v2",
"llm": "openai", // optional
"model": "gpt-4o-mini" // optional
}
```## Structured Diagram
```mermaid
graph TB
User((External User))
subgraph "Ochabot System"
subgraph "API Layer"
FastAPI["API Server
(FastAPI)"]
Router["Router
(FastAPI Router)"]
WebSocket["WebSocket Handler
(FastAPI WebSocket)"]
subgraph "API Components"
ChatHandler["Chat Handler
(Python)"]
UserHandler["User Handler
(Python)"]
IngestHandler["Ingest Handler
(Python)"]
PromptHandler["Prompt Handler
(Python)"]
SetupHandler["Setup Handler
(Python)"]
ClientHandler["Client Handler
(Python)"]
LoginHandler["Login Handler
(Python)"]
end
endsubgraph "LLM Services"
LLMWrapper["LLM Wrapper
(Python)"]
subgraph "LLM Providers"
OpenAI["OpenAI Service
(OpenAI API)"]
Mistral["Mistral Service
(Mistral API)"]
Groq["Groq Service
(Groq API)"]
DeepSeek["DeepSeek Service
(DeepSeek API)"]
Ollama["Ollama Service
(Ollama API)"]
end
endsubgraph "Data Storage"
PostgreSQL[("PostgreSQL
(Primary Database)")]
Redis[("Redis
(Cache)")]
MinIO[("MinIO
(Object Storage)")]
ChromaDB[("ChromaDB
(Vector Store)")]
endsubgraph "Core Services"
DatabaseService["Database Service
(SQLAlchemy)"]
VectorService["Vector Store Service
(LangChain)"]
CacheService["Cache Service
(Redis Stack)"]
StorageService["Storage Service
(MinIO)"]
end
end%% Connections
User -->|"HTTP/WebSocket"| FastAPI
FastAPI -->|"Routes"| Router
Router -->|"Handles WebSocket"| WebSocket
%% API Components connections
Router --> ChatHandler
Router --> UserHandler
Router --> IngestHandler
Router --> PromptHandler
Router --> SetupHandler
Router --> ClientHandler
Router --> LoginHandler%% LLM Service connections
ChatHandler --> LLMWrapper
LLMWrapper --> OpenAI
LLMWrapper --> Mistral
LLMWrapper --> Groq
LLMWrapper --> DeepSeek
LLMWrapper --> Ollama%% Data Storage connections
DatabaseService --> PostgreSQL
CacheService --> Redis
StorageService --> MinIO
VectorService --> ChromaDB%% Service Usage connections
ChatHandler --> DatabaseService
UserHandler --> DatabaseService
IngestHandler --> DatabaseService
PromptHandler --> DatabaseService
SetupHandler --> DatabaseService
ClientHandler --> DatabaseService
LoginHandler --> DatabaseServiceChatHandler --> VectorService
IngestHandler --> VectorService
ChatHandler --> CacheService
UserHandler --> CacheService
IngestHandler --> StorageService
```