OpenInference TypeSafe AI Instrumentation
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 LLM spans. A System One 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 JSONllm.invocation_parameters: the call configuration, meaning themodeland anyextra_bodyfieldsoutput.value: the response body (model,answers,usage) as JSONllm.request.model_name(for examplejev-latest) andllm.response.model_name(the resolved model, for examplejev-1.13.0)llm.token_count.prompt,llm.token_count.completion, andllm.token_count.total
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 (
TypeSafeClientandAsyncTypeSafeClient) - 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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openinference_instrumentation_typesafe-0.1.1.tar.gz.
File metadata
- Download URL: openinference_instrumentation_typesafe-0.1.1.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08657e28748e7ea49a07b214f22cfa976263ea88aceb0cdc21bf2b6762eda22c
|
|
| MD5 |
2a49114eae123ffe52b80b8c25d31bea
|
|
| BLAKE2b-256 |
c459f72513b1d6b4f90fb50a8fe3fc5665e097644b142e7db49acb63fa108d59
|
Provenance
The following attestation bundles were made for openinference_instrumentation_typesafe-0.1.1.tar.gz:
Publisher:
publish.yaml on Arize-ai/openinference
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openinference_instrumentation_typesafe-0.1.1.tar.gz -
Subject digest:
08657e28748e7ea49a07b214f22cfa976263ea88aceb0cdc21bf2b6762eda22c - Sigstore transparency entry: 2887679922
- Sigstore integration time:
-
Permalink:
Arize-ai/openinference@ca0a6bb0fa3d8a7780f28d7269b8f60c2713ea8a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Arize-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@ca0a6bb0fa3d8a7780f28d7269b8f60c2713ea8a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openinference_instrumentation_typesafe-0.1.1-py3-none-any.whl.
File metadata
- Download URL: openinference_instrumentation_typesafe-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
647f80d43874d4809632281d09da7cc66cad03baab0212ed0339ca0540127941
|
|
| MD5 |
70f18a0ba9fc7663b0a0216d76e16b17
|
|
| BLAKE2b-256 |
c4bab672c48acf1e45544cdb0abd611f7f1d5534847bd5e0fc9834a878573351
|
Provenance
The following attestation bundles were made for openinference_instrumentation_typesafe-0.1.1-py3-none-any.whl:
Publisher:
publish.yaml on Arize-ai/openinference
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openinference_instrumentation_typesafe-0.1.1-py3-none-any.whl -
Subject digest:
647f80d43874d4809632281d09da7cc66cad03baab0212ed0339ca0540127941 - Sigstore transparency entry: 2887679925
- Sigstore integration time:
-
Permalink:
Arize-ai/openinference@ca0a6bb0fa3d8a7780f28d7269b8f60c2713ea8a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Arize-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@ca0a6bb0fa3d8a7780f28d7269b8f60c2713ea8a -
Trigger Event:
workflow_dispatch
-
Statement type: