Skip to content

feat(together): add Braintrust tracing for the Together AI Go SDK - #232

Open
Atharva Mhaske (atharvamhaske) wants to merge 4 commits into
braintrustdata:mainfrom
atharvamhaske:feat/together-tracing-integration
Open

Atharva Mhaske (atharvamhaske) wants to merge 4 commits into
braintrustdata:mainfrom
atharvamhaske:feat/together-tracing-integration

Conversation

@atharvamhaske

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new trace/contrib/togethercomputer/together integration for the official Together AI Go SDK (github.com/togethercomputer/together-go), covering Chat.Completions.New/NewStreaming, Completions.New, and Embeddings.New
  • Together's client is Stainless-generated with the same option.WithMiddleware() extension point as openai-go/anthropic-sdk-go, so this follows trace/contrib/openai's middleware pattern directly
  • chatcompletions.go — traces Chat Completion spans, both streaming and non-streaming; streaming responses accumulate delta content/tool calls into one merged choice, matching the non-streaming shape
  • completions.go — traces together.completions.create spans
  • embeddings.go — traces together.embeddings.create spans; output is a count + dimension summary, not the raw vectors
  • Orchestrion — auto-instruments together.NewClient by appending option.WithMiddleware(...) to its variadic options
  • Examples — examples/internal/together

Changes

  • trace/contrib/togethercomputer/together/ — new module (tracetogether.go, chatcompletions.go, completions.go, embeddings.go, orchestrion.go, orchestrion.yml, tests)
  • examples/internal/together/ — new example
  • examples/go.mod, go.work, scripts/nested_modules.txt — registered the new module
  • trace/contrib/all/ — registered together in the meta-module and regenerated orchestrion.yml
  • trace/contrib/orchestrion_test.go — added together to the fixture's local replace-directive map and the "individual" import list
  • trace/contrib/testdata/orchestrion/ — added TestTogether
  • internal/genorchestrion/genorchestrion_test.go — bumped expected aspect count 18 → 19 (1 new: together-newclient-middleware)

Notes

  • The originating issue cites together-go v0.10.0; verified against the real upstream repo that current latest is v0.12.0 (no import-path break, just a version bump).
  • Blocker: no VCR cassettes recorded yet. Together AI requires a funded account for real API access, which isn't available in this environment. All test/build/lint steps pass except the 5 tests that need a recorded cassette (TestChatCompletion, TestChatCompletionStreaming, TestCompletion, TestEmbeddings, and the orchestrion fixture's TestTogether) — these currently fail with "requested cassette not found". A partial run against a real (but unfunded) key confirmed the wiring itself is correct: requests reach api.together.ai with the right path/shape and the orchestrion-injected middleware fires, they just get rejected with a genuine 401 invalid_api_key rather than any compile/injection error.
  • Whoever has a funded TOGETHER_API_KEY needs to run VCR_MODE=record go test ./... in trace/contrib/togethercomputer/together and trace/contrib/testdata/orchestrion (-run TestTogether) before this can merge. Opened as a draft for that reason.
  • make lint and go build ./... clean locally; go vet clean.

Closes #142

Signed-off-by: atharvamhaske <atharvamhaske76@gmail.com>
@atharvamhaske
Atharva Mhaske (atharvamhaske) marked this pull request as ready for review September 12, 2026 08:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f50e66c1bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread trace/contrib/togethercomputer/together/tracetogether_test.go
@atharvamhaske

Copy link
Copy Markdown
Contributor Author

Abhijeet Prasad (@AbhiPrasad) now CI on this PR will be red until real cassettes are recorded and pushed, as you wanted. PTAL and LMK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] Add instrumentation for Together AI Go SDK (togethercomputer/together-go)

2 participants