ai_providers/openai/common/
function_tool_call_item.rs1use serde::{Deserialize, Serialize};
2
3use crate::openai::common::status::Status;
4
5#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6pub struct FunctionToolCallItem {
7 pub arguments: String,
8 pub call_id: String,
9 pub name: String,
10 #[serde(skip_serializing_if = "Option::is_none")]
11 pub id: Option<String>,
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub status: Option<Status>,
14}
15
16impl FunctionToolCallItem {
17 pub fn new(
18 arguments: impl Into<String>,
19 call_id: impl Into<String>,
20 name: impl Into<String>,
21 ) -> Self {
22 Self {
23 arguments: arguments.into(),
24 call_id: call_id.into(),
25 name: name.into(),
26 id: None,
27 status: None,
28 }
29 }
30
31 pub fn id(mut self, value: impl Into<String>) -> Self {
32 self.id = Some(value.into());
33 self
34 }
35
36 pub fn status(mut self, value: Status) -> Self {
37 self.status = Some(value);
38 self
39 }
40}