agent: Add additional fields to Agent Tool Finished
telemetry event (#29163)
This PR adds additional fields to the `Agent Tool Finished` telemetry event: - `model` - `model_provider` - `thread_id` - `prompt_id` Release Notes: - N/A
This commit is contained in:
parent
9d35f0389d
commit
942d4eb126
2 changed files with 38 additions and 4 deletions
|
@ -38,7 +38,7 @@ use crate::thread_store::{
|
|||
SerializedMessage, SerializedMessageSegment, SerializedThread, SerializedToolResult,
|
||||
SerializedToolUse, SharedProjectContext,
|
||||
};
|
||||
use crate::tool_use::{PendingToolUse, ToolUse, ToolUseState, USING_TOOL_MARKER};
|
||||
use crate::tool_use::{PendingToolUse, ToolUse, ToolUseMetadata, ToolUseState, USING_TOOL_MARKER};
|
||||
|
||||
#[derive(
|
||||
Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Serialize, Deserialize, JsonSchema,
|
||||
|
@ -1180,6 +1180,12 @@ impl Thread {
|
|||
None
|
||||
};
|
||||
let prompt_id = self.last_prompt_id.clone();
|
||||
let tool_use_metadata = ToolUseMetadata {
|
||||
model: model.clone(),
|
||||
thread_id: self.id.clone(),
|
||||
prompt_id: prompt_id.clone(),
|
||||
};
|
||||
|
||||
let task = cx.spawn(async move |thread, cx| {
|
||||
let stream_completion_future = model.stream_completion_with_usage(request, &cx);
|
||||
let initial_token_usage =
|
||||
|
@ -1288,6 +1294,7 @@ impl Thread {
|
|||
thread.tool_use.request_tool_use(
|
||||
last_assistant_message_id,
|
||||
tool_use,
|
||||
tool_use_metadata.clone(),
|
||||
cx,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue