TypeSafe Python SDK
Install (Python ≥ 3.10):
pip install typesafe-sdk
# or
uv add typesafe-sdk
Synchronous client:
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
with TypeSafeClient() as client:
response = client.system_one(
state={"document": "I was charged twice. Please fix this ASAP."},
questions={
"billing": Noul(instructions="Is this ticket about billing?"),
"tone": Choice(
instructions="What is the customer's tone?",
criteria={"calm": None, "frustrated": None, "angry": None},
),
"urgency": Score(
instructions="How urgent is this ticket?",
criteria=["can wait", "this week", "today"],
),
},
)
print(response.nouls["billing"].noul)
print(response.choices["tone"].choice)
print(response.scores["urgency"].score)
Use AsyncTypeSafeClient the same way with async with.
Retries are on by default. See the SDK retries reference if you need to change attempt count or status codes.
Browse source from the official Python SDK page (TypeSafe links GitHub there). This site does not vendor a fork.
Sources
Public TypeSafe or adjacent documentation only. No private claims.