### Technical assignment for the developer
#### Task title:
Integration of AI system (GPT-4o + local Mistral) as short-term and long-term memory
---
### Goal:
Create a system that will use:
- OpenAI GPT-4o API as operational (short-term) memory for quick responses and execution of operational tasks.
- Local Mistral 7B model (open-source LLM) as autonomous analytical long-term memory that will store all project context, analyze information, and provide it upon request to GPT-4o.
---
### System output:
The system must ensure interaction between two types of AI:
#### 1. GPT-4o (OpenAI API)
- Works as short-term memory (operational analysis).
- Generates texts, content, responds to operational requests.
- If information beyond the context (128k tokens) is required, GPT-4o must automatically send a request to local memory (Mistral).
#### 2. Local server (Mistral 7B)
- Deployed on Linux (Ubuntu) with NVIDIA RTX 4090 (CUDA).
- Uses PyTorch, HuggingFace Transformers libraries.
- Stores and analyzes information received from GPT-4o or directly from texts (**books, project goals, cryptocurrency, social networks**).
- Returns analyzed information (key points, conclusions, embeddings) upon request from GPT-4o.
---
### Interaction algorithm:
1. GPT-4o receives a request.
2. If there is enough context — it responds immediately.
3. If information is lacking — GPT-4o automatically forms a request to the local Mistral model:
- Mistral analyzes data in its memory.
- Returns the answer in the form of points or a brief text.
4. GPT-4o integrates the received data into the response to the user.
---
### Required integrations and APIs:
- OpenAI API (GPT-4o)
- [OpenAI API keys](https://platform.openai.com/api-keys)
- API requests via Python or Node.js (**preferably Python**).
- Mistral 7B (locally):
- [HuggingFace Transformers](https://huggingface.co/docs/transformers/index)
- [PyTorch](https://pytorch.org/)
- FastAPI or Flask to create a local REST API server for interaction.
- Database for Mistral:
- ChromaDB or PostgreSQL (using PGVector for storing embeddings).
---
### Technical requirements:
- OS: Linux Ubuntu 24.04 LTS
- GPU: NVIDIA RTX 4090
- RAM: 128 GB
- SSD: 2-4 TB (NVMe)
- Docker (preferably for deployment)
---
### Expected result:
✅ Fully functional hybrid system GPT-4o + Mistral 7B.
✅ API interface for convenient request formation and response retrieval.
✅ Stable operation with minimal latency.
---
### Additional wishes:
- Implement system monitoring (**resources, response speed**).
- Simplified scalability option (adding additional models).