Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

LLMFunctions

Guides

  • LLMFunctions

Symbols

  • ChatEvaluate
  • ChatObject
  • GenerateLLMToolResponse
  • ImageSynthesize
  • LLMConfiguration
  • LLMEvaluator
  • LLMExampleFunction
  • LLMFunction
  • LLMPrompt
  • LLMResourceFunction
  • LLMSynthesize
  • LLMTool
  • LLMToolRequest
  • LLMToolResponse
  • $LLMEvaluator
[
EXPERIMENTAL
]
LLMTool
​
LLMTool["name",params,fun]
represents a tool for use by an LLM enabling it to run
fun
on parameters specified by
params
.
​
​
LLMTool[{"name","description"},params,fun]
uses a description to prompt the LLM.
​
Details

Examples  
(2)
Basic Examples  
(2)
Define a tool for getting the populations of cities:
In[1]:=
tool=
LLMTool
["cityPopulationFinder","city""City",#city["Population"]&]
Out[1]=
LLMTool
name: cityPopulationFinder
description:

Use the tool in a call to an LLM:
In[2]:=
LLMSynthesize
"Use the tool to write a few sentences about Chicago.",
LLMEvaluator
"Tools"tool
Out[2]=
Chicago is a bustling city in the state of Illinois with a population of 2746388 people according to the latest cityPopulationFinder data. It is known for its stunning skyline, diverse culture, and deep-dish pizza.
​
Define a tool with some prompting for running Wolfram Language code:
In[1]:=
tool=
LLMTool
[{"runCode","Run Wolfram Language code"},"code",If[ChoiceDialog["Run this code?\n\n"<>#code],ToString[ToExpression[#code],InputForm],"Code not allowed"]&]
Out[1]=
LLMTool
name: runCode
description: Run Wolfram Language code

Run an LLM with the tool, returning metadata about the evaluation:
In[2]:=
data=
LLMSynthesize
"Which is closer to Boston: San Francisco or London? Use the tool as you write your response.",All,
LLMEvaluator
"Tools"tool;
Get the completion written by the LLM with prompting and tool calls removed:
In[3]:=
data["CompletionText"]
Out[3]=
Let's use the runCode tool to calculate the distance between Boston and two different locations: San Francisco and London. ​So, San Francisco is closer to Boston with a distance of approximately 2688.46 miles, while London is around 3266.35 miles away from Boston.
Get the completion with tool calls preserved:
In[4]:=
data["CompletionToolsText"]
Out[4]=
Let's use the runCode tool to calculate the distance between Boston and two different locations: San Francisco and London. ​TOOLCALL: runCode{ "code": "GeoDistance[Entity[\"City\", {\"SanFrancisco\", \"California\", \"UnitedStates\"}], Entity[\"City\", {\"Boston\", \"Massachusetts\", \"UnitedStates\"}]]"}ENDARGUMENTSENDTOOLCALLRESULT: Quantity[2688.4637915812527, "Miles"]​TOOLCALL: runCode{ "code": "GeoDistance[Entity[\"City\", {\"London\", \"GreaterLondon\", \"UnitedKingdom\"}], Entity[\"City\", {\"Boston\", \"Massachusetts\", \"UnitedStates\"}]]"}ENDARGUMENTSENDTOOLCALLRESULT: Quantity[3266.34870599052, "Miles"]​So, San Francisco is closer to Boston with a distance of approximately 2688.46 miles, while London is around 3266.35 miles away from Boston.
Get the associations of
LLMToolRequest
and
LLMToolResponse
objects:
In[5]:=
data["ToolRequests"]
Out[5]=
{1065,1263}LLMToolRequest
name: runCode
parameter values: {codeGeoDistance[Entity["City", {"SanFrancisco", "California", "UnitedStates"}], Entity["City", {"Boston", "Massachusetts", "UnitedStates"}]]}
,{1323,1519}LLMToolRequest
name: runCode
parameter values: {codeGeoDistance[Entity["City", {"London", "GreaterLondon", "UnitedKingdom"}], Entity["City", {"Boston", "Massachusetts", "UnitedStates"}]]}

In[6]:=
data["ToolResponses"]
Out[6]=
{1264,1322}LLMToolResponse
tool: LLMTool
name: runCode
description: Run Wolfram Language code

parameter values: codeGeoDistance[Entity["City", {"SanFrancisco", "California", "UnitedStates"}], Entity["City", {"Boston", "Massachusetts", "UnitedStates"}]]
output: Quantity[2688.4637915812527, "Miles"]
,{1520,1576}LLMToolResponse
tool: LLMTool
name: runCode
description: Run Wolfram Language code

parameter values: codeGeoDistance[Entity["City", {"London", "GreaterLondon", "UnitedKingdom"}], Entity["City", {"Boston", "Massachusetts", "UnitedStates"}]]
output: Quantity[3266.34870599052, "Miles"]

SeeAlso
LLMSynthesize
 
▪
ChatObject
 
▪
LLMEvaluator
 
▪
LLMConfiguration
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com