Using the ai_service as backend for openwebui
This commit is contained in:
+23
-20
@@ -1,25 +1,28 @@
|
||||
# AI Service for Chatbot Application
|
||||
# OpenWebUI Backend Service
|
||||
|
||||
This is the AI service component for the chatbot application. It provides APIs for document processing, embeddings, and chat functionality.
|
||||
This is a backend service for OpenWebUI that provides OpenWebUI-compatible API endpoints for chat functionality and model switching.
|
||||
|
||||
## Features
|
||||
|
||||
- Document processing and embedding
|
||||
- Retrieval-augmented generation (RAG)
|
||||
- OpenWebUI-compatible API endpoints
|
||||
- Ollama API proxy
|
||||
- Chat functionality with model switching
|
||||
- Team chat support
|
||||
- Support for multiple LLM models (gemma3, llama3.3, llama3.1, mistral, deepseek)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
ai_service/
|
||||
├── embeddings/ # Embedding and document processing services
|
||||
├── models/ # Model and chat services
|
||||
├── utils/ # Utility functions
|
||||
├── data/ # Data storage
|
||||
│ ├── model_service.py
|
||||
│ ├── chat_service.py
|
||||
│ └── model_parameters.py
|
||||
├── embeddings/ # Document processing for RAG
|
||||
│ └── document_service.py
|
||||
├── openwebui_api.py # OpenWebUI-compatible API endpoints
|
||||
├── config.py # Configuration settings
|
||||
├── api.py # FastAPI application
|
||||
└── run.py # Script to run the service
|
||||
└── deploy.sh # Deployment script
|
||||
```
|
||||
|
||||
## Setup Instructions
|
||||
@@ -43,7 +46,7 @@ ai_service/
|
||||
|
||||
4. Run the service:
|
||||
```
|
||||
python run.py
|
||||
python ../run_ai_service.py
|
||||
```
|
||||
|
||||
## API Documentation
|
||||
@@ -70,20 +73,20 @@ This will start the service on port 5251 using uvicorn with nohup.
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Document Endpoints
|
||||
### Health Check
|
||||
|
||||
- `POST /documents` - Process a document for embedding
|
||||
- `GET /documents` - Get all documents
|
||||
- `GET /documents/{doc_id}` - Get a document by ID
|
||||
- `DELETE /documents/{doc_id}` - Delete a document
|
||||
- `POST /documents/search` - Search for documents
|
||||
- `GET /health` - Check if the service is running
|
||||
|
||||
### Model Endpoints
|
||||
### OpenWebUI-Compatible Endpoints
|
||||
|
||||
- `GET /models` - Get available models
|
||||
- `GET /models/{model_id}` - Get information about a model
|
||||
- `GET /api/models` - Get available models in OpenWebUI format
|
||||
- `POST /api/chat/completions` - OpenAI-compatible chat completions endpoint
|
||||
|
||||
### Chat Endpoints
|
||||
### Ollama API Proxy
|
||||
|
||||
- `POST /ollama/api/generate` - Proxy to Ollama's generate endpoint
|
||||
|
||||
### Original API Endpoints
|
||||
|
||||
- `POST /chats` - Create a new chat
|
||||
- `GET /chats/user/{user_id}` - Get all chats for a user
|
||||
|
||||
Reference in New Issue
Block a user