Skip to main content
Looking for TypeScript? See the TypeScript guide.
PyPI Version This module provides OpenInference instrumentation for the TypeSafe AI Python SDK (typesafe-sdk). Calls to TypeSafeClient.system_one and AsyncTypeSafeClient.system_one are captured as OpenInference DECISION spans. A System One request sends a state plus a map of typed questions (Noul, Choice, Score) and returns one typed answer per question. That makes System One a decision model rather than a language model. The span records the request state/model/questions as input.value and the response answers/usage as output.value, and identifies the model and its token usage under decision.* rather than llm.*. Requires typesafe-sdk >= 0.6.0 and openinference-instrumentation-typesafe >= 0.1.4.

Install

Setup

Use the register function to connect your application to Phoenix:

Run TypeSafe AI

A simple TypeSafe AI application that is now instrumented:
The AsyncTypeSafeClient is instrumented the same way, and questions can be passed as SDK objects (as above) or as raw dictionaries.

Observe

With instrumentation enabled, each system_one call shows up in Phoenix as a DECISION span containing:
  • input.value: the request body (state, model, questions) as JSON
  • llm.invocation_parameters: the call configuration, meaning the model and any extra_body fields
  • output.value: the response body (model, answers, usage) as JSON
  • decision.system and decision.provider: both typesafe
  • decision.request.model_name (for example jev-latest), decision.response.model_name (the resolved model, for example jev-1.13.0), and decision.model_name (the response model when reported, else the requested one)
  • decision.token_count.input and decision.token_count.output, from the response’s usage
Phoenix names the decision model in the span’s input card. The model and its usage follow the OpenInference decision span conventions and live under decision.* rather than llm.*, so decision-model calls stay out of Phoenix’s LLM token and cost reporting. Earlier releases recorded them under llm.*, and releases before 0.1.3 recorded them as LLM spans.
TypeSafe AI traces in Phoenix
A System One call is not a chat exchange, so the state and the answers are recorded only as input.value and output.value, not as llm.input_messages / llm.output_messages.

Configuration

Because the state and the questions are recorded only in input.value, TraceConfig(hide_inputs=True) keeps the whole request off the span, and hide_outputs=True does the same for the answers. llm.invocation_parameters holds no request content, only the model and any extra_body fields; mask it with hide_llm_invocation_parameters if those are sensitive.
Tracing can also be suppressed for a block of code with suppress_tracing(), and context attributes such as using_session, using_user, and using_attributes propagate session, user, metadata, and tag information onto the spans it produces.

Resources