Skip to main content

Lightweight LLM routing layer over native provider SDKs

Project description

giskard-llm

Lightweight LLM routing layer over native provider SDKs. Routes provider/model strings to the correct async SDK (OpenAI, Google Gemini, Anthropic, Azure OpenAI, Azure AI Foundry).

Installation

pip install giskard-llm[openai]      # OpenAI + Azure OpenAI + Azure AI Foundry
pip install giskard-llm[google]      # Google Gemini
pip install giskard-llm[anthropic]   # Anthropic
pip install giskard-llm[all]         # All providers

Note: Azure OpenAI (azure/) and Azure AI Foundry (azure_ai/) use the openai SDK. Installing giskard-llm[openai] (or giskard-llm[azure]) covers all three.

Quick start

from giskard.llm import acompletion, aembedding

# Module-level functions use env vars automatically
response = await acompletion(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

# Bare model names default to OpenAI
response = await acompletion(model="gpt-4o", messages=[...])

LLMClient (programmatic configuration)

from giskard.llm import LLMClient

client = LLMClient()

# Configure with explicit values or env var references
client.configure("openai", api_key="sk-...") # pragma: allowlist secret
client.configure("azure-prod", provider="azure",
    api_key="os.environ/AZURE_PROD_KEY", # pragma: allowlist secret
    base_url="os.environ/AZURE_PROD_ENDPOINT",
    api_version="2024-02-01",
)
client.configure("anthropic-relaxed", provider="anthropic",
    api_key="os.environ/ANTHROPIC_API_KEY", # pragma: allowlist secret
    merge_system=True,
)

response = await client.acompletion("azure-prod/gpt-4o", messages)
response = await client.acompletion("anthropic-relaxed/claude-3-5-haiku-latest", messages)

Provider reference

Prefix SDK Auth env var Completion Embeddings Notable kwargs
openai/ (default) openai OPENAI_API_KEY yes yes base_url, timeout
google/ google-genai GOOGLE_API_KEY / GEMINI_API_KEY yes yes
anthropic/ anthropic ANTHROPIC_API_KEY yes no merge_system, timeout
azure/ openai AZURE_API_KEY, AZURE_API_BASE yes yes api_version, base_url
azure_ai/ openai AZURE_AI_API_KEY, AZURE_AI_ENDPOINT yes model-dependent base_url

For detailed per-provider documentation (role mapping, message constraints, tool format, error mapping), see the provider class docstrings in src/giskard/llm/providers/.

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

giskard_llm-1.0.0b3.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

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

giskard_llm-1.0.0b3-py3-none-any.whl (39.5 kB view details)

Uploaded Python 3

File details

Details for the file giskard_llm-1.0.0b3.tar.gz.

File metadata

  • Download URL: giskard_llm-1.0.0b3.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for giskard_llm-1.0.0b3.tar.gz
Algorithm Hash digest
SHA256 2ce03ea629d1e808bce6e9c37646d4feb1234cf88bc130e41a5653eb616db56d
MD5 c499123d3fa581a4cf9e592f8dc81254
BLAKE2b-256 8a832eb72edefd8b7e20a81c094d2567930291371777d60182210671c040a7af

See more details on using hashes here.

File details

Details for the file giskard_llm-1.0.0b3-py3-none-any.whl.

File metadata

  • Download URL: giskard_llm-1.0.0b3-py3-none-any.whl
  • Upload date:
  • Size: 39.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for giskard_llm-1.0.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 b0aa44cfd31a123400330680665a390f6405e46dfec2bef2cbc9b9a5e1aed5fb
MD5 0b481ad0a6c12da0374545370dd7ebf5
BLAKE2b-256 e84339c1240da26dc4d834255f9b80486587126e8fa414a3d050f454e2219be9

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