Skip to main content

Python SDK for the Big-O LLM Gateway — OpenAI-compatible access to AWS Bedrock and Azure OpenAI with LlamaIndex and Haystack integrations

Project description

Big-O Python SDK

Python SDK for the Big-O LLM Gateway, a 100% OpenAI-compatible API that provides unified access to multiple LLM providers (AWS Bedrock, Azure OpenAI).

Installation

pip install big-o-sdk

With optional framework integrations:

pip install big-o-sdk[llamaindex]   # + LlamaIndex LLM and embeddings
pip install big-o-sdk[haystack]     # + Haystack embeddings
pip install big-o-sdk[all]          # everything

For development:

git clone https://gitlab.com/virtuele-gemeente-assistent/big-o-sdk.git
cd big-o-sdk
uv sync

Configuration

Set credentials as environment variables or in a .env file:

BIG_O_CLIENT_ID=your-client-id
BIG_O_CLIENT_SECRET=your-client-secret
BIG_O_CHAT_MODEL=gpt-4o-mini
BIG_O_EMBEDDING_MODEL=text-embedding-3-large

Quick Start

Framework-agnostic (recommended)

Use BigOTokenProvider to get credentials for any OpenAI-compatible framework:

from big_o_sdk import BigOConfig, BigOTokenProvider

config = BigOConfig.from_env()
provider = BigOTokenProvider(config)
creds = await provider.get_credentials(model="gpt-4o-mini")
# → {"base_url": "https://...", "api_key": "eyJ...", "model": "gpt-4o-mini"}

Use the credentials with any framework:

# LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(**creds)

# LlamaIndex
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(**creds)

# Agno
from agno.models.openai import OpenAIChat
llm = OpenAIChat(**creds)

# Raw OpenAI SDK
from openai import AsyncOpenAI
client = AsyncOpenAI(base_url=creds["base_url"], api_key=creds["api_key"])

Lightweight completions (no framework needed)

from big_o_sdk import BigOConfig, BigOClient

config = BigOConfig.from_env()
async with BigOClient(config) as client:
    answer = await client.complete("Say hello", model="gpt-4o-mini")
    print(answer)

LlamaIndex (optional)

pip install big-o-sdk[llamaindex]
from big_o_sdk import BigOConfig, BigOLLM

config = BigOConfig.from_env()
llm = BigOLLM(config)
response = await llm.acomplete("Hello!")
await llm.close()

Haystack embeddings (optional)

pip install big-o-sdk[haystack]
from big_o_sdk import BigOConfig
from big_o_sdk.embedders.haystack import BigOTextEmbedder

config = BigOConfig.from_env()
embedder = BigOTextEmbedder(config)
result = embedder.run(text="What is AI?")

Gateway status

from big_o_sdk import BigOConfig, BigOClient

config = BigOConfig.from_env()
async with BigOClient(config) as client:
    await client.health()
    await client.ping()
    models = await client.models()

BigOConfig

Environment Variable Default
BIG_O_CLIENT_ID (required)
BIG_O_CLIENT_SECRET (required)
BIG_O_BASE_URL https://devops.versnellers.nl/bigo/api
BIG_O_CHAT_MODEL gpt-4o-mini
BIG_O_EMBEDDING_MODEL text-embedding-3-large
BIG_O_CONTEXT_WINDOW 128000

Authentication

JWT tokens are managed automatically:

  1. Fetch token via OAuth2 Client Credentials
  2. Cache and refresh 30 seconds before expiry
  3. Pass transparently to the underlying client

Architecture

big_o_sdk core (always available, <1s startup)
├── BigOConfig          Configuration and credentials
├── BigOClient          Lightweight completions, chat, health, models
├── BigOTokenProvider   Fresh JWT tokens for any framework
├── BigOAuthenticator   OAuth2 token lifecycle
└── errors              Domain-specific exceptions

big_o_sdk[llamaindex] (optional)
├── BigOLLM             LlamaIndex LLM wrapper
└── BigOEmbedding       LlamaIndex embedding wrapper

big_o_sdk[haystack] (optional)
├── BigOTextEmbedder    Haystack text embedder
└── BigODocumentEmbedder Haystack document embedder

Project Structure

src/big_o_sdk/
├── config.py             BigOConfig
├── errors.py             Domain exceptions
├── auth.py               BigOAuthenticator
├── client.py             BigOClient (complete, chat, health, models)
├── token_provider.py     BigOTokenProvider
├── mixins.py             Shared token refresh logic
├── agents/
│   └── llamaindex.py     BigOLLM
└── embedders/
    ├── llamaindex.py     BigOEmbedding
    └── haystack.py       BigOTextEmbedder, BigODocumentEmbedder

Related Projects

  • ai-orchestration: RAG chatbot using LlamaIndex agents and Haystack embeddings
  • scrapy: Web scraper with Haystack document indexing and hybrid search

License

EUPL v1.2, see LICENSE for details.

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

big_o_sdk-1.2.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

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

big_o_sdk-1.2.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file big_o_sdk-1.2.0.tar.gz.

File metadata

  • Download URL: big_o_sdk-1.2.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for big_o_sdk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 48a2926c31319b3204de0b2fb93be872e6cc0f4393a4063b6e16a437cf47ec07
MD5 d409db0cda48c32add20cc6012efb768
BLAKE2b-256 842ed0327eaebd913fec9ace19256c1c4943b0a4ffe3ec1c3ed24bc1f74449ec

See more details on using hashes here.

File details

Details for the file big_o_sdk-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: big_o_sdk-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for big_o_sdk-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d055c5af08cb1586b07aed2fd3678276abe5d2773e958f5a2f8de553e4769216
MD5 a03bb5920ea3d04627bd1d14f3c27159
BLAKE2b-256 7b230f74b5eede1d07139cbc2feac53ab1520e49e36b3408d4f4bcf66edf611d

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