Skip to content

FastAPI-based wrapper for the Aleph Alpha API to make it OpenAI compatible.

Notifications You must be signed in to change notification settings

zwischenraum/aa-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aleph Alpha API Wrapper

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.

Installation

  1. Clone the repository:

    git clone git@github.com:zwischenraum/aa-api-wrapper.git
    cd aa-api-wrapper
  2. Install Poetry:

    If you haven't installed Poetry yet, follow the official installation guide.

  3. Install dependencies:

    poetry install
  4. Set up environment variables:

    Create a .env file in the root directory and add your Aleph Alpha API base URL:

    ALEPH_ALPHA_API_BASE=https://api.aleph-alpha.com
    

    and if you want to use semantic embeddings

    USE_SEMANTIC_EMBEDDINGS=true
    

Usage

  1. Run the FastAPI server:

    poetry run start
  2. Available Endpoints:

    • Chat Completions: POST /v1/chat/completions
    • Text Completions: POST /v1/completions
    • Embeddings: POST /v1/embeddings
  3. Example Request:

    For text completions, send a POST request to /v1/completions with 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.

About

FastAPI-based wrapper for the Aleph Alpha API to make it OpenAI compatible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages