struct OpenAI::ChatMessage
- OpenAI::ChatMessage
- Struct
- Value
- Object
Included Modules
- JSON::Serializable
Extended Modules
- JSON::Schema
Defined in:
openai/api/chat.crConstructors
- .new(pull : JSON::PullParser)
- .new(role : OpenAI::ChatMessageRole, content : Nil | String = nil, name : Nil | String = nil, function_call : OpenAI::ChatFunctionCall | Nil = nil, tokens : Int32 = 0, tool_calls : Nil | Array(OpenAI::ChatToolCall) = nil, tool_call_id : Nil | String = nil)
Instance Method Summary
- #content : String | Nil
- #function_call : ChatFunctionCall | Nil
-
#name : String | Nil
The name of the author of this message.
-
#role : ChatMessageRole
The role of the messages author.
- #tokens : Int32
- #tokens=(tokens : Int32)
-
#tool_call_id : String | Nil
For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool.
-
#tool_calls : Array(ChatToolCall) | Nil
The tool calls generated by the model, such as function calls.
Constructor Detail
def self.new(role : OpenAI::ChatMessageRole, content : Nil | String = nil, name : Nil | String = nil, function_call : OpenAI::ChatFunctionCall | Nil = nil, tokens : Int32 = 0, tool_calls : Nil | Array(OpenAI::ChatToolCall) = nil, tool_call_id : Nil | String = nil)
#
Instance Method Detail
def name : String | Nil
#
The name of the author of this message. name is required if role is function, and it should be the name of the function whose response is in the content. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
def role : ChatMessageRole
#
The role of the messages author. One of system, user, assistant, or function.
def tool_call_id : String | Nil
#
For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool.
def tool_calls : Array(ChatToolCall) | Nil
#
The tool calls generated by the model, such as function calls.