OpenInference Together AI Instrumentation
Python auto-instrumentation library for the Together AI Python client.
Chat completion calls made with the together client (Together and AsyncTogether) are traced and exported as OpenInference LLM spans, capturing the input messages, output messages, invocation parameters, tool calls, streaming output, and token counts.
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 chat completions (
TogetherandAsyncTogether) - Streaming (
stream=True): the span stays open until the stream is consumed, and the accumulated output, tool calls, and token counts are recorded from the streamed chunks - Tool calls, captured on both requests and responses
- 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)
Requires together >= 2.0.0.
Installation
pip install openinference-instrumentation-together
Quickstart
pip install openinference-instrumentation-together together arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp
Start Phoenix as a collector (default http://localhost:6006), then:
from openinference.instrumentation.together import TogetherInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
TogetherInstrumentor().instrument(tracer_provider=tracer_provider)
Run a chat completion. Set the TOGETHER_API_KEY environment variable with your key.
from together import Together
client = Together()
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[{"role": "user", "content": "Why is the sky blue?"}],
)
print(response.choices[0].message.content)
Streaming works the same way — the span is finished when the stream is exhausted:
stream = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[{"role": "user", "content": "Write a haiku about observability."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Runnable examples — including async usage, streaming with a reasoning model, and tool calls — 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_together-0.1.1.tar.gz.
File metadata
- Download URL: openinference_instrumentation_together-0.1.1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fef740eb3b7c4a0d8b5ad5f95e1c07ef8195bdf11cba07256739ca7fd3fabb6
|
|
| MD5 |
282d548b1e79eab8b06e6a3c2c8d1989
|
|
| BLAKE2b-256 |
3d2e3af8767c3ba5de7bcd5dab405401f67bf2a6315c4a2eac3ddc1bd7580af1
|
Provenance
The following attestation bundles were made for openinference_instrumentation_together-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_together-0.1.1.tar.gz -
Subject digest:
1fef740eb3b7c4a0d8b5ad5f95e1c07ef8195bdf11cba07256739ca7fd3fabb6 - Sigstore transparency entry: 2371119558
- Sigstore integration time:
-
Permalink:
Arize-ai/openinference@5b9114cdca81af4250531d4e4d8b8eecf7907192 -
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@5b9114cdca81af4250531d4e4d8b8eecf7907192 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openinference_instrumentation_together-0.1.1-py3-none-any.whl.
File metadata
- Download URL: openinference_instrumentation_together-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d224bfa450af9665294a6edf8b0107dfc72edb3cba295c3234af581699192d80
|
|
| MD5 |
03d3871ad5cbe9224cd49f37caeac6f9
|
|
| BLAKE2b-256 |
901ad00eb4f001897a74598a3abcf210cc00dc7c1e85a4c061404fcf6b2f389c
|
Provenance
The following attestation bundles were made for openinference_instrumentation_together-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_together-0.1.1-py3-none-any.whl -
Subject digest:
d224bfa450af9665294a6edf8b0107dfc72edb3cba295c3234af581699192d80 - Sigstore transparency entry: 2371119582
- Sigstore integration time:
-
Permalink:
Arize-ai/openinference@5b9114cdca81af4250531d4e4d8b8eecf7907192 -
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@5b9114cdca81af4250531d4e4d8b8eecf7907192 -
Trigger Event:
workflow_dispatch
-
Statement type: