LLMFunction[prompt]
大規模言語モデル(LLM)プロンプトのためのテンプレートを表す.
LLMFunction[{prompt1,prompt2,…}]
複数のプロンプトの組合せを表す.
LLMFunction[prompt,form]
応答に適用するイオンタープリタ form を含める.
LLMFunction[…][params]
パラメータ params に適用された prompt についてのLLMサービス応答を与える,
LLMFunction
LLMFunction[prompt]
大規模言語モデル(LLM)プロンプトのためのテンプレートを表す.
LLMFunction[{prompt1,prompt2,…}]
複数のプロンプトの組合せを表す.
LLMFunction[prompt,form]
応答に適用するイオンタープリタ form を含める.
LLMFunction[…][params]
パラメータ params に適用された prompt についてのLLMサービス応答を与える,
詳細とオプション
- LLMFunctionは大規模言語モデル(LLM)を使ったテキストの生成に使うことができる.この関数は,コンテンツの作成,文の完成,情報の抽出等が行える.
- LLMFunctionは,外部サービスの認証,請求,インターネット接続を必要とする.
- prompti は,以下の値をサポートする.
-
"string" 静的テキスト LLMPrompt["name"] リポジトリのプロンプト StringTemplate[…] テンプレートテキスト TemplateObject[…] プロンプト作成のテンプレート {prompt1,…} プロンプトのリスト - プロンプト"string"はStringTemplate["string"]に等しい.
- TemplateObjectで作成したプロンプトには,テキストと画像が入れられる.すべてのLLMが画像入力をサポートする訳ではない.
- form のサポートされる値はInterpreterと同じである.
- form が指定されると,LLMはそれを尊重するように指示される.
- 出力解釈を指定すると対応するスキーマ情報がLLMプロンプトに加えられる.
- LLMFunctionは,以下のオプションをサポートする.
-
InsertionFunction TextString 式を挿入する前に適用する関数または形式 CombinerFunction StringJoin prompt 内の断片を繋ぎ合せるために適用する関数 Authentication Automatic 認証スキーム LLMEvaluator $LLMEvaluator 使用するLLM設定 - LLMEvaluatorは,LLMConfigurationオブジェクトまたは以下の任意のキーを持つ連想に設定することができる.
-
"MaxTokens" 生成するトークンの最大数 "Model" ベースモデル "PromptDelimiter" プロンプト間に挿入する文字列 "Prompts" 初期プロンプト "StopTokens" 生成を中止するトークン "Temperature" サンプリング温度 "ToolMethod" ツールの呼出しに使用するメソッド "Tools" 使用可能にするLLMToolオブジェクトのリスト "TopProbabilities" サンプリングクラスのカットオフ "TotalProbabilityCutoff" サンプリング確率のカットオフ(核サンプリング) - "Model"の有効な形式には以下がある.
-
name 名前付きのモデル {service,name} service からの名前付きのモデル <|"Service"service,"Name"name,"Task"task|> 完全に指定されたモデル - 生成されたテキストは分布からサンプリングされる.サンプリングの詳細はLLMEvaluatorの以下の特性を使って指定できる.
-
"Temperature"t Automatic 正の温度 t を使ったサンプリング "TopProbabilities"k Automatic 最も可能性の高い k 個のクラスの中だけからサンプリングする "TopProbabilityCutoff"p Automatic 少なくとも p の累積確率で最も可能性の高い選択肢の中からサンプリングする (核サンプリング) - 複数のプロンプトはLLMEvaluatorの"PromptDelimiter"特性によって分離される.
- 次は,Authenticationの可能な値である.
-
Automatic 認証スキームを自動選択する Environment 環境変数内のキーをチェックする SystemCredential システムのキーチェーンのキーをチェックする ServiceObject[…] サービスオブジェクトから認証を継承する "string" 明示的なAPIキーを与える - AuthenticationAutomaticとき,関数はEnvironmentおよびSystemCredential内の変数ToUpperCase[service]<>"_API_KEY"をチェックする.それ以外の場合はServiceConnect[service]が使われる.
- LLMFunctionは機械学習を使用する.含まれるメソッド,訓練集合,バイアスは,Wolfram言語のバージョンによって変化することがあり,結果として与えられる結果も異なることがある.
例題
すべて開く すべて閉じる例 (3)
LLMFunction["Describe how to cook `1`"]findbyproperty = LLMFunction["What is something that is `1` and `2`"]findbyproperty["Blue", "Round"]都市をEntityとして返す関数を作成する:
cityfinder = LLMFunction["Find a city between `1` and `2`. Answer with the city name only", "City"]cityfinder["St. Louis", "Chicago"]スコープ (5)
LLMFunction[{LLMPrompt["Yoda"], "What is something that is `1` and `2`", "answer in one sentence"}]["Blue", "Round"]teamfinder = LLMFunction["What team did `Pitcher` and `Catcher` play for?"]Associationを使ってこれを適用する:
teamfinder[<|"Pitcher" -> "Whitey Ford", "Catcher" -> "Yogi Berra"|>]recipe = LLMFunction[StringTemplate["Create a short recipe including `Veggie` annd `Spice`", <|"Spice" -> "Chili Powder"|>]]recipe[<|"Veggie" -> "Corn"|>]LLMFunction[TemplateObject@{"what is this?", TemplateSlot[1]}][[image]]Interpreterを両方の制約条件に使って結果を検証する:
f = LLMFunction["Generate `` random instances", RepeatingElement["Color"]]f[10]オプション (6)
Authentication (4)
SystemCredential["OPENAI_API_KEY"] = "<my-key>"LLMFunction["the product of `1` and `2` is ", LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>, Authentication -> SystemCredential ]SetEnvironment["OPENAI_API_KEY" -> "<my-key>"]LLMFunction["the product of `1` and `2` is ", LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>, Authentication -> Environment ]so = ServiceConnect["OpenAI"]LLMFunction["the product of `1` and `2` is ", LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>, Authentication -> so]LLMFunction["the product of `1` and `2` is ", LLMEvaluator -> <|"Model" -> {"OpenAI", Automatic}|>, Authentication -> "<my-key>" ]LLMEvaluator (2)
LLMFunction["Generate `` random color", LLMEvaluator -> <|"Model" -> {"Anthropic", Automatic}|>]fZero = LLMFunction["Generate a random `` color", "Color", LLMEvaluator -> <|"Temperature" -> 0|>]fZero /@ {"warm", "warm", "cool", "cool"}fRandom = LLMFunction["Generate a random `` color", "Color", LLMEvaluator -> <|"Temperature" -> 1.5|>]fRandom /@ {"warm", "warm", "cool", "cool"}特性と関係 (1)
パラメータがないLLMFunctionはLLMに直接プロンプトを送る:
LLMFunction["Hello"][]これは,温度がゼロのLLMSynthesizeに等しい:
LLMSynthesize["Hello", LLMEvaluator -> <|"Temperature" -> 0|>]関連するガイド
-
▪
- 機械学習 ▪
- テキストの操作 ▪
- 大規模言語モデル関連機能 ▪
- テキスト解析 ▪
- 自然言語処理 ▪
- 文字列操作 ▪
- テンプレートの使用 ▪
- 言語学データ ▪
- 式と文字列の間の変換 ▪
- 自由形式入力と外部入力 ▪
- 知識の表現と利用 ▪
- 入力解釈機能の設定 ▪
- テキストの生成 ▪
- テキストの正規化
テキスト
Wolfram Research (2023), LLMFunction, Wolfram言語関数, https://reference.wolfram.com/language/ref/LLMFunction.html (2025年に更新).
CMS
Wolfram Language. 2023. "LLMFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/LLMFunction.html.
APA
Wolfram Language. (2023). LLMFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LLMFunction.html
BibTeX
@misc{reference.wolfram_2026_llmfunction, author="Wolfram Research", title="{LLMFunction}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/LLMFunction.html}", note=[Accessed: 04-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_llmfunction, organization={Wolfram Research}, title={LLMFunction}, year={2025}, url={https://reference.wolfram.com/language/ref/LLMFunction.html}, note=[Accessed: 04-November-2026]}