Skip to content

Jev directory

TypeSafe Python SDK

Official sync and async Python client for the TypeSafe API with typed questions, retry policies, and inferred answers. `pip install typesafe-sdk`.
Stars
298
Language
Python
License
MIT
Reading time
2 min
Published by
TypeSafe AI
Last verified
Sep 2026

About this project

Add the http2 extra (typesafe-sdk[http2]) to enable HTTP/2 support. Set TYPESAFEAPIKEY in your environment, then instantiate and use the client: learn what TypeSafe is, what it can do, and how to use it in TypeSafe docs.

Quoted from the project's README. Read the full README.

Highlights

  • Install with pip install typesafe-sdk or uv add typesafe-sdk; both sync TypeSafeClient and async AsyncTypeSafeClient are provided.
  • Answers split by question kind: response.nouls[...].noul, response.choices[...].choice, and response.scores[...].score.
  • Questions are built as objects: Noul(instructions=...), Choice(instructions=..., criteria={...}), Score(instructions=..., criteria=[...]).
  • RetryPolicy defaults: max_retries 2, backoff_initial 0.5s doubling to backoff_max 5.0s, jitter 0.25, retrying 408, 429, and 500-599.
  • The client works as a context manager (with / async with), and RetryPolicy.timeout defaults to a 30-second total retry budget per call.

Quickstart

python
from typesafe_sdk import Choice, TypeSafeClient

with TypeSafeClient() as client:
    response = client.system_one(
        state={"document": "I was charged twice. Please fix this ASAP."},
        questions={"category": Choice(
            instructions="What is this ticket about?",
            criteria={"billing": None, "technical": None, "other": None},
        )},
    )

print(response.choices["category"].choice)

Watch out

The async client is a separate class (AsyncTypeSafeClient), and RetryPolicy.timeout caps the total retry budget at 30 seconds by default.

Questions about this entry

Short answers drawn from the linked project or page.

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai