AIMO is a lightweight, large-language model backend designed to provide emotional companionship through conversations. It is optimized for generating empathetic and engaging responses, making it an ideal solution for emotional companion toys and applications.
- Emotional Engagement: Provides empathetic and meaningful responses to user inputs, fostering an emotional connection.
- Lightweight and Efficient: Optimized for performance on devices with GPU or CPU, ensuring smooth interactions.
- Customizable: Easily adaptable for specific use cases or personalized prompts, enabling tailored interactions.
- Python 3.6 or higher
- CUDA 12.4 (for GPU support)
Follow the steps below to set up AIMO on your system:
# Clone the repository
git clone https://github.com/AIMOverse/AIMO-Models.git
cd AIMO-Models
# Install dependencies
pip install -r requirements.txt
AIMO can also be deployed using Docker for easier dependency management and deployment:
# Clone the repository
git clone https://github.com/AIMOverse/AIMO-Models.git
cd AIMO-Models
# Build Docker Image and pass HF_ACCESS_TOKEN
docker build --build-arg HF_ACCESS_TOKEN=<your_hf_access_token> -t aimo-models-app .
# Run the Docker container
docker run --hostname ai-model-service -p 8000:8000 -e NEBULA_API_KEY=<your_key> -e SECRET_KEY=<your_secret_key> -e ADMIN_API_KEY=<your_admin_api_key> -e DATABASE_URL=<your_database_url> aimo-models-app
To deploy AIMO on Phala Network, follow these steps:
-
Ensure you have the necessary API keys:
HF_ACCESS_TOKEN
: For downloading Hugging Face models
-
Build the Docker image with the required environment variables:
# Export your API keys as environment variables
export HF_ACCESS_TOKEN="your_huggingface_token_here"
# Build the Docker image
docker build --build-arg HF_ACCESS_TOKEN=$HF_ACCESS_TOKEN -t aimoverse/aimo-emotion-model .
- Push the image to a container registry accessible by the Phala Network:
# Tag the image for your registry
docker tag aimoverse/aimo-emotion-model your-registry/aimoverse/aimo-emotion-model:latest
# Push to registry
docker push your-registry/aimoverse/aimo-emotion-model:latest
- Deploy on Phala using their container deployment interface.
The following environment variables are used by AIMO:
Variable | Description | Required | Time of Requirement |
---|---|---|---|
HF_ACCESS_TOKEN |
Hugging Face access token for downloading models | Yes | During building Images |
NEBULA_API_KEY |
API key for LLM service | Yes | During running applications |
SECRET_KEY |
Secret Key for JWT Tokens | Yes | During running applications |
ADMIN_API_KEY |
Admin Key for manage invitation codes | Yes | During running applications |
AIMO integrates with LiteLLM Proxy to provide multi-provider LLM support through a unified interface. This enables routing to different LLM providers (OpenAI, Anthropic, OpenRouter, local models) with automatic fallback capabilities.
-
Configure Environment Variables
Add the following to your
.env
file:# LiteLLM Proxy Configuration LLM_BASE_URL=http://localhost:4000 LLM_API_KEY=sk-litellm-proxy-key LLM_MODEL_DEFAULT=prod_default LLM_TIMEOUT=60 # LiteLLM Master Key LITELLM_MASTER_KEY=sk-litellm-proxy-key # Provider API Keys (add as needed) OPENROUTER_API_KEY=your_openrouter_key_here
-
Start LiteLLM Proxy Service
# Navigate to the LiteLLM directory cd infra/litellm # Start the LiteLLM Proxy using Docker Compose docker-compose -f docker-compose.litellm.yml up -d
-
Verify LiteLLM Service
# Check if LiteLLM Proxy is running curl http://localhost:4000/health # Test the new endpoints curl -X GET http://localhost:8000/api/v1.0.0/chat/health curl -X GET http://localhost:8000/api/v1.0.0/chat/models
-
Stop LiteLLM Service
# Stop the LiteLLM Proxy cd infra/litellm docker-compose -f docker-compose.litellm.yml down
- Multi-Provider Support: Route to different LLM providers through one interface
- Automatic Fallbacks: Fallback to alternative models if primary fails
- Cost Optimization: Route to cheaper models when appropriate
- Local Model Integration: Support for local models via Ollama
- Centralized Configuration: Manage all LLM configurations in one place
Start the AIMO server using the following command:
# If installed directly
fastapi run app/main.py
# If using Docker
docker run --hostname ai-model-service -p 8000:8000 -e NEBULA_API_KEY=your_key -e SECRET_KEY=your_secret_key -e ADMIN_API_KEY=your_admin_api_key -e DATABASE_URL=your_database_url -d aimoverse/aimo-emotion-model
Once the server is running, you can integrate it with your applications or test it through API endpoints.
Please Test the server before push!!!
Test the server using the command below:
coverage run --source=app -m pytest
coverage report --show-missing
coverage html --title "${@-coverage}"
The AIMO backend provides a RESTful API for interaction. The version 1.0.0 of the server has a base url of /api/v1.0.0. Below are the main endpoints:
{
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_new_tokens": 100,
"stream": false
}
Method: POST
Request Body:
{
"model": "prod_default",
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 100,
"stream": false
}
Method: GET
Returns list of available LLM models configured in LiteLLM.
Method: GET
Returns LiteLLM Proxy connection status.
{
"id": "chatcmpl-8ca23289-da13-4374-87a4-9020f5bbbebe",
"object": "chat.completion",
"created": 1741649537,
"model": "aimo-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! It's nice to meet you. How's your day going so far?"
},
"delta": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}
We welcome contributions to improve AIMO! Please fork the repository, make changes, and submit a pull request. Ensure your code adheres to the project's coding standards.
This project is licensed under the MIT License.