Repository navigation
v0.2.0
Pre-release
Pre-release
v0.2.0 — Adapter Core Cleanup, Unified Errors, and Better DX
Highlights
- Unified chat API for OpenAI / Anthropic / Google (consistent params & message schema).
- Standardized error classes across providers → easier debugging.
- Cleaner request handling (temperature, max_tokens, etc.) with a single interface.
Added
- Basic error taxonomy (consistent codes/types for all supported providers).
- Minimal request/response logging for easier debugging.
- Helper utilities for normalizing generation parameters (temperature, max_tokens, top_p, etc.).
- README usage examples (minimal “chat” scenario).
Changed
- Unified message format (Prompt / User / AI → normalized internal format).
- Consistent parameter names in adapter.generate_chat_answer(...) across providers.
- Reduced dependencies — removed provider SDK wrappers in favor of direct HTTP calls.
Fixed
- Correct passing of the system prompt for all supported LLMs.
- Stable handling of network timeouts and invalid API keys (mapped to unified errors).
Breaking changes
- Updated internal message format — if you were creating messages directly from the old classes, check compatibility.
- Unified parameter names — make sure you now use temperature, max_tokens, etc. consistently.
Migration
Minimal example:
from llm_api_adapter.models.messages.chat_message import (
AIMessage, Prompt, UserMessage
)
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter
messages = [
Prompt(
"You are a friendly assistant who explains complex concepts "
"in simple terms."
),
UserMessage("Hi! Can you explain how artificial intelligence works?"),
AIMessage(
"Sure! Artificial intelligence (AI) is a system that can perform "
"tasks requiring human-like intelligence, such as recognizing images "
"or understanding language. It learns by analyzing large amounts of "
"data, finding patterns, and making predictions."
),
UserMessage("How does AI learn?"),
]
adapter = UniversalLLMAPIAdapter(
organization="openai",
model="gpt-3.5-turbo",
api_key=openai_api_key
)
response = adapter.generate_chat_answer(
messages=messages,
max_tokens=256,
temperature=1.0,
top_p=1.0
)
print(response.content)Roadmap (next)
Async & streaming API (async_chat, streaming deltas).
Thanks
Thanks to everyone who provided feedback and tested early versions