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
Python agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
added tokens to callback handler
reibsffeb34bdff11
diff --git a/agentops/langchain_callback_handler.py b/agentops/langchain_callback_handler.pyindex e599856c..220e9841 100644--- a/agentops/langchain_callback_handler.py+++ b/agentops/langchain_callback_handler.py@@ -69,6 +69,9 @@ class LangchainCallbackHandler(BaseCallbackHandler):) -> Any:self.events[run_id].end_timestamp = get_ISO_time()self.events[run_id].returns = response.generations[0][0].message.content+ self.events[run_id].prompt_tokens = response.llm_output['token_usage']['prompt_tokens']+ self.events[run_id].completion_tokens = response.llm_output['token_usage']['completion_tokens']+if len(response.generations) > 0:self.events[run_id].result = "Success"else: