LLMTool
パラメータタイプのリスト »詳細
- LLMToolは,通常,大規模言語モデル(LLM)に厳密な答あるいは最新情報を与えるために使われる.
- LLMToolを使うと,ツールの使い方,その機能および引数について説明するLLMのプロンプトに変更が加えられる.
- LLMは,"name"を指定することでツールを使うことができる.この"name"はLLMの使用を効果的にトリガするための実際のツールの機能を説明するものでなければならない.ツールについての追加の詳細は"description"で与えることができる.
- ツールの呼び出しはLLMToolRequestに解析され,評価結果が文字列としてLLMに送られる.
- params と fun の形式はAPIFunctionに似ている.
- 次は,params の有効な形式である.
-
"name" 文字列パラメータ "name"type 型付きパラメータ {spec1,spec2,…} パラメータのリスト - 次は,type の有効な形式である.
-
"form" Interpreterがサポートする形式 Interpreter[…] 任意のInterpreterオブジェクト assoc パラメータの扱い方についての詳細を与える連想 tfun 文字列に適用する関数 - 次は,assoc の可能な要素である.
-
"Interpreter" "String" インタープリタタイプ "Help" Missing[] プロンプト情報 "Required" True パラメータが必要かどうか
例題
すべて開く すべて閉じる例 (2)
tool = LLMTool["countcharacter", "string", StringLength[#string]&]LLMSynthesize["How many letters in the word \"characters\" (use the tool) ?", LLMEvaluator -> <|"Tools" -> tool|>]都市名を使ってその年の人口を訪ねるツールを定義し,これをLLMに説明する:
tool = LLMTool[{"cityPopulationFinder", "Query WolframAlpha to get the population of a city from its name."}, "city" -> "City", #city["Population"]&]LLMSynthesize["Use the tool to write a few sentences about Chicago.", LLMEvaluator -> <|"Tools" -> tool|>]スコープ (3)
複数の異なる入力解釈を使ってベキ級数展開を計算するツールを定義する:
series = LLMTool[{"series_expand", "compute taylor series of a Wolfram Expression"},
{"input" -> "Expression", "order" -> "Integer", "variable" -> "Expression"}, ToString[Normal@Series[#input, {#variable, 0, #order}], InputForm]&]LLMに,答えるためには級数展開についてクエリしなければならない質問をする:
LLMSynthesize["What is the tenth order coefficient of w*Sin[w] taylor expansion?", "CompletionText", LLMEvaluator -> LLMConfiguration[<|"Tools" -> series|>]]パラメーターを都市のリストとして解釈してTravelDistance関数を公開するツールを定義する:
trip = LLMTool[{"CityTravelDistance", "Gives the estimated distance traveling to each city in the list"}, {"cityList" -> DelimitedSequence["City", ","]}, TravelDistance[#cityList]&]LLMSynthesize["Going from NewYork to Boston is it shorter to pass by Springfield or Providence ?", LLMEvaluator -> <|"Tools" -> trip|>]Wolfram言語コードを実行するためのプロンプトを含むツールを定義する:
tool = LLMTool[{"runCode", "Run Wolfram Language code"}, "code", If[ChoiceDialog["Run this code?
" <> #code], ToString[ToExpression[#code], InputForm], "Code not allowed"]&]data = LLMSynthesize["Which is closer to Boston: San Francisco or London? Use the tool as you write your response.", All, LLMEvaluator -> <|"Tools" -> tool|>];LLMが書いた完成文をプロンプトとツールの呼出しを除いて取得する:
data["CompletionText"]data["CompletionToolsText"]LLMToolRequestオブジェクトとLLMToolResponseオブジェクトのリストを取得する:
data["ToolRequests"]data["ToolResponses"]テキスト
Wolfram Research (2023), LLMTool, Wolfram言語関数, https://reference.wolfram.com/language/ref/LLMTool.html.
CMS
Wolfram Language. 2023. "LLMTool." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LLMTool.html.
APA
Wolfram Language. (2023). LLMTool. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LLMTool.html
BibTeX
@misc{reference.wolfram_2026_llmtool, author="Wolfram Research", title="{LLMTool}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/LLMTool.html}", note=[Accessed: 12-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_llmtool, organization={Wolfram Research}, title={LLMTool}, year={2023}, url={https://reference.wolfram.com/language/ref/LLMTool.html}, note=[Accessed: 12-November-2026]}