Skip to content

[bot] Add Cohere Python SDK integration for chat, embed, and rerank instrumentation #260

@braintrust-bot

Description

@braintrust-bot

Summary

The Cohere Python SDK (cohere) is a major generative-AI provider SDK with unique execution APIs that are not currently instrumented by Braintrust on main. Unlike providers such as Groq or Together AI that use OpenAI-compatible APIs (and can be traced via the existing OpenAI wrapper), Cohere's native SDK has its own request/response format for chat, embeddings, reranking, and classification.

While Cohere offers an OpenAI-compatible endpoint (/compatibility/v1) for basic chat completions, this compatibility layer does not expose Cohere-specific execution surfaces like embed(), rerank(), classify(), connectors, or citation generation. A dedicated integration is needed for full tracing coverage.

What is missing

No Braintrust integration or wrapper exists for the cohere Python SDK on main. The following execution APIs have no tracing spans:

  • client.chat() / client.chat_stream() — text generation (Command R/R+ models), including tool use and citation generation
  • client.v2.chat() / client.v2.chat_stream() — v2 chat API with OpenAI-style message format
  • client.embed() — text and multimodal embeddings (Embed v3+)
  • client.rerank() — document reranking for RAG pipelines (Rerank v3.5+)
  • client.classify() — few-shot text classification
  • Async variants of all the above (AsyncClient)
  • Streaming variants with token-level events

Braintrust docs status

not_found — Cohere is not mentioned on the Braintrust tracing guide or the integrations directory.

Upstream sources

Local repo files inspected

  • py/src/braintrust/integrations/ — no cohere/ directory exists on main
  • py/src/braintrust/wrappers/ — no Cohere wrapper
  • py/noxfile.py — no test_cohere session
  • py/src/braintrust/integrations/__init__.py — Cohere not listed in integration registry
  • py/src/braintrust/integrations/versioning.py — no Cohere version matrix

Relationship to existing work

  • A prior implementation attempt exists in closed PR feat: Add cohere integration #219 (abhi-cohere-integration). It is not merged into main, so the integration is still missing in the current codebase.
  • If that work is revived, client.classify() may still be better tracked as a follow-up unless it is implemented alongside chat/embed/rerank.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions