Skip to main content

A unified toolkit for working with multiple LLM providers

Project description

llm-kit-pro

llm-kit-pro is a unified, async-first Python toolkit for interacting with multiple Large Language Model (LLM) providers through a consistent, provider-agnostic API.

It is designed for developers who need to switch between providers (OpenAI, Gemini, Anthropic/Bedrock) without rewriting their core application logic, with a heavy emphasis on structured data and multimodal inputs.


✨ Features

  • Unified API: One interface for OpenAI, Gemini, Anthropic, and AWS Bedrock.
  • Pydantic-First Structured Output: Pass Pydantic models directly to get validated, type-safe dictionaries back.
  • Native "Strict Mode": Automatically handles OpenAI's Structured Outputs requirements.
  • Multimodal Inputs: First-class support for PDF, PNG, JPEG, and Text files across all supported providers.
  • Async-First: Built from the ground up for high-performance asynchronous Python applications.
  • Provider-Agnostic Inputs: Use LLMFile to handle different file types without worrying about provider-specific formatting.

📦 Installation

pip install llm-kit-pro

Install with specific provider support:

# For OpenAI
pip install "llm-kit-pro[openai]"

# For Google Gemini
pip install "llm-kit-pro[gemini]"

# For Anthropic
pip install "llm-kit-pro[anthropic]"

# For AWS Bedrock (Anthropic/Llama/etc)
pip install "llm-kit-pro[bedrock]"

🚀 Quick Start

1. Simple Text Generation

from llm_kit_pro.providers.openai import OpenAIClient, OpenAIConfig

client = OpenAIClient(OpenAIConfig(api_key="your-key"))

text = await client.generate_text(
    prompt="Explain quantum entanglement like I'm five."
)
print(text)

2. Structured Data with Pydantic

Instead of messy regex or manual JSON parsing, define your schema as a Pydantic model. llm-kit-pro handles the schema injection, strict mode enforcement, and final validation.

from pydantic import BaseModel
from llm_kit_pro.providers.gemini import GeminiClient, GeminiConfig

class MovieReview(BaseModel):
    title: str
    rating: int
    summary: str
    sentiment: str

client = GeminiClient(GeminiConfig(api_key="your-key"))

# Pass the class directly!
data = await client.generate_json(
    prompt="Review the movie 'Inception'",
    schema=MovieReview
)

print(data["rating"])

3. Multimodal: Extracting from a PDF

llm-kit-pro treats files as first-class citizens. You can pass images or PDFs directly to the model.

from llm_kit_pro.core.inputs import LLMFile
from pydantic import BaseModel

class Invoice(BaseModel):
    vendor: str
    amount: float
    due_date: str

# Load your file
with open("invoice.pdf", "rb") as f:
    pdf = LLMFile(
        content=f.read(),
        mime_type="application/pdf",
        filename="invoice.pdf"
    )

# Extract structured data from the document
data = await client.generate_json(
    prompt="Extract the invoice details",
    schema=Invoice,
    files=[pdf]
)

🧠 Core Abstractions

BaseLLMClient

Every provider implements this interface, ensuring your code remains portable.

  • generate_text(prompt, files=None, **kwargs) -> str
  • generate_json(prompt, schema, files=None, **kwargs) -> dict

LLMFile

A simple container for file-based inputs.

  • content: Raw bytes.
  • mime_type: e.g., application/pdf, image/jpeg.
  • filename: Optional metadata.

🔌 Supported Providers

Provider Installation Extra Status Structured Output Multimodal
OpenAI [openai] ✅ Stable Native Strict Mode Images
Google Gemini [gemini] ✅ Stable Native JSON Schema Images, PDF
Anthropic [anthropic] ✅ Stable Native Tool Use Images, PDF
AWS Bedrock [bedrock] ✅ Stable Schema Injection Images, PDF (Claude)

📍 Status

🚧 Under active development

The public API is stabilizing. We are currently focusing on adding more Bedrock adapters (Llama 3, Titan).


📄 License

MIT License

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_kit_pro-0.4.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

llm_kit_pro-0.4.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_kit_pro-0.4.1.tar.gz.

File metadata

  • Download URL: llm_kit_pro-0.4.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for llm_kit_pro-0.4.1.tar.gz
Algorithm Hash digest
SHA256 5def87ceb6693eba495577eb41f1def0a9db0f2e0d5e0ca75c1f734456b5f795
MD5 9f9d81fda162fe7fdd6baa2ad98627a9
BLAKE2b-256 7b5a51b1cae793f897aecfb43f2f976447565e70ef0b2eeebf1ed60c1c4054ff

See more details on using hashes here.

File details

Details for the file llm_kit_pro-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: llm_kit_pro-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for llm_kit_pro-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eed5fc8ef6e8aa5b48c1dd79acd4dd863b95563d72a8899ad9dc06a1b9bb9efd
MD5 ee7ec6980ed773f37b25765ec417941e
BLAKE2b-256 5c5b9acbc9cb6045e82ae7a22fd5d91c22802279ed5f81a1f633570d3722baa0

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