Skip to main content

Unified access layer for completion and embedding services

Project description

ai_api_unified · Unified Foundation-Model Client Library

Version: 0.1.0  |  License: MIT

ai_api_unified provides a single, typed interface for calling both completion-style LLMs and text-embedding models across vendors (OpenAI, Amazon Bedrock/Titan, …).

Prerequisites

  • Python 3.12.1 (only)
    We strongly recommend using pyenv to install and pin exactly 3.12.1, so that compiled wheels (e.g. tiktoken) are available and no Rust toolchain is required.

Installation

# from your internal Artifactory PyPI
pip install --index-url https://<org>.jfrog.io/artifactory/api/pypi/pypi-local/simple ai_api_unified

Supported Python ≥ 3.9 (< 4.0).

Quick start

from ai_api_unified import AIFactory

# Completions
client = AIFactory.get_ai_completions_client()           # auto-selects engine via .env
response = client.send_prompt("Say hello in German")
print(response)  # → "Hallo!"

# Embeddings
embedder = AIFactory.get_ai_embedding_client()
vector = embedder.generate_embeddings("vectorize me")

Repository layout

src/ai_api_unified/              ← package source
└── ai_base.py           ← abstract interfaces
└── ai_factory.py        ← runtime factory
tests/                   ← pytest suite
.env_template            ← sample environment config

Development

# create virtualenv & install runtime + dev dependencies
poetry install --with dev
pytest -q

Linting and formatting:

ruff check .
ruff format .

Publishing to Artifactory (Poetry workflow)

poetry version 0.1.0        # bump when ready
poetry build                # builds wheel + sdist
poetry config repositories.ups-ai https://<org>.jfrog.io/artifactory/api/pypi/pypi-local
poetry publish -r ups-ai

Roadmap

  • Add more provider back-ends (Anthropic, Google).
  • Provide async variants for high-throughput workloads.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_api_unified-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_api_unified-0.1.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_api_unified-0.1.0.tar.gz.

File metadata

  • Download URL: ai_api_unified-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.4 Darwin/24.4.0

File hashes

Hashes for ai_api_unified-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c847d34382cd11deb61a3b6cc505b3eddda32ed5341e8cd5b06e65ec5330f7e1
MD5 6974b29bfce3bc0281ff0ccc5e733a18
BLAKE2b-256 5010bd5a4d5f14ad22e931de8f2401ae3857738af9025ae0fcc0c50d7b876aa9

See more details on using hashes here.

File details

Details for the file ai_api_unified-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_api_unified-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.4 Darwin/24.4.0

File hashes

Hashes for ai_api_unified-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67322af1a167a34b8614065dee5c22221b88df5773d905f4074ff4d4472f99d4
MD5 0a35cf48931dffd5d41e042adf3afee3
BLAKE2b-256 3f6a66fbd84d21b6565ac23807d08ef43d8c93d074d8bdc2f697eed8d8701900

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page