Skip to content

[bot] Add Together AI Python SDK integration for chat completions, embeddings, and image generation instrumentation #330

@braintrust-bot

Description

@braintrust-bot

Summary

The Together AI Python SDK (together) is the official Python client for Together's inference platform. Its Together and AsyncTogether clients provide execution APIs for chat completions, text completions, embeddings, image generation, and reranking. This repository has zero instrumentation for any Together SDK surface — no integration, no wrapper, no patcher, no auto-instrumentation config. Users who call the Together SDK directly get no Braintrust spans.

While Together exposes an OpenAI-compatible endpoint that can be used via openai.OpenAI(base_url="https://api.together.xyz/v1") + wrap_openai(), the native together.Together() client cannot be wrapped with wrap_openai() because it is a distinct client class. Users who follow Together's official documentation and pip install together get zero Braintrust tracing. This is the same pattern as Mistral and OpenRouter — both have OpenAI-compatible APIs but received dedicated native integrations in this repo.

Together AI hosts 200+ open-source models and is one of the most popular inference platforms in the Python AI ecosystem. The SDK v2.x (Stainless-generated) has been actively maintained with multiple releases in 2026.

What needs to be instrumented

The together package (latest: v2.7.0, released April 3, 2026) exposes these execution surfaces, none of which are instrumented:

Chat completions (highest priority)

SDK Method Description Streaming Return type
client.chat.completions.create() Chat completions with tool calling, JSON mode, structured output stream=True returns stream iterator ChatCompletion

Response shape is OpenAI-compatible: Standard choices, usage, model, id fields — span metrics extraction follows the OpenAI pattern.

Text completions

SDK Method Description Streaming Return type
client.completions.create() Text completions (prompt-in, text-out) stream=True returns stream iterator Completion

Embeddings

SDK Method Description Return type
client.embeddings.create() Text embeddings generation EmbeddingResponse

Image generation

SDK Method Description Return type
client.images.generate() Text-to-image generation (FLUX, Stable Diffusion models) ImageResponse

Reranking

SDK Method Description Return type
client.rerank.create() Document reranking for RAG pipelines RerankResponse

Both sync and async

All methods have async variants on AsyncTogether with identical signatures.

Implementation notes

Stainless-generated SDK: The together v2.x package is generated by Stainless (same toolchain as OpenAI and Groq SDKs). The client structure mirrors the OpenAI SDK, so the patcher/wrapper pattern from the OpenAI integration can serve as a structural reference.

Broader execution surface than OpenAI compatibility: While chat completions are OpenAI-compatible, Together's native SDK also exposes image generation (client.images.generate()) and reranking (client.rerank.create()) which are not part of OpenAI's API. Users accessing these surfaces through the together package have no path to Braintrust tracing.

chat.completions.create() parameters relevant for span metadata: model, temperature, max_tokens, top_p, frequency_penalty, presence_penalty, repetition_penalty, seed, tools, tool_choice, response_format, stop, n, logprobs.

No coverage in any instrumentation layer

  • No integration directory (py/src/braintrust/integrations/together/)
  • No wrapper function (e.g. wrap_together())
  • No patcher in any existing integration
  • No nox test session (test_together)
  • No version entry in py/src/braintrust/integrations/versioning.py
  • No mention in py/src/braintrust/integrations/__init__.py

A grep for together across py/src/braintrust/integrations/ returns zero matches in integration code (only incidental uses of the English word "together" in unrelated contexts).

Braintrust docs status

not_found — Together AI is not listed on the Braintrust integrations directory or the tracing guide.

Upstream references

Local repo files inspected

  • py/src/braintrust/integrations/ — no together/ directory exists on main
  • py/src/braintrust/wrappers/ — no Together wrapper
  • py/noxfile.py — no test_together session
  • py/src/braintrust/integrations/__init__.py — Together not listed in integration registry
  • py/src/braintrust/integrations/versioning.py — no Together version matrix
  • py/pyproject.toml — no Together entries in [tool.braintrust.matrix]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions