Cohere

chat, generate, embed, and rerank auto-capture. The re-ranker fires as a retrieval span.

Install the instrumentor and Cohere calls inside wrap your agent become spans. The provider field is cohere.

What's captured

CallSpan kindAuto-extracted
client.chatllmmodel, tokens (meta.tokens), message, response
client.generatellmmodel, tokens, prompt, completion
client.embedllmmodel, input tokens
client.rerankretrievalquery, doc count, top-N doc ids with scores

Install

npm install cohere-ai @opentelemetry/instrumentation-cohere
pip install cohere opentelemetry-instrumentation-cohere

Minimal example

import trodo from 'trodo-node';
import { CohereClient } from 'cohere-ai';

trodo.init({ siteId: process.env.TRODO_SITE_ID });
const cohere = new CohereClient();

await trodo.wrapAgent('cohere-bot', async (run) => {
  const r = await cohere.chat({ model: 'command-r', message: 'Explain vector databases' });
  run.setOutput(r.text);
});
import os, trodo, cohere

trodo.init(site_id=os.environ['TRODO_SITE_ID'])
client = cohere.Client()

with trodo.wrap_agent('cohere-bot') as run:
    r = client.chat(model='command-r', message='Explain vector databases')
    run.set_output(r.text)

On this page