typesafeai.Client

TypeSafe's JEV classifier (POST {base_url}/systemone). Bool and float outputs use Noul; enums and finite unions use Choice. Classes are flattened into one question per leaf. Unsupported output types, empty instructions, tools, and media are rejected before HTTP. JEV does not stream. Use invoke or an ordinary LLM function call.

Reference version

Signature

class typesafeai.Client

TypeSafe's JEV classifier (POST {base_url}/systemone). Bool and float outputs use Noul; enums and finite unions use Choice. Classes are flattened into one question per leaf. Unsupported output types, empty instructions, tools, and media are rejected before HTTP. JEV does not stream. Use invoke or an ordinary LLM function call.

Source:<builtin>/typesafeai/client.bamlbytes 349–2139

Fields

model

string

api_key

ai.Credential | null

base_url

ai.Credential | null

timeout

baml.time.Duration | ai.LlmTimeoutOptions | null

capture_wire

bool

Static methods

function

new

(
model: string = …,
api_key: ai.Credential | null = …,
base_url: ai.Credential | null = …,
timeout: baml.time.Duration | ai.LlmTimeoutOptions | null = …,
capture_wire: bool = …
) -> typesafeai.Client throws never

Construction is pure. Credentials resolve when invoking, using TYPESAFE_API_KEY unless an explicit credential is provided.

Implementations

ai.Client for typesafeai.Client

Instance methods

function

default_cache_args

(self) -> baml.json.json throws never

The args this client uses for a ${cache()} written with none (or with null): the object its wire's cache marker carries. Null when the client has no cache marker on its wire, or when the model it is configured for would reject one; a ${cache()} then sends nothing.

A client that sends cache markers passes this to ai.wire.prompt_parts(message, default_cache_args).

function

id

(self) -> string throws never
function

invoke

(
self,
input: ai.ModelTurnInput
) -> ai.ModelTurn throws baml.errors.Timeout | baml.errors.UnknownError | reflect.errors.CompilationError | ai.errors.Failure
function

render

(
self,
input: ai.ModelTurnInput
) -> baml.http.Request throws baml.errors.Timeout | baml.errors.UnknownError | reflect.errors.CompilationError | ai.errors.Failure

Preview the request without resolving credentials or performing IO.

Source:<builtin>/typesafeai/client.bamlbytes 1472–2137