Skip to content

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

cohere version 5.9 support

Braelyn Boynton6324bf13f469
diff --git a/agentops/llms/cohere.py b/agentops/llms/cohere.py
index d76c221d..ad8f93a5 100644
--- a/agentops/llms/cohere.py
+++ b/agentops/llms/cohere.py
@@ -195,8 +195,8 @@ class CohereProvider(InstrumentedProvider):
"role": role_map.get(last_message.role, last_message.role),
"content": last_message.message,
}
- llm_event.prompt_tokens = response.meta.tokens.input_tokens
- llm_event.completion_tokens = response.meta.tokens.output_tokens
+ llm_event.prompt_tokens = int(response.meta.tokens.input_tokens)
+ llm_event.completion_tokens = int(response.meta.tokens.output_tokens)
llm_event.model = kwargs.get("model", "command-r-plus")
self._safe_record(session, llm_event)