Metadata-Version: 2.3
Name: ochabot
Version: 0.8.4
Summary: Ochabot RAG Tools
Author: Sofyan Saputra
Author-email: meongbego@gmail.com
Requires-Python: >=3.10,<3.12
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: aiomysql (>=0.2.0,<0.3.0)
Requires-Dist: aioredis (>=2.0.1,<3.0.0)
Requires-Dist: aiosqlite (>=0.20.0,<0.21.0)
Requires-Dist: alembic (>=1.14.1,<2.0.0)
Requires-Dist: asyncpg (>=0.30.0,<0.31.0)
Requires-Dist: cryptography (>=44.0.0,<45.0.0)
Requires-Dist: environs (>=14.0.0,<15.0.0)
Requires-Dist: fastapi-pagination (>=0.12.14,<0.13.0)
Requires-Dist: greenlet (>=3.1.1,<4.0.0)
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: langchain (>=0.3.13,<0.4.0)
Requires-Dist: langchain-chroma (>=0.1.4,<0.2.0)
Requires-Dist: langchain-community (>=0.3.10,<0.4.0)
Requires-Dist: langchain-elasticsearch (>=0.3.1,<0.4.0)
Requires-Dist: langchain-groq (>=0.2.3,<0.3.0)
Requires-Dist: langchain-mistralai (>=0.2.4,<0.3.0)
Requires-Dist: langchain-nvidia-ai-endpoints (>=0.3.7,<0.4.0)
Requires-Dist: langchain-ollama (>=0.2.3,<0.3.0)
Requires-Dist: langchain-openai (>=0.3.0,<0.4.0)
Requires-Dist: langchain-redis (>=0.1.2,<0.2.0)
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: minio (>=7.2.15,<8.0.0)
Requires-Dist: motor (>=3.6.1,<4.0.0)
Requires-Dist: mysql-connector-python (>=9.1.0,<10.0.0)
Requires-Dist: numpy (<2.0)
Requires-Dist: openai (>=1.59.8,<2.0.0)
Requires-Dist: psycopg2 (>=2.9.10,<3.0.0)
Requires-Dist: pydantic (>=2.10.6,<3.0.0)
Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
Requires-Dist: pymysql (>=1.1.1,<2.0.0)
Requires-Dist: pypdf (>=5.1.0,<6.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: python-json-logger (>=2.0.7,<3.0.0)
Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
Requires-Dist: sqlalchemy (>=2.0.37,<3.0.0)
Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
Requires-Dist: websockets (>=12.0,<13.0)
Description-Content-Type: text/markdown

# OCHABOT GPT OR RAG (RTFM)
[![OCHABOT Push to Registry](https://github.com/sofyan48/ochabot/actions/workflows/production.yml/badge.svg?branch=main)](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)
### Storage
- Minio

## How To Run
Running via poetry and activate virtualenvironment
```
poetry env activate
```
Run the serve
```
poetry run http serve
```

## Install Requirement
```
poetry install
```

## Environment Setup
```
cp env.example .env
```
please setup APP_ENVIRONTMENT to local if you setup on development mode

## Running 
```
python main.py serve
```
with docker
```
docker compose up --build
```

## Migration
Using Alembic
```
alembic revision -m "Your Table"
```
run migration
```
alembic upgrade head
```

## 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<br>(FastAPI)"]
            Router["Router<br>(FastAPI Router)"]
            WebSocket["WebSocket Handler<br>(FastAPI WebSocket)"]
            
            subgraph "API Components"
                ChatHandler["Chat Handler<br>(Python)"]
                UserHandler["User Handler<br>(Python)"]
                IngestHandler["Ingest Handler<br>(Python)"]
                PromptHandler["Prompt Handler<br>(Python)"]
                SetupHandler["Setup Handler<br>(Python)"]
                ClientHandler["Client Handler<br>(Python)"]
                LoginHandler["Login Handler<br>(Python)"]
            end
        end

        subgraph "LLM Services"
            LLMWrapper["LLM Wrapper<br>(Python)"]
            
            subgraph "LLM Providers"
                OpenAI["OpenAI Service<br>(OpenAI API)"]
                Mistral["Mistral Service<br>(Mistral API)"]
                Groq["Groq Service<br>(Groq API)"]
                DeepSeek["DeepSeek Service<br>(DeepSeek API)"]
                Ollama["Ollama Service<br>(Ollama API)"]
            end
        end

        subgraph "Data Storage"
            PostgreSQL[("PostgreSQL<br>(Primary Database)")]
            Redis[("Redis<br>(Cache)")]
            MinIO[("MinIO<br>(Object Storage)")]
            ChromaDB[("ChromaDB<br>(Vector Store)")]
        end

        subgraph "Core Services"
            DatabaseService["Database Service<br>(SQLAlchemy)"]
            VectorService["Vector Store Service<br>(LangChain)"]
            CacheService["Cache Service<br>(Redis Stack)"]
            StorageService["Storage Service<br>(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 --> DatabaseService

    ChatHandler --> VectorService
    IngestHandler --> VectorService
    
    ChatHandler --> CacheService
    UserHandler --> CacheService
    
    IngestHandler --> StorageService
```
