ChatObject []
represents an ongoing conversation with a remote service.
ChatObject [init]
creates a new chat using the initialization init.
ChatObject […][prop]
extracts the property prop from the object.
ChatObject
ChatObject []
represents an ongoing conversation with a remote service.
ChatObject [init]
creates a new chat using the initialization init.
ChatObject […][prop]
extracts the property prop from the object.
Details and Options
- ChatObject stores a full conversation together with the message metadata.
- The initialization init can take the following values:
-
"text" static text{prompt1,…} a list of prompts{msg1,…} a list of messages
- Non-message init values are converted to messages with "Role""System".
- Template objects are automatically converted to message content via TemplateObject […][].
- Prompt created with TemplateObject can contain text and images. Not every LLM supports image input.
- When the initialization is a list of messages, each message must be an association with the following keys:
-
"Content" content content of the message"Role" String role of the participant"Timestamp" DateObject message timestamp (optional)
- Possible form of content are:
-
"text" a string<|"Type""Text","Data"data|> an explicit text part{content1,…} multiple part content
- Possible values for "Role" include:
-
"Assistant" LLM-generated message"System" system message"Tool" autogenerated tool response"User" user message
- The following options can be specified:
-
- LLMEvaluator can be set to an LLMConfiguration object or an association with any of the following keys:
-
"MaxTokens" maximum amount of tokens to generate"Model" base model"PromptDelimiter" string to insert between prompts"Prompts" initial prompts or LLMPromptGenerator objects"StopTokens" tokens on which to stop generation"Temperature" sampling temperature"ToolMethod" method to use for tool calling"Tools" list of LLMTool objects to make available"TopProbabilities" sampling classes cutoff"TotalProbabilityCutoff" sampling probability cutoff (nucleus sampling)
- Valid forms of "Model" include:
-
name named model{service,name} named model from service<|"Service"service,"Name"name|> fully specified model
- The generated text is sampled from a distribution. Details of the sampling can be specified using the following properties of the LLMEvaluator :
-
"TotalProbabilityCutoff"p Automatic sample among the most probable choices with an accumulated probability of at least p (nucleus sampling)
- The Automatic value of these parameters uses the default for the specified "Model".
- Possible values for "ToolMethod" include:
-
"Service" rely on the tool mechanism of service"Textual" used prompt-based tool calling
- Possible values for Authentication are:
-
Automatic choose the authentication scheme automaticallyEnvironment check for a key in the environment variablesSystemCredential check for a key in the system keychainassoc provide explicit key and user ID
- With Authentication Automatic , the function checks the variable ToUpperCase [service]<>"_API_KEY" in Environment and SystemCredential ; otherwise, it uses ServiceConnect [service].
- When using Authentication assoc, assoc can contain the following keys:
-
"ID" user identity"APIKey" API key used to authenticate
- Properties of a chat object can be extracted using ChatObject […][prop].
- Possible values for prop include:
-
"ChatID" the unique ID of the conversation"FullText" string representation of the conversation"LLMEvaluator" the stored LLMConfiguration"MessageGrid" typeset grid of the conversation"Messages" a list of exchanged messages"Properties" a list of all the possible properties"Usage" cumulative API usage (calls, tokens, …){prop1,…} a list of properties
Examples
open all close allBasic Examples (2)
Create a new chat:
Add a message and a response to the conversation:
Get a list of all the messages:
Create a chat object with a tool:
Show the LLM answer together with the tool-calling steps:
Scope (5)
Create an empty chat:
Create a chat with an initial prompt:
Create a chat from a list of messages:
Extract a chat property:
Extract a list of properties:
List all the available properties:
Options (1)
LLMEvaluator (1)
Create a chat that uses a specific model:
Possible Issues (1)
All models do not support images in "System" message:
Use a different model:
Specify a different "Role" value:
See Also
ChatEvaluate LLMSynthesize LLMConfiguration LLMPrompt LLMPromptGenerator LLMTool LLMResourceTool
Service Connections: OpenAI Anthropic GoogleGemini AlephAlpha Cohere DeepSeek Groq MistralAI TogetherAI
Related Guides
Text
Wolfram Research (2023), ChatObject, Wolfram Language function, https://reference.wolfram.com/language/ref/ChatObject.html (updated 2025).
CMS
Wolfram Language. 2023. "ChatObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/ChatObject.html.
APA
Wolfram Language. (2023). ChatObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChatObject.html
BibTeX
@misc{reference.wolfram_2025_chatobject, author="Wolfram Research", title="{ChatObject}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/ChatObject.html}", note=[Accessed: 18-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_chatobject, organization={Wolfram Research}, title={ChatObject}, year={2025}, url={https://reference.wolfram.com/language/ref/ChatObject.html}, note=[Accessed: 18-November-2025]}