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, 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
LLMFileto 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 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)->strgenerate_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 |
| AWS Bedrock | [bedrock] |
✅ Stable | Schema Injection | Images, PDF (Claude) |
| Anthropic | [anthropic] |
🏗️ Planned | - | - |
📍 Status
🚧 Under active development
The public API is stabilizing. We are currently focusing on adding more Bedrock adapters (Llama 3, Titan) and a native Anthropic provider.
📄 License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_kit_pro-0.3.0.tar.gz.
File metadata
- Download URL: llm_kit_pro-0.3.0.tar.gz
- Upload date:
- Size: 10.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57196474276426029ee20deb85ee8e7d3917fc83ee6f18998b0150ba58762226
|
|
| MD5 |
e5930aa79716692913bc78b98d4c91b9
|
|
| BLAKE2b-256 |
100975b2a32630fe9beeb3e629d93e1992a9357a0ebf723d8d4f374fd2ecdbb3
|
File details
Details for the file llm_kit_pro-0.3.0-py3-none-any.whl.
File metadata
- Download URL: llm_kit_pro-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2a160a02aaaac166627058bccd83882a807804ac0c72a3959ca63726655383c
|
|
| MD5 |
ca0f81abcbb522a81c44f87b97a0ed20
|
|
| BLAKE2b-256 |
deb82229c0acb82d1b5b75fde780916eaae5cdc46f96a4535ec3330600b6c095
|