vv_agent/runtime/hooks/
patches.rs1use serde_json::Value;
2
3use crate::types::{Message, ToolCall, ToolExecutionResult};
4
5#[derive(Debug, Clone, Default, PartialEq)]
6pub struct BeforeLlmPatch {
7 pub messages: Option<Vec<Message>>,
8 pub tool_schemas: Option<Vec<Value>>,
9}
10
11#[derive(Debug, Clone, Default, PartialEq)]
12pub struct BeforeToolCallPatch {
13 pub call: Option<ToolCall>,
14 pub result: Option<ToolExecutionResult>,
15}
16
17impl BeforeToolCallPatch {
18 pub fn call(call: ToolCall) -> Self {
19 Self {
20 call: Some(call),
21 result: None,
22 }
23 }
24
25 pub fn result(result: ToolExecutionResult) -> Self {
26 Self {
27 call: None,
28 result: Some(result),
29 }
30 }
31}
32
33impl From<ToolCall> for BeforeToolCallPatch {
34 fn from(call: ToolCall) -> Self {
35 Self::call(call)
36 }
37}
38
39impl From<ToolExecutionResult> for BeforeToolCallPatch {
40 fn from(result: ToolExecutionResult) -> Self {
41 Self::result(result)
42 }
43}