ChatCompletionResponseExt

Trait ChatCompletionResponseExt 

Source
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§

Source

fn content(&self) -> Option<&str>

Get the content of the first choice, if available.

Source

fn tool_calls(&self) -> Vec<&ChatCompletionMessageToolCallsInner>

Get the tool calls from the first choice, if available.

Source

fn has_tool_calls(&self) -> bool

Check if the response has tool calls.

Source

fn first_choice(&self) -> Option<&CreateChatCompletionResponseChoicesInner>

Get the first choice from the response.

Source

fn first_message(&self) -> Option<&ChatCompletionResponseMessage>

Get the message from the first choice.

Source

fn is_refusal(&self) -> bool

Check if the response was refused.

Source

fn refusal(&self) -> Option<&str>

Get the refusal message if the response was refused.

Source

fn finish_reason(&self) -> Option<String>

Get the finish reason for the first choice.

Implementors§