Skip to content

Add instrumentation for Cohere (cohere-ai) #24490

Description

@mydea

Add native gen-AI instrumentation for the Cohere Node SDK, cohere-ai (repo).

Coverage status

  • @ai-sdk/cohere (Vercel AI SDK provider, ~3.2M/mo) is already covered by proxy through our vercel-ai integration.
  • The native cohere-ai SDK is not covered. This issue tracks that path.

Relevance (npm)

  • cohere-ai: ~1.9M downloads/month (~20.3M last year) — roughly flat-to-modest growth. Cohere is a notable enterprise/RAG-focused provider (chat, embeddings, and rerank), and rerank in particular has no equivalent in the providers we instrument today.

Rough scope

  • Add instrumentation logic under packages/server-utils/src/ai/cohere/ and wire it up via src/integrations/cohere.ts, registered in getTracingIntegrations(); runtime packages re-export from @sentry/server-utils.
  • Instrument CohereClientV2 (and legacy CohereClient): chat() / chatStream(), embed(), and rerank(), including streaming.
  • Emit gen_ai.* spans per the span attribute conventions (gen_ai.provider.name = cohere, request/response model, token usage, finish reasons).
  • Cohere is not OpenAI wire-compatible, so it needs bespoke instrumentation (like mistral/anthropic), not the openai-compatible shim.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions