Message
ChatResult.swift:22struct Message
struct Message
import OpenAI
struct Choice
struct ChatResult
init(from decoder: any Decoder) throws
let finishReason: String
The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence, length if the maximum number of tokens specified in the request was reached, content_filter if content was omitted due to a flag from our content filters, tool_calls if the model called a tool, or function_call (deprecated) if the model called a function.
let index: Int
The index of the choice in the list of choices.
let logprobs: Self.ChoiceLogprobs?
Log probability information for the choice.
let message: Self.Message
A chat completion message generated by the model.
struct ChoiceLogprobs
enum CodingKeys
enum FinishReason
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Sendable
init(from decoder: any Decoder) throws
let annotations: [Annotation]?
Annotations for the message, when applicable, as when using the web search tool. Web search tool: https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat
let audio: Audio?
If the audio output modality is requested, this object contains data about the audio response from the model. Learn more: https://platform.openai.com/docs/guides/audio
let content: String?
The contents of the message.
let refusal: String?
The refusal message generated by the model.
let role: String
The role of the author of this message.
let toolCalls: [ChatQuery.ChatCompletionMessageParam.AssistantMessageParam.ToolCallParam]?
The tool calls generated by the model, such as function calls.
struct Annotation
struct Audio
enum CodingKeys
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.