Skip to main content

Async LLM router across AWS Bedrock, Google Gemini, and Groq providers

Project description

llm-verse-avneesh

Async LLM router across AWS Bedrock (Claude, Amazon Nova) and Google Gemini.

A single Router.get_response(...) call validates its input, dispatches to the requested model by name, and always returns a plain dict shaped like LLMResponse — regardless of which underlying provider handled the call.

Install

pip install "llm-verse-avneesh[aws]"      # Bedrock (Claude, Nova) only
pip install "llm-verse-avneesh[google]"   # Gemini only
pip install "llm-verse-avneesh[all]"      # both

Usage

import asyncio
from llm_verse_avneesh import Router

async def main():
    router = Router()
    result = await router.get_response(
        llm_name="nova-lite",
        system_prompt="You are a helpful assistant.",
        user_prompt="Say hello in one sentence.",
        context=None,
        temperature=0.5,
        pydantic_model=None,
        max_tokens=200,
        repo_name="my-repo",
        llm_identifier="greeting-1",
        region_name="us-east-1",
        aws_access_key_id="...",
        aws_secret_access_key="...",
    )
    print(result["response"])

asyncio.run(main())

For Gemini, pass google_api_key instead of the AWS credential fields.

Discovering models

Three callables let you explore what's registered without reading source:

import llm_verse_avneesh as lv

lv.help()             # documents list_models(), model_info(), and Router.get_response()
lv.list_models()       # [{"llm_name": "nova-lite", "display_name": "Amazon Nova Lite", "provider": "bedrock"}, ...]
lv.model_info("nova-lite")   # required vs. optional arguments for that specific model

model_info(llm_name) returns exactly what that model needs and accepts — e.g. Gemini models list google_api_key under required and never AWS credentials; only models that actually implement an agentic tool-calling loop (all chat models except nova-2-lite-grounding) list tools/max_iterations under optional. It raises ProviderNotFoundError for an unknown llm_name.

Registered model names

Registry keys match the name each provider documents publicly for the model — not an internal AWS/Anthropic model ID. (See list_models() / model_info() above for this same information at runtime.)

llm_name Provider Notes
claude-haiku-4-5 Bedrock plain text / structured output; pass tools=[...] for an agentic tool-calling loop
nova-lite Bedrock plain text / structured output; pass tools=[...] for an agentic tool-calling loop
nova-2-lite Bedrock plain text / structured output; pass tools=[...] for an agentic tool-calling loop
nova-2-lite-grounding Bedrock web grounding; US regions only
nova-pro Bedrock plain text / structured output; pass tools=[...] for an agentic tool-calling loop
gemini-3.1-flash-lite Google plain text / structured output; pass tools=[...] for an agentic tool-calling loop

Validation

  • LLMRequest (in models.py) does basic sanity checks: non-empty strings, non-negative temperature, positive max_tokens, and that credentials for the selected provider are present.
  • Router.get_response then enforces the actual per-model limits from limits.py — e.g. Gemini allows temperature up to 2.0 while the Bedrock models here cap at 1.0. Exceeding a model's limit raises RouterValidationError naming the offending model and its limit. Update limits.py if a provider changes its published limits.

Credentials

aws_secret_access_key and google_api_key are stored as pydantic.SecretStr so they don't leak into repr(), str(), logs, or model_dump() output by accident. Call .get_secret_value() only at the point where a client needs the raw value.

Exceptions

All exceptions inherit from LLMRouterError:

  • RouterValidationError — bad input or a model-specific limit was exceeded.
  • ProviderNotFoundErrorllm_name isn't registered.
  • LLMCallError — the underlying provider call failed or raised.

Development

pip install -e ".[dev]"
pytest

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

llm_verse_avneesh-0.1.6.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

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

llm_verse_avneesh-0.1.6-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_verse_avneesh-0.1.6.tar.gz.

File metadata

  • Download URL: llm_verse_avneesh-0.1.6.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llm_verse_avneesh-0.1.6.tar.gz
Algorithm Hash digest
SHA256 682dae01265c08a8b2442da24ffd131f2b61c5759160bf623ec941bcc62bb74b
MD5 8b7bb0077a6cfd96baa164723479b0b0
BLAKE2b-256 b58575bf6749ea418b9f695801f1544bce0e3964d2a6e5e4b49efc2d9ce94486

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_verse_avneesh-0.1.6.tar.gz:

Publisher: publish.yml on avneeshrai07/llm-verse-avneesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_verse_avneesh-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_verse_avneesh-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e261bb1ec1ef64274fac8fda5fd92689ef49fe65b333d9a923550ae8ce3317bf
MD5 7f3415b63b08836a99b841c24dfd9eb3
BLAKE2b-256 9bf08a9341bda6605fb337e5c714d5bb815dc3957abd3475c1826a0355cc7c0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_verse_avneesh-0.1.6-py3-none-any.whl:

Publisher: publish.yml on avneeshrai07/llm-verse-avneesh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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