Skip to main content

OpenInference TypeSafe AI Instrumentation

pypi

Python auto-instrumentation library for the TypeSafe AI Python SDK (typesafe-sdk).

Calls to TypeSafeClient.system_one and AsyncTypeSafeClient.system_one are traced and exported as OpenInference DECISION spans. A decision model scores or selects among the candidate options supplied in the request instead of generating free-form text, which is exactly what System One does: a request sends a state plus a map of typed questions (Noul, Choice, Score) and returns one typed answer per question, so the span records:

  • 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

The model and its token usage are recorded under decision.* rather than llm.*, following the OpenInference decision span conventions, so decision model usage is not priced or counted as LLM usage.

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.

The state and the questions are recorded only in input.value, so TraceConfig(hide_inputs=True) keeps the whole request — caller data and question instructions alike — 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.

These traces are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.

Supported Features

  • Synchronous and asynchronous clients (TypeSafeClient and AsyncTypeSafeClient)
  • All three question primitives, passed as SDK objects or raw dictionaries
  • Suppressing tracing via suppress_tracing()
  • Context attribute propagation (using_session, using_user, using_attributes, metadata, tags)
  • Sensitive-data masking via TraceConfig (e.g. hide_inputs, hide_outputs)

Requires typesafe-sdk >= 0.6.0.

Installation

pip install openinference-instrumentation-typesafe

Quickstart

pip install openinference-instrumentation-typesafe typesafe-sdk arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp

Start Phoenix as a collector (default http://localhost:6006), then:

from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

from openinference.instrumentation.typesafe import TypeSafeAIInstrumentor

endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))

TypeSafeAIInstrumentor().instrument(tracer_provider=tracer_provider)

Make a System One call. Set the TYPESAFE_API_KEY environment variable with your key.

from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

client = TypeSafeClient()
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)

Runnable examples, including async usage and context attributes, are in the examples/ directory.

More Info

Metadata

Release files for openinference-instrumentation-typesafe 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openinference-instrumentation-typesafe 0.1.4
File Size Uploaded Provenance Actions
openinference_instrumentation_typesafe-0.1.4.tar.gz 11.5 kB With provenance Details for openinference_instrumentation_typesafe-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openinference-instrumentation-typesafe 0.1.4
File Interpreter ABI Platform Actions
openinference_instrumentation_typesafe-0.1.4-py3-none-any.whl Python 3 none any Details for openinference_instrumentation_typesafe-0.1.4-py3-none-any.whl

Total release size: 25.6 kB

Release files / openinference_instrumentation_typesafe-0.1.4.tar.gz

Download URL openinference_instrumentation_typesafe-0.1.4.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9c2b86bb2273b9688433e1bc94e99b1bb63f6be67e96c1eb6dc7ba49aad6cb1f
BLAKE2b-256 checksum
How to use checksums
c1ba18b56d5d4fdb6cf6dfc05719157a1141b45ccd333d5f9658c41e3641a5b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / openinference_instrumentation_typesafe-0.1.4-py3-none-any.whl

Download URL openinference_instrumentation_typesafe-0.1.4-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3f5d1955a6d6801523061dc3b3765789114a7e00629a55ca783a42d9da069b7
BLAKE2b-256 checksum
How to use checksums
6b0ce2c9f75b123161099df76797bc73acf12e6a363c5972ebe7c80dd3c2a9e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Security for openinference-instrumentation-typesafe 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openinference_instrumentation_typesafe-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page