mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 15:15:34 +00:00
add tool_calls to ChatCompletionMessage
This commit is contained in:
@ -31,6 +31,7 @@ let req = ChatCompletionRequest::new(
|
|||||||
role: chat_completion::MessageRole::user,
|
role: chat_completion::MessageRole::user,
|
||||||
content: chat_completion::Content::Text(String::from("What is bitcoin?")),
|
content: chat_completion::Content::Text(String::from("What is bitcoin?")),
|
||||||
name: None,
|
name: None,
|
||||||
|
tool_calls: None,
|
||||||
}],
|
}],
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -13,6 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
role: chat_completion::MessageRole::user,
|
role: chat_completion::MessageRole::user,
|
||||||
content: chat_completion::Content::Text(String::from("What is bitcoin?")),
|
content: chat_completion::Content::Text(String::from("What is bitcoin?")),
|
||||||
name: None,
|
name: None,
|
||||||
|
tool_calls: None,
|
||||||
}],
|
}],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
role: chat_completion::MessageRole::user,
|
role: chat_completion::MessageRole::user,
|
||||||
content: chat_completion::Content::Text(String::from("What is the price of Ethereum?")),
|
content: chat_completion::Content::Text(String::from("What is the price of Ethereum?")),
|
||||||
name: None,
|
name: None,
|
||||||
|
tool_calls: None,
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
.tools(vec![chat_completion::Tool {
|
.tools(vec![chat_completion::Tool {
|
||||||
|
@ -34,6 +34,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
role: chat_completion::MessageRole::user,
|
role: chat_completion::MessageRole::user,
|
||||||
content: chat_completion::Content::Text(String::from("What is the price of Ethereum?")),
|
content: chat_completion::Content::Text(String::from("What is the price of Ethereum?")),
|
||||||
name: None,
|
name: None,
|
||||||
|
tool_calls: None,
|
||||||
}],
|
}],
|
||||||
)
|
)
|
||||||
.tools(vec![chat_completion::Tool {
|
.tools(vec![chat_completion::Tool {
|
||||||
|
@ -28,6 +28,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
name: None,
|
name: None,
|
||||||
|
tool_calls: None,
|
||||||
}],
|
}],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -156,6 +156,8 @@ pub struct ChatCompletionMessage {
|
|||||||
pub content: Content,
|
pub content: Content,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tool_calls: Option<Vec<ToolCall>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
Reference in New Issue
Block a user