Skip to main content

hh_cli/provider/
types.rs

1use crate::core::ToolCall;
2
3#[derive(Debug, Clone, Default)]
4pub struct StreamedToolCall {
5    pub id: String,
6    pub name: String,
7    pub arguments_json: String,
8}
9
10impl StreamedToolCall {
11    pub fn into_tool_call(self) -> ToolCall {
12        let arguments = serde_json::from_str(&self.arguments_json)
13            .unwrap_or_else(|_| serde_json::Value::Object(Default::default()));
14        ToolCall {
15            id: self.id,
16            name: self.name,
17            arguments,
18        }
19    }
20}