This project is a FastAPI-based wrapper for the Aleph Alpha API, providing endpoints for chat completions, text completions, and embeddings. It acts as a proxy to transform requests and responses to be compatible with Aleph Alpha's API.
-
Clone the repository:
git clone git@github.com:zwischenraum/aa-api-wrapper.git cd aa-api-wrapper -
Install Poetry:
If you haven't installed Poetry yet, follow the official installation guide.
-
Install dependencies:
poetry install
-
Set up environment variables:
Create a
.envfile in the root directory and add your Aleph Alpha API base URL:ALEPH_ALPHA_API_BASE=https://api.aleph-alpha.comand if you want to use semantic embeddings
USE_SEMANTIC_EMBEDDINGS=true
-
Run the FastAPI server:
poetry run start
-
Available Endpoints:
- Chat Completions: POST
/v1/chat/completions - Text Completions: POST
/v1/completions - Embeddings: POST
/v1/embeddings
- Chat Completions: POST
-
Example Request:
For text completions, send a POST request to
/v1/completionswith a JSON body:{ "prompt": "Once upon a time", "max_tokens": 50 }The wrapper will transform this request to be compatible with Aleph Alpha's API.