mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
Update ChatCompletionChoice with optional finish_reason and finish_details
This commit is contained in:
@ -52,14 +52,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let result = client.chat_completion(req)?;
|
||||
|
||||
match result.choices[0].finish_reason {
|
||||
chat_completion::FinishReason::stop => {
|
||||
None => {
|
||||
println!("No finish_reason");
|
||||
println!("{:?}", result.choices[0].message.content);
|
||||
}
|
||||
Some(chat_completion::FinishReason::stop) => {
|
||||
println!("Stop");
|
||||
println!("{:?}", result.choices[0].message.content);
|
||||
}
|
||||
chat_completion::FinishReason::length => {
|
||||
Some(chat_completion::FinishReason::length) => {
|
||||
println!("Length");
|
||||
}
|
||||
chat_completion::FinishReason::function_call => {
|
||||
Some(chat_completion::FinishReason::function_call) => {
|
||||
println!("FunctionCall");
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct Currency {
|
||||
@ -94,10 +98,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let result = client.chat_completion(req)?;
|
||||
println!("{:?}", result.choices[0].message.content);
|
||||
}
|
||||
chat_completion::FinishReason::content_filter => {
|
||||
Some(chat_completion::FinishReason::content_filter) => {
|
||||
println!("ContentFilter");
|
||||
}
|
||||
chat_completion::FinishReason::null => {
|
||||
Some(chat_completion::FinishReason::null) => {
|
||||
println!("Null");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user