mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 15:15:34 +00:00
Fix message
This commit is contained in:
@ -92,10 +92,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
},
|
},
|
||||||
chat_completion::ChatCompletionMessage {
|
chat_completion::ChatCompletionMessage {
|
||||||
role: chat_completion::MessageRole::function,
|
role: chat_completion::MessageRole::function,
|
||||||
content: ({
|
content: {
|
||||||
let price = get_coin_price(&coin).await;
|
let price = get_coin_price(&coin).await;
|
||||||
format!("{{\"price\": {}}}", price)
|
format!("{{\"price\": {}}}", price)
|
||||||
}),
|
},
|
||||||
name: Some(String::from("get_coin_price")),
|
name: Some(String::from("get_coin_price")),
|
||||||
function_call: None,
|
function_call: None,
|
||||||
},
|
},
|
||||||
|
@ -62,10 +62,21 @@ pub struct ChatCompletionMessage {
|
|||||||
pub function_call: Option<FunctionCall>,
|
pub function_call: Option<FunctionCall>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct ChatCompletionMessageForResponse {
|
||||||
|
pub role: MessageRole,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub content: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub name: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub function_call: Option<FunctionCall>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct ChatCompletionChoice {
|
pub struct ChatCompletionChoice {
|
||||||
pub index: i64,
|
pub index: i64,
|
||||||
pub message: ChatCompletionMessage,
|
pub message: ChatCompletionMessageForResponse,
|
||||||
pub finish_reason: FinishReason,
|
pub finish_reason: FinishReason,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user