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
The contents of the message.
-
#function_call : ChatFunctionCall | Nil
The name and arguments of a function that should be called, as generated by the model.
-
#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
Instance Method Detail
The contents of the message. content is required for all messages, and may be null for assistant messages with function calls.
The name and arguments of a function that should be called, as generated by the model.
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.
The role of the messages author. One of system, user, assistant, or function.
For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool.
The tool calls generated by the model, such as function calls.