Skip to content

High-performance REST API for generating text embeddings, optimized for retrieval-augmented generation (RAG).

License

Notifications You must be signed in to change notification settings

mishl-dev/text-embed-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Embedding API

Python Code style: ruff License Framework

A high-performance REST API for the nomic-ai/nomic-embed-text-v1.5 model. Features dynamic dimensionality and an auto-unload mechanism to conserve GPU memory.

Setup

These instructions assume you have uv installed (pip install uv).

  1. Clone the repository:

    git clone https://github.com/mishl-dev/text-embed-api
    cd text-embed-api
  2. Create a virtual environment and install dependencies:

    uv sync
  3. Run the server:

    uv run main.py

    The API is now running at http://localhost:8000. Interactive documentation is available at http://localhost:8000/schema.

Configuration

Settings are managed in the .env file:

# Leave empty to disable authentication
API_KEY=your-secret-key

# Unload model after 3600s (1hr) of inactivity. Set to 0 to disable.
MODEL_IDLE_TIMEOUT_SECONDS=3600

Usage

Use curl or any HTTP client to make a POST request to the /embed endpoint:

curl -X POST "http://localhost:8000/embed" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-key" \
-d '{
  "texts": ["Hello world!"],
  "dimensionality": 256
}'

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

High-performance REST API for generating text embeddings, optimized for retrieval-augmented generation (RAG).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages