Skip to main content
Looking for Python? See the Python guide.
NPM Version This module provides OpenInference instrumentation for the TypeSafe AI Node.js SDK (@typesafe-ai/sdk). Each TypeSafeClient.systemOne call is captured as an OpenInference LLM span with JSON input.value / output.value, model, and token usage. Requires Node.js 20+. client.models.list() is not instrumented.

Install

Setup

Use the register function from @arizeai/phoenix-otel to connect to Phoenix, then register the TypeSafe instrumentation. Create the instrumentation.ts file:
Registering the instrumentation this way patches @typesafe-ai/sdk at load time, which requires instrumentation.ts to run before the SDK is imported (CommonJS only). For ESM, bundlers, or when the SDK is imported first, call manuallyInstrument instead:

Usage

Spans are exported in batches. In short-lived scripts, call await provider.forceFlush() before the process exits so all spans are delivered to Phoenix.

Observe

With instrumentation enabled, each systemOne call shows up in Phoenix as an LLM span containing:
  • The full state and questions sent to TypeSafe as input.value (JSON)
  • The typed answers returned as output.value (JSON)
  • Model name and token usage, when reported by the SDK
TypeSafe AI traces in Phoenix

Configuration

Pass traceConfig to mask sensitive request/response payloads before they leave your process:
See the package README for the full list of traceConfig masking options and the SDK compatibility table.

Resources