Manages files, provides/retrieves data from AI
- Python 3.8+
- MongoDB Atlas account
- Ollama installed locally
- Create a MongoDB Atlas cluster if you haven't already
- Create a database and collection for storing vectors
- Create a Vector Search Index on your collection with the following configuration:
{
"fields": [
{
"numDimensions": 768,
"path": "embedding",
"similarity": "cosine",
"type": "vector"
},
{
"path": "user_id",
"type": "filter"
}
]
}
- Create a
.env
file in the project root with the following variables:
MONGO_URI=your_mongodb_connection_string
EMBED_MODEL_NAME=nomic-embed-text
LLM_MODEL_NAME=llama2
DB_NAME=your_database_name
COLLECTION_NAME=your_collection_name
VECTOR_SEARCH_INDEX=your_vector_search_index_name
STORAGE_PATH=path_to_store_uploaded_files
- Install Ollama from ollama.ai
- Pull required models:
ollama pull nomic-embed-text
ollama pull llama2
- Start Ollama server:
ollama serve
- Install dependencies:
pip install -r requirements.txt
- Run unit tests:
python -m pytest tests/unit_tests.py
- Run the project (make sure Ollama server is running):
uvicorn main:app --port 8001
The API will be available at http://localhost:8001
Once the server is running, you can access the API documentation at:
- Swagger UI:
http://localhost:8001/docs
- ReDoc:
http://localhost:8001/redoc