You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: add rerank operation for cross-encoder / rerank-API models #253
RAG pipelines run a re-rank step after retrieval — cross-encoder or rerank-API — to score and re-order candidate documents before inference. There's no gen_ai.operation.name value for it today, so latency, cost, and per-document scores can't be attributed independently of retrieval and inference.
#217 just established gen_ai.retrieval.* as a separate namespace. rerank is the natural next operation in that direction. Distinct from gen_ai.evaluation.result (rerank produces scores, doesn't judge other models) and from embeddings (cross-encoder, no vector exposed). No existing issue mentions rerank (verified via repo search).
Proposal
Add rerank to gen_ai.operation.name + a single gen_ai.rerank.client span, with three attributes: gen_ai.rerank.candidate.count, gen_ai.rerank.top_n, gen_ai.rerank.scores (opt_in). Primary reference scenario: Cohere SDK 6.1.0 — every attribute sourced from a typed kwarg or response field. Voyage and Jina follow the same shape (Voyage uses top_k).
Open questions
huggingface provider enum — bundle with the rerank PR or prerequisite issue? Needed for LlamaIndex SentenceTransformerRerank.
This split makes sense to me. Rerank has a different latency/cost/cardinality profile from both retrieval and inference, so treating it as a separate operation seems consistent with the retrieval split in #217.
For the open questions, my leaning would be:
start with the client span first, and defer internal until there are concrete in-process cross-encoder scenarios
avoid adding usage units until there are a couple of providers with compatible semantics
avoid putting per-document scores on the span by default; if they are captured, span events or a clearly opt-in shape with a cardinality/payload warning seems safer
keep provider enum changes separate unless the first reference scenario actually requires one
That would keep the initial PR small while leaving room for richer rerank telemetry later.
@lmolkova Reviving this since open-telemetry/opentelemetry-python-genai#566 lists it under "Blocked on Semantic Conventions". Withdrawing the gen_ai.rerank.* attributes and the separate span type: per #249's grouping rule this is a rerank value on gen_ai.operation.name reusing gen_ai.retrieval.client, same as your call on #353. Derivable from cohere==7.1.1 ClientV2.rerank and llama-index's ReRankStartEvent. Happy to open the PR.
Activity
AgentGymLeader commentedon Jun 5, 2026
This split makes sense to me. Rerank has a different latency/cost/cardinality profile from both retrieval and inference, so treating it as a separate operation seems consistent with the retrieval split in #217.
For the open questions, my leaning would be:
That would keep the initial PR small while leaving room for richer rerank telemetry later.
Krishnachaitanyakc commentedon Sep 5, 2026
@lmolkova Reviving this since open-telemetry/opentelemetry-python-genai#566 lists it under "Blocked on Semantic Conventions". Withdrawing the gen_ai.rerank.* attributes and the separate span type: per #249's grouping rule this is a rerank value on gen_ai.operation.name reusing gen_ai.retrieval.client, same as your call on #353. Derivable from cohere==7.1.1 ClientV2.rerank and llama-index's ReRankStartEvent. Happy to open the PR.