getsentry / getsentry/sentry-python

feat(cohere): Instrument `rerank` method

Open
#5,842 1 comment 0 reactions 0 assignees View on GitHub
Improvement Python Spans
Dominant language
Python
Stars
2.2k
Forks
669
Avg merge
1d 1h
Merged PRs (30d)
213

Description

The Cohere SDK's `rerank` method (ranks documents by relevance to a query) is not instrumented. This is a significant AI operation with token costs that should be tracked.

Needs a new span operation — no existing `gen_ai.*` OP constant covers reranking.

**Acceptance criteria:**

* `rerank` calls emit spans with model, token usage, and input/output data
* Follows `gen_ai.*` attribute conventions (not deprecated `ai.*`)
* Sets `gen_ai.system = "cohere"`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.