WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

ChatEvaluate [chat,prompt]

appends prompt and its follow-up to the ChatObject chat.

ChatEvaluate [prompt]

represents an operator form of ChatEvaluate that can be applied to a ChatObject .

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Options  
Authentication  
LLMEvaluator  
ProgressReporting  
Applications  
Tool Calling  
Possible Issues  
See Also
Related Guides
History
Cite this Page
This functionality requires LLM access »

ChatEvaluate [chat,prompt]

appends prompt and its follow-up to the ChatObject chat.

ChatEvaluate [prompt]

represents an operator form of ChatEvaluate that can be applied to a ChatObject .

Details and Options

  • ChatEvaluate is used to continue the conversation in a ChatObject .
  • ChatEvaluate requires external service authentication, billing and internet connectivity.
  • Possible values for prompt include:
  • "text" static text
    LLMPrompt ["name"] a repository prompt
    StringTemplate [] templated text
    TemplateObject [] template for creating a prompt
    Image [] an image
    {prompt1,} a list of prompts
  • 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.
  • The following options can be specified:
  • Authentication Inherited authentication scheme
    LLMEvaluator Inherited LLM configuration to use
    ProgressReporting $ProgressReporting how to report the progress of the computation
  • If LLMEvaluator is set to Inherited , the LLM configuration specified in chat is used.
  • 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
  • Prompts specified in "Prompts" are prepended to the messages in chat with role set as "System".
  • Multiple prompts are separated by the "PromptDelimiter" property.
  • The generated text is sampled from a distribution. Details of the sampling can be specified using the following properties of the LLMEvaluator :
  • "Temperature"t Automatic sample using a positive temperature t
    "TopProbabilities"k Automatic sample only among the k highest-probability classes
    "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" use prompt-based tool calling
  • Possible values for Authentication are:
  • Automatic choose the authentication scheme automatically
    Inherited inherit settings from chat
    Environment check for a key in the environment variables
    SystemCredential check for a key in the system keychain
    ServiceObject [] inherit the authentication from a service object
    "string" provide explicit API key
  • With Authentication Automatic , the function checks the variable ToUpperCase [service]<>"_API_KEY" in Environment and SystemCredential ; otherwise, it uses ServiceConnect [service].
  • ChatEvaluate uses machine learning. Its methods, training sets and biases included therein may change and yield varied results in different versions of the Wolfram Language.

Examples

open all close all

Basic Examples  (3)

Create a new chat:

Wolfram Language code: chat = ChatObject[]

Add a message and a response to the conversation:

Wolfram Language code: ChatEvaluate[chat, "What's the tallest mountain?"]

Create chat specifying a multimodal model:

Wolfram Language code: multichat = ChatObject[LLMEvaluator -> <|"Model" -> {"WolframAIAccess", Automatic}|>]

Now both text and images can be used in the conversation:

Wolfram Language code: ChatEvaluate[multichat, {"what is this picture?", Entity["TaxonomicSpecies", "FelisCatus::ddvt3"][EntityProperty["TaxonomicSpecies", "Image"]]}]

Create a chat object with a tool:

Wolfram Language code: toolchat = ChatObject[LLMEvaluator -> <|"Tools" -> LLMTool["countcharacter", "string", StringLength]|>]

Show the LLM answer together with the tool-calling steps:

Wolfram Language code: ChatEvaluate[toolchat, "How many letters in the word \"characters\" (use the tool) ?"]

Scope  (3)

Start a new conversation:

Wolfram Language code: ChatEvaluate[ChatObject[], "Tell me a joke"]

Continue an existing conversation:

Wolfram Language code: ChatEvaluate[ChatObject[Association["LLMEvaluator" -> LLMConfiguration[ Association["Model" -> Association["Service" -> "OpenAI", "Name" -> "gpt-4"], "MaxTokens" -> Automatic, "Temperature" -> Automatic, "TotalProbabilityCutoff" -> Automatic, "P ... 1.}, {21.00040054321289, 21.}}}]}, FaceForm[RGBColor[0.5372549019607843, 0.5372549019607843, 0.5372549019607843, 1.]]]}, ImageSize -> {{27., 27.}, {27., 27.}}, PlotRange -> {{-0.5, 26.5}, {-0.5, 26.5}}, AspectRatio -> Automatic]]], "And what about doctors?"]

Use the function as an operator:

Wolfram Language code: ChatEvaluate["Hi there!"][ChatObject[Association["LLMEvaluator" -> LLMConfiguration[Association["Model" -> Automatic, "MaxTokens" -> Automatic, "Temperature" -> Automatic, "TotalProbabilityCutoff" -> Automatic, "Prompts" -> Automatic, "PromptDelimiter" -> "\n\n" ... 1.}, {21.00040054321289, 21.}}}]}, FaceForm[RGBColor[0.5372549019607843, 0.5372549019607843, 0.5372549019607843, 1.]]]}, ImageSize -> {{27., 27.}, {27., 27.}}, PlotRange -> {{-0.5, 26.5}, {-0.5, 26.5}}, AspectRatio -> Automatic]]]]

Options  (12)

Authentication  (5)

Use Wolfram AI Access:

Wolfram Language code: ChatEvaluate[ChatObject[LLMEvaluator -> LLMConfiguration["WolframAIAccess"]], "which element has atomic number 2?"]

Provide an authentication key for the API:

Wolfram Language code: ChatEvaluate[ChatObject[LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>], "which element has atomic number 2?", Authentication -> "<my-key>"]

Store the API key using the operating system's keychain:

Wolfram Language code: SystemCredential["ANTHROPIC_API_KEY"] = "<my-key>"

Look for the key in the system keychain:

Wolfram Language code: ChatEvaluate[ChatObject[LLMEvaluator -> <|"Model" -> {"Anthropic", Automatic}|>], "which element has atomic number 2?", Authentication -> SystemCredential]

Specify the name of the key (queried only at connection time):

Wolfram Language code: ChatEvaluate[ChatObject[LLMEvaluator -> <|"Model" -> {"Anthropic", Automatic}|>], "which element has atomic number 2?", Authentication :> SystemCredential["MY_OTHER_ANTHROPIC_API_KEY"]]

Look for the key in the system environment:

Wolfram Language code: ChatEvaluate[ChatObject[LLMEvaluator -> <|"Model" -> {"GoogleGemini", Automatic}|>], "which element has atomic number 2?", Authentication -> Environment]

Authenticate via a service object:

Wolfram Language code: so = ServiceConnect["Cohere"]
Wolfram Language code: ChatEvaluate[ChatObject[LLMEvaluator -> <|"Model" -> {"Cohere", Automatic}|>], "which element has atomic number 2?", Authentication -> so]

LLMEvaluator  (6)

Specify the service used to generate the answer:

Wolfram Language code: ChatEvaluate[ChatObject[], "the first 20 digits of Pi", LLMEvaluator -> <|"Model" -> {"Anthropic", Automatic}|>]

Specify both the service and the model:

Wolfram Language code: modelname = First@ServiceConnect["Anthropic"]["ChatModelList"]
Wolfram Language code: ChatEvaluate[ChatObject[], "the first 20 digits of Pi", LLMEvaluator -> <|"Model" -> {"Anthropic", modelname}|>]

By default, the text generation continues until a termination token is generated:

Wolfram Language code: ChatEvaluate[ChatObject[], "the first 20 digits of Pi"]

Limit the amount of generated samples (tokens):

Wolfram Language code: ChatEvaluate[ChatObject[], "the first 20 digits of Pi", LLMEvaluator -> <|"MaxTokens" -> 3|>]

Specify that the sampling should be performed at zero temperature:

Wolfram Language code: ChatEvaluate[ChatObject[], "Tell me three colors", LLMEvaluator -> <|"Temperature" -> 0|>]

Specify a high temperature to get more variation in the generation:

Wolfram Language code: ChatEvaluate[ChatObject[], "Tell me three colors", LLMEvaluator -> <|"Temperature" -> 2|>]

Specify the maximum cumulative probability before cutting off the distribution:

Wolfram Language code: ChatEvaluate[ChatObject[], "What's the plural of mouse?", LLMEvaluator -> <|"TotalProbabilityCutoff" -> .5|>]

Specify the service and the model to use for the generation:

Wolfram Language code: ChatEvaluate[ChatObject[], "What's the plural of mouse?", LLMEvaluator -> <|"Model" -> {"OpenAI", "gpt-4"}|>]

Specify a prompt to be automatically inserted:

Wolfram Language code: ChatEvaluate[ChatObject[], "What's the plural of mouse?", LLMEvaluator -> <|"Prompts" -> LLMPrompt["ELI5"]|>]

ProgressReporting  (1)

Do not report any progress information:

Wolfram Language code: ChatEvaluate[ChatObject[], "What's the tallest mountain?", ProgressReporting -> False]

Applications  (1)

Tool Calling  (1)

Define a tool that can be called by the LLM:

Wolfram Language code: altimeter = LLMTool[{"altimeter", "gives the altitude at a location"}, {"where" -> "Location"}, GeoElevationData[#where]&]

Instantiate a chat object with the tool:

Wolfram Language code: chat = ChatObject[LLMEvaluator -> <|"Tools" -> altimeter|>]

Ask a question that can get a precise answer using the tool:

Wolfram Language code: ChatEvaluate[chat, "what's the altitude of mount Kilimanjaro?"]

Possible Issues  (1)

Evaluating a chat session specifying the authentication key embeds the information:

Wolfram Language code: chat = ChatEvaluate[ChatObject[], "Who are you?", LLMEvaluator -> <|"Model" -> {"Anthropic", Automatic}|>, Authentication -> "<my-key>"]

With the default setting Authentication Inherited , the authentication will not work on a different service:

Wolfram Language code: ChatEvaluate[chat, "Who are you?", LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>]

Use Authentication Automatic or provide explicit authentication for the new service to reconnect:

Wolfram Language code: ChatEvaluate[chat, "Who are you?", LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>, Authentication -> Automatic]

History

Introduced in 2023 (13.3)

Wolfram Research (2023), ChatEvaluate, Wolfram Language function, https://reference.wolfram.com/language/ref/ChatEvaluate.html.

Text

Wolfram Research (2023), ChatEvaluate, Wolfram Language function, https://reference.wolfram.com/language/ref/ChatEvaluate.html.

CMS

Wolfram Language. 2023. "ChatEvaluate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ChatEvaluate.html.

APA

Wolfram Language. (2023). ChatEvaluate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChatEvaluate.html

BibTeX

@misc{reference.wolfram_2026_chatevaluate, author="Wolfram Research", title="{ChatEvaluate}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/ChatEvaluate.html}", note=[Accessed: 13-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_chatevaluate, organization={Wolfram Research}, title={ChatEvaluate}, year={2023}, url={https://reference.wolfram.com/language/ref/ChatEvaluate.html}, note=[Accessed: 13-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /