表示 LLM 的一种配置.
LLMConfiguration[spec]
根据规定 spec 创建配置.
LLMConfiguration[LLMConfiguration[…],propspec]
根据现有配置创建新的配置.
LLMConfiguration
表示 LLM 的一种配置.
LLMConfiguration[spec]
根据规定 spec 创建配置.
LLMConfiguration[LLMConfiguration[…],propspec]
根据现有配置创建新的配置.
更多信息
- LLMConfiguration represents the properties of an LLM task including model, special prompts, sampling strategy, etc.
- 通过 LLMEvaluator 选项,LLMConfiguration 对象可用在 LLMSynthesize、ChatObject 和 ChatEvaluate 等函数中.
- $LLMEvaluator 被设为一个 LLMConfiguration.
- spec 可取的值包括:
-
"name" 使用已命名配置 propval 设置特定属性 <|prop1->val1,prop2->val2,...|> 设置多个属性 - 未指定的属性将被设置为 $LLMEvaluator 指定的值.
- 有效的配置名称包括:
-
"WolframAIAccess" 通过 Wolfram 使用 LLM 模型 "WolframAIAssistant" 使用 Wolfram AI Assistant 提供的提示词和工具 "AgentOne" 使用 Agent One API 的提示词和工具 - 支持的 LLMConfiguration 对象的属性包括:
-
"MaxTokens" 生成词元的最大数量 "Model" 基础模型 "PromptDelimiter" 在提示间插入的字符串 "Prompts" 初始提示或 LLMPromptGenerator 对象 "Reasoning" 推理设置 "StopTokens" 用来指示停止生成的词元 "Temperature" 采样温度 "ToolMethod" 用于工具调用的方法 "Tools" 可用的 LLMTool 对象列表 "TopProbabilities" 采样类截止 "TotalProbabilityCutoff" 采样截止概率(核心采样) - "Model" 的有效设置包括:
-
name 已命名模型 {service,name} 来自 service 的已命名模型 <|"Service"service,"Name"name|> 完全指定的模型 - LLM 生成的文本采样自一个分布. 可用 LLMConfiguration 的以下属性指定采样的详细信息:
-
"Temperature"t Automatic 用正的温度 t 进行采样 "TopProbabilities"k Automatic 只在 k 个概率最高的类别中抽样 "TotalProbabilityCutoff"p Automatic 在最有可能的选择中采样,累积概率至少为 p(核心采样) - 这些参数的 Automatic 值使用指定 "Model" 的默认值.
- "Reasoning" 的有效设置为:
-
None 不要使用推理 "spec" 使用名为 "spec" 的规范 Quantity[n,"Tokens"] 分配 n 个词元用于推理 - "Prompts" 的有效设置包括:
-
"string" 静态文本 LLMPrompt["name"] 存储库提示 LLMPromptGenerator[…] LLMPromptGenerator 对象 {prompt1,…} 提示列表 - "PromptDelimiter" 的设置决定了如何连接多个提示.
- "ToolMethod" 的有效设置包括:
-
Automatic 当支持时为 "Service",否则为 "Textual" "Service" 依靠 service 的工具机制 "Textual" 使用基于提示的工具调用 assoc 特定文本提示和解析 - assoc 中有效的键包括:
-
"ToolPrompt" 提示指定工具格式 "ToolRequestParser" 解析工具请求的函数 "ToolResponseInsertionFunction" 用于将工具响应序列化的函数 - 仅在指定至少一种工具时才使用 "ToolPrompt" 指定的提示.
- "ToolPrompt" 可以是一个模板,被应用于一个包含 LLMConfiguration 所有属性的关联.
- "ToolRequestParser" 指定一个从 LLM 获取最近补全 (completion) 的函数,并返回以下形式之一的结果:
-
None 没有工具请求 {{start,end},LLMToolRequest[…]} 工具请求 {{start,end},Failure[…]} 无效的工具请求 - 整数对 {start,end} 指明工具请求出现的补全字符串中的字符范围.
- LLMConfiguration[] 给出一个所有属性均设为默认值的配置.
- 并非所有 LLM 服务都支持在 LLMConfiguration 中指定的所有参数.
范例
打开所有单元 关闭所有单元基本范例 (3)
config = LLMConfiguration["Prompts" -> LLMPrompt["ELI5"]]LLMSynthesize["What is the tallest mountain?", LLMEvaluator -> config]config = LLMConfiguration[<|"Prompts" -> LLMPrompt["ELI5"], "Tools" -> LLMTool[...]|>]LLMSynthesize["Which is bigger, Chicago or Boston? Use the tool to check.", LLMEvaluator -> config]config1 = LLMConfiguration["Prompts" -> LLMPrompt["ELI5"]]config2 = LLMConfiguration[config1, "Tools" -> LLMTool[...]]范围 (12)
创建一个 "WolframAIAssistant" 配置,以访问优化过的提示词和工具:
LLMConfiguration["NotebookAssistant"]LLMSynthesize["plot a degree 2 polynomial in the complex plane", LLMEvaluator -> %]用 "AgentOne" 配置来访问 Agent One API:
LLMSynthesize["what is the tallest mountain?", "FormattedBoxes", LLMEvaluator -> LLMConfiguration["AgentOne"]]LLMConfiguration["MaxTokens" -> 10]LLMSynthesize["what is the tallest mountain ?", LLMEvaluator -> %]LLMConfiguration["Model" -> <|"Service" -> "Anthropic", "Name" -> "claude-haiku-4-5" |>]LLMSynthesize["What's the plural of mouse?", LLMEvaluator -> %]在向 LLM 提交之前,指定几个提示以及如何将它们连接在一起:
LLMConfiguration[<|"Prompts" -> {LLMPrompt["ELI5"], "Always answer with a single sentence"}, "PromptDelimiter" -> "
-----
" |>]LLMSynthesize["What's the plural of mouse?", "PromptText" , LLMEvaluator -> %]LLMConfiguration["Temperature" -> 0]Table[LLMSynthesize["What is the plural of mouse? One sentence.", LLMEvaluator -> %], 6]LLMConfiguration["TotalProbabilityCutoff" -> .2]LLMSynthesize["What's the plural of mouse?", LLMEvaluator -> %]LLMConfiguration[<|"TopProbabilities" -> 50, "Model" -> <|"Service" -> "Anthropic", "Name" -> "claude-haiku-4-5" |>|>]LLMSynthesize["What's the plural of mouse?", LLMEvaluator -> %]LLMConfiguration["StopTokens" -> {"mouse"}]LLMSynthesize["What's the plural of mouse?", LLMEvaluator -> %]LLMConfiguration["Tools" -> {LLMTool[{"altimeter", "gives the altitude at a location"}, {"where" -> "Location"}, GeoElevationData[#where]&], LLMTool[{"thermometer", "gives the current temperature at a location"}, {"where" -> "Location"}, AirTemperatureData[#where]&]}]ChatEvaluate[ChatObject[LLMEvaluator -> %], "what are Rome's altitude and the current temperature?"]config = LLMConfiguration[<|
"ToolMethod" -> "Service", "Tools" -> {LLMTool[{"altimeter", "gives the altitude at a location"}, {"where" -> "Location"}, GeoElevationData[#where]&], LLMTool[{"thermometer", "gives the current temperature at a location"}, {"where" -> "Location"}, AirTemperatureData[#where]&]}|>]ChatEvaluate[ChatObject[LLMEvaluator -> config], "what are Rome's altitude and the current temperature?"]config2 = LLMConfiguration[config, "ToolMethod" -> "Textual"]ChatEvaluate[ChatObject[LLMEvaluator -> config2], "what are Rome's altitude and the current temperature?"]LLMConfiguration[]可能存在的问题 (1)
未指定的属性将被设置为 $LLMEvaluator 指定的值:
$LLMEvaluator = LLMConfiguration[<|"Temperature" -> 0.5|>];
LLMConfiguration[<|"MaxTokens" -> 3, "TotalProbabilityCutoff" -> .2|>]["Temperature"]LLMConfiguration[LLMConfiguration[], <|"MaxTokens" -> 3, "TotalProbabilityCutoff" -> .2|>]["Temperature"]相关指南
-
▪
- 知识表示和访问 ▪
- LLM 相关的功能 ▪
- 神经网络 ▪
- Wolfram 系统设置 ▪
- 机器学习
文本
Wolfram Research (2023),LLMConfiguration,Wolfram 语言函数,https://reference.wolfram.com/language/ref/LLMConfiguration.html (更新于 2026 年).
CMS
Wolfram 语言. 2023. "LLMConfiguration." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2026. https://reference.wolfram.com/language/ref/LLMConfiguration.html.
APA
Wolfram 语言. (2023). LLMConfiguration. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/LLMConfiguration.html 年
BibTeX
@misc{reference.wolfram_2026_llmconfiguration, author="Wolfram Research", title="{LLMConfiguration}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/LLMConfiguration.html}", note=[Accessed: 17-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_llmconfiguration, organization={Wolfram Research}, title={LLMConfiguration}, year={2026}, url={https://reference.wolfram.com/language/ref/LLMConfiguration.html}, note=[Accessed: 17-June-2026]}