pub trait ChatCompletionResponseExt {
// Required methods
fn content(&self) -> Option<&str>;
fn tool_calls(&self) -> Vec<&ChatCompletionMessageToolCallsInner>;
fn has_tool_calls(&self) -> bool;
fn first_choice(&self) -> Option<&CreateChatCompletionResponseChoicesInner>;
fn first_message(&self) -> Option<&ChatCompletionResponseMessage>;
fn is_refusal(&self) -> bool;
fn refusal(&self) -> Option<&str>;
fn finish_reason(&self) -> Option<String>;
}Expand description
Extension trait for chat completion responses.
Required Methods§
Sourcefn tool_calls(&self) -> Vec<&ChatCompletionMessageToolCallsInner>
fn tool_calls(&self) -> Vec<&ChatCompletionMessageToolCallsInner>
Get the tool calls from the first choice, if available.
Sourcefn has_tool_calls(&self) -> bool
fn has_tool_calls(&self) -> bool
Check if the response has tool calls.
Sourcefn first_choice(&self) -> Option<&CreateChatCompletionResponseChoicesInner>
fn first_choice(&self) -> Option<&CreateChatCompletionResponseChoicesInner>
Get the first choice from the response.
Sourcefn first_message(&self) -> Option<&ChatCompletionResponseMessage>
fn first_message(&self) -> Option<&ChatCompletionResponseMessage>
Get the message from the first choice.
Sourcefn is_refusal(&self) -> bool
fn is_refusal(&self) -> bool
Check if the response was refused.
Sourcefn finish_reason(&self) -> Option<String>
fn finish_reason(&self) -> Option<String>
Get the finish reason for the first choice.