Skip to main content

Together AI provides fast inference for a wide range of open-source models. The Together and AsyncTogether chat completions clients can be instrumented using the openinference-instrumentation-together package, which traces calls as OpenInference LLM spans.

Note

This integration requires together >= 2.0.0.

Install#

Setup#

Set the TOGETHER_API_KEY environment variable to authenticate calls made using the SDK.

Connect your application to Phoenix with the register function:

auto_instrument=True picks up the installed openinference-instrumentation-together package automatically. To instrument explicitly instead, call TogetherInstrumentor().instrument(tracer_provider=tracer_provider).

Run Together AI#

A simple chat completion that is now instrumented:

Streaming#

When stream=True, the span stays open until the stream is fully consumed, then records the accumulated output, tool calls, and token counts from the chunks.

Tool calls#

Tools passed on the request (llm.tools.*) and any tool calls returned on the response (message.tool_calls.*) are captured on the span.

Observe#

Now that you have tracing setup, all invocations of Together AI chat completions (sync and async, streaming and non-streaming) will be streamed to your running Phoenix for observability and evaluation.

Resources#