From 4ac301487c0e119a84076a99f93468baf36b54aa Mon Sep 17 00:00:00 2001 From: Magdy Saleh Date: Thu, 23 Jan 2025 18:52:21 -0500 Subject: [PATCH] add tool calls to messages --- router/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/router/src/lib.rs b/router/src/lib.rs index 0b14a91c..06650221 100644 --- a/router/src/lib.rs +++ b/router/src/lib.rs @@ -581,7 +581,7 @@ pub struct Url { } #[derive(Clone, Deserialize, Serialize, ToSchema, Default, Debug, PartialEq)] -pub(crate) struct ToolCall { +pub struct ToolCall { pub id: String, pub r#type: String, pub function: ReturnFunctionDefinition, @@ -603,6 +603,8 @@ pub struct Message { #[schema(example = "My name is David and I")] pub content: Option, #[serde(default, skip_serializing_if = "Option::is_none")] + pub tool_calls: Option>, + #[serde(default, skip_serializing_if = "Option::is_none")] #[schema(example = "\"David\"")] name: Option, } @@ -642,6 +644,8 @@ pub struct TextMessage { pub role: String, #[schema(example = "My name is David and I")] pub content: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tool_calls: Option>, } impl From for TextMessage { @@ -660,6 +664,7 @@ impl From for TextMessage { .join(""), None => String::new(), }, + tool_calls: value.tool_calls, } } }