feat(log): prompt tokens (#2047)
This commit is contained in:
parent
b646d3b8fe
commit
60d7ec20a5
1 changed files with 15 additions and 10 deletions
|
|
@ -2110,8 +2110,7 @@ turnLoop:
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.DebugCF("agent", "LLM response",
|
llmResponseFields := map[string]any{
|
||||||
map[string]any{
|
|
||||||
"agent_id": ts.agent.ID,
|
"agent_id": ts.agent.ID,
|
||||||
"iteration": iteration,
|
"iteration": iteration,
|
||||||
"content_chars": len(response.Content),
|
"content_chars": len(response.Content),
|
||||||
|
|
@ -2119,7 +2118,13 @@ turnLoop:
|
||||||
"reasoning": response.Reasoning,
|
"reasoning": response.Reasoning,
|
||||||
"target_channel": al.targetReasoningChannelID(ts.channel),
|
"target_channel": al.targetReasoningChannelID(ts.channel),
|
||||||
"channel": ts.channel,
|
"channel": ts.channel,
|
||||||
})
|
}
|
||||||
|
if response.Usage != nil {
|
||||||
|
llmResponseFields["prompt_tokens"] = response.Usage.PromptTokens
|
||||||
|
llmResponseFields["completion_tokens"] = response.Usage.CompletionTokens
|
||||||
|
llmResponseFields["total_tokens"] = response.Usage.TotalTokens
|
||||||
|
}
|
||||||
|
logger.DebugCF("agent", "LLM response", llmResponseFields)
|
||||||
|
|
||||||
if len(response.ToolCalls) == 0 || gracefulTerminal {
|
if len(response.ToolCalls) == 0 || gracefulTerminal {
|
||||||
responseContent := response.Content
|
responseContent := response.Content
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue