typesafe-ai/system-one-adapter-python
Drop-in TypeSafeClient replacement backed by LLM APIs
System One Adapter – Python client
What it is
A thin wrapper that lets you call the TypeSafe system_one evaluation API using ordinary LLM providers (OpenAI, Anthropic, Gemini) instead of the proprietary TypeSafe service. It mimics the original SDK’s response objects so you can swap the backend and compare cost, speed, and answer quality.
How to install
# pick the providers you need
pip install 'system-one-adapter[openai]' # OpenAI‑compatible APIs
pip install 'system-one-adapter[anthropic]' # Anthropic
pip install 'system-one-adapter[gemini]' # Google Gemini
The core package is provider‑agnostic; the extra brackets pull in the required SDKs for each vendor.
Basic usage
from system_one_adapter import SystemOneAdapterClient, Noul, Score, Choice
client = SystemOneAdapterClient(
structured_outputs=True, # ask the LLM to return structured JSON
llm_answer_mode="probabilities",# get a probability distribution per label
normalize_probabilities=True, # fix any non‑summing distributions
)
response = client.system_one(
state="This book was a delight to read.",
questions={"positive": Noul(instructions="The book review is positive.")},
provider="openai", # or "anthropic" / "gemini"
model="gpt-4o-mini",
)
print(response.model_dump_json())
You can also pass a pre‑constructed provider object (e.g. a custom OpenAI endpoint) via the model argument, or set defaults in the client constructor.
Key concepts
| Concept | Meaning |
|---|---|
| structured_outputs | Use the provider’s native JSON‑schema output mode when available; otherwise the library prompts the model to emit JSON and validates it locally. |
| llm_answer_mode | ` |
Related
- Project
- Project
- Project
- Project