Class ChatMessage
- Namespace
- OpenAI.
Object Models. Request Models
- Assembly
- AntRunnerLib.dll
The contents of the message. Messages must be an array of message objects, where each object has a role (either “system”, “user”, or “assistant”) and content (the content of the message) and an optional name
- Inheritance
-
System.
Object ChatMessage
- Inherited Members
-
System.
Object. Equals(System. Object) System.Object. Equals(System. Object, System. Object) System.Object. Get Hash Code() System.Object. Get Type() System.Object. Memberwise Clone() System.Object. Reference Equals(System. Object, System. Object) System.Object. To String()
Constructors
ChatMessage()
ChatMessage(String, IList<MessageContent>, String, Nullable<IList<ToolCall>>, String)
public ChatMessage(string role, IList<MessageContent> contents, string name = null, IList<ToolCall>? toolCalls = null, string toolCallId = null)
Parameters
role
System.String The role of the author of this message. One of system, user, or assistant.
contents
IList<MessageContent >The list of the content messages.
name
System.String The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
toolCalls
System.Nullable <IList<ToolCall >>The tool calls generated by the model.
toolCallId
System.String The tool function call id generated by the model
ChatMessage(String, String, String, Nullable<IList<ToolCall>>, String)
public ChatMessage(string role, string content, string name = null, IList<ToolCall>? toolCalls = null, string toolCallId = null)
Parameters
role
System.String The role of the author of this message. One of system, user, or assistant.
content
System.String The contents of the message.
name
System.String The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
toolCalls
System.Nullable <IList<ToolCall >>The tool calls generated by the model.
toolCallId
System.String The tool function call id generated by the model
Properties
Content
Property Value
- System.
String
ContentCalculated
The contents of the message.
Property Value
- System.
Object
Contents
Property Value
- System.
Nullable <IList<MessageContent >>
FunctionCall
Deprecated and replaced by tool_calls. The name and arguments of a function that should be called, as generated by the model.
Property Value
Name
The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
Property Value
- System.
String
Role
The role of the author of this message. One of system, user, or assistant.
Property Value
- System.
String
ToolCallId
Required for tool role messages. Tool call that this message is responding to.
Property Value
- System.
String
ToolCalls
The tool calls generated by the model, such as function calls.
Property Value
- System.
Nullable <IList<ToolCall >>
Methods
FromAssistant(String, String, Nullable<IList<ToolCall>>)
public static ChatMessage FromAssistant(string content, string name = null, IList<ToolCall>? toolCalls = null)
Parameters
content
System.String name
System.String toolCalls
System.Nullable <IList<ToolCall >>
Returns
FromSystem(String, String)
Parameters
content
System.String name
System.String
Returns
FromTool(String, String)
Parameters
content
System.String toolCallId
System.String
Returns
FromUser(IList<MessageContent>)
Parameters
contents
IList<MessageContent >
Returns
FromUser(String, String)
Parameters
content
System.String name
System.String