GenerateLLMToolResponse[tool,req]
gives the LLMToolResponse generated by executing tool on the LLMToolRequest req.
GenerateLLMToolResponse[{tool1,tool2,…},req]
picks a tool based on req.
GenerateLLMToolResponse[config,req]
uses the tools from an LLMConfiguration.
GenerateLLMToolResponse
GenerateLLMToolResponse[tool,req]
gives the LLMToolResponse generated by executing tool on the LLMToolRequest req.
GenerateLLMToolResponse[{tool1,tool2,…},req]
picks a tool based on req.
GenerateLLMToolResponse[config,req]
uses the tools from an LLMConfiguration.
Details
- GenerateLLMToolResponse is typically used to compute answers to requests made by LLMs using the provided list of tools.
- The tool must be an LLMTool.
- The parameter values in req are interpreted according to the specification in tool.
- If more than one tool is provided, the request is matched to whichever tooli has a name matching the one from the request. If no tooli matches, a Failure is returned.
Examples
Basic Examples (4)
Generate the tool response for a request:
GenerateLLMToolResponse[LLMTool[Association["Name" -> "countcharacter", "Description" -> "",
"Parameters" -> {"string" -> Association["Interpreter" -> "String",
"Help" -> Missing["NotSpecified"], "Required" -> True]},
"Function" -> (StringLength[#string] & ), "Options" -> {}, "LLMPacletVersion" -> "2.2.8"]], LLMToolRequest["countcharacter", {"string" -> "characters"}]]Resolve the correct tool from a list:
GenerateLLMToolResponse[{LLMTool[Association["Name" -> "runCode", "Description" -> "Run Wolfram Language code",
"Parameters" -> {"code" -> Association["Interpreter" -> "String",
"Help" -> Missing["NotSpecified"], "Required" -> True]},
"Function" -> (If[ChoiceDialog[StringJoin["Run this code?\n\n", #code]],
ToString[ToExpression[#code], InputForm], "Code not allowed"] & ), "Options" -> {},
"LLMPacletVersion" -> "2.2.8"]], LLMTool[Association["Name" -> "cityPopulationFinder",
"Description" -> "Get the population of cities.",
"Parameters" -> {"city" -> Association["Interpreter" -> "City",
"Help" -> Missing["NotSpecified"], "Required" -> True]},
"Function" -> (#city["Population"] & ), "Options" -> {}, "LLMPacletVersion" -> "2.2.8"]]}, LLMToolRequest["cityPopulationFinder", {"city" -> "Chicago"}]]Resolve the correct tool from a LLMConfiguration:
GenerateLLMToolResponse[LLMConfiguration[Association["Model" -> Automatic, "MaxTokens" -> Automatic,
"Temperature" -> Automatic, "TotalProbabilityCutoff" -> Automatic, "Prompts" -> Automatic,
"PromptDelimiter" -> Automatic, "StopTokens" -> Automatic, "ToolMethod" -> ... {"city" -> Association["Interpreter" -> "City", "Help" -> Missing["NotSpecified"],
"Required" -> True]}, "Function" -> (#city["Population"] & ), "Options" -> {},
"LLMPacletVersion" -> "2.2.8"]]}, "LLMPacletVersion" -> "2.2.8"]], LLMToolRequest["cityPopulationFinder", {"city" -> "Chicago"}]]If no matching tool is available, GenerateLLMToolResponse fails:
GenerateLLMToolResponse[{LLMTool[Association["Name" -> "runCode", "Description" -> "Run Wolfram Language code",
"Parameters" -> {"code" -> Association["Interpreter" -> "String",
"Help" -> Missing["NotSpecified"], "Required" -> True]},
"Function" -> (If[ChoiceDialog[StringJoin["Run this code?\n\n", #code]],
ToString[ToExpression[#code], InputForm], "Code not allowed"] & ), "Options" -> {},
"LLMPacletVersion" -> "2.2.8"]], LLMTool[Association["Name" -> "cityPopulationFinder",
"Description" -> "Get the population of cities.",
"Parameters" -> {"city" -> Association["Interpreter" -> "City",
"Help" -> Missing["NotSpecified"], "Required" -> True]},
"Function" -> (#city["Population"] & ), "Options" -> {}, "LLMPacletVersion" -> "2.2.8"]]}, LLMToolRequest["nonexistantTool", {"parameter" -> "value"}]]Related Guides
History
Introduced in 2023 (13.3)
Text
Wolfram Research (2023), GenerateLLMToolResponse, Wolfram Language function, https://reference.wolfram.com/language/ref/GenerateLLMToolResponse.html.
CMS
Wolfram Language. 2023. "GenerateLLMToolResponse." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/GenerateLLMToolResponse.html.
APA
Wolfram Language. (2023). GenerateLLMToolResponse. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GenerateLLMToolResponse.html
BibTeX
@misc{reference.wolfram_2026_generatellmtoolresponse, author="Wolfram Research", title="{GenerateLLMToolResponse}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/GenerateLLMToolResponse.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_generatellmtoolresponse, organization={Wolfram Research}, title={GenerateLLMToolResponse}, year={2023}, url={https://reference.wolfram.com/language/ref/GenerateLLMToolResponse.html}, note=[Accessed: 15-June-2026]}