AS AgentScopeAPI 手册 / API Reference

GenerateOptions

public class GenerateOptions
源码Source io/agentscope/core/model/GenerateOptions.java:32–903

Generate 选项,保存相关配置项。位于 io.agentscope.core.model 包。核心成员包括 getApiKey、getBaseUrl、getEndpointPath、getModelName、getStream、getTemperature。

Immutable generation options for LLM models. Use the builder pattern to construct instances.

This class holds both per-request generation parameters (temperature, maxTokens, etc.) and connection-level configuration (apiKey, baseUrl, modelName, stream).

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
A class in io.agentscope.core.model that talks to model services and returns generated or embedded output.

方法摘要Method Summary

方法Method说明Description
public String getApiKey()
获取API 键。
Gets the API key for authentication.
public String getBaseUrl()
获取基类 URL 用于 API 端点。
Gets the base URL for the API endpoint.
public String getEndpointPath()
获取端点路径用于 API 请求。
Gets the endpoint path for the API request.
public String getModelName()
获取模型名称。
Gets the model name to use for generation.
public Boolean getStream()
获取流。
Gets whether streaming mode is enabled.
public Double getTemperature()
获取 `getTemperature`。
Gets the temperature for text generation.
public Double getTopP()
获取 `getTopP`。
Gets the top-p (nucleus sampling) parameter.
public Integer getMaxTokens()
获取最大令牌数。
Gets the maximum number of tokens to generate.
public Integer getMaxCompletionTokens()
获取最大补全令牌数。
Gets the maximum number of completion tokens to generate.
public Double getFrequencyPenalty()
获取 `getFrequencyPenalty`。
Gets the frequency penalty.
public Double getPresencePenalty()
获取 `getPresencePenalty`。
Gets the presence penalty.
public Integer getThinkingBudget()
获取 `getThinkingBudget`。
Gets the maximum number of tokens for reasoning/thinking content.
public String getReasoningEffort()
获取 `getReasoningEffort`。
Gets the reasoning effort level for o1 models.
public ExecutionConfig getExecutionConfig()
获取执行配置用于超时和重试行为。
Gets the execution configuration for timeout and retry behavior.
public ToolChoice getToolChoice()
获取工具选项。
Gets the tool choice configuration for controlling how the model uses tools.
public Integer getTopK()
获取 `getTopK`。
Gets the top-k sampling parameter.
public Long getSeed()
获取预置。
Gets the random seed for deterministic generation.
public Boolean getCacheControl()
获取 `getCacheControl`。
Gets whether cache control is enabled for prompt caching.
public Boolean getParallelToolCalls()
获取 `getParallelToolCalls`。
Gets whether parallel tool calls are enabled.
public ResponseFormat getResponseFormat()
获取响应格式用于结构化输出。
Gets the response format for structured output.
public Map<String, String> getAdditionalHeaders()
获取 `getAdditionalHeaders`。
Gets the additional HTTP headers to include in API requests.
public Map<String, Object> getAdditionalBodyParams()
获取 `getAdditionalBodyParams`。
Gets the additional parameters to include in the request body.
public Map<String, String> getAdditionalQueryParams()
获取 `getAdditionalQueryParams`。
Gets the additional query parameters to include in API requests.
public static Builder builder()
static
创建新的构建器用于 GenerateOptions。
Creates a new builder for GenerateOptions.
public static GenerateOptions mergeOptions(GenerateOptions primary, GenerateOptions fallback)
static
合并选项。
Merges two GenerateOptions instances, with primary options taking precedence.

方法详情Method Detail

getApiKey

public String getApiKey()

获取API 键。

Gets the API key for authentication.

返回Returns String
返回字符串结果。the API key, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:108–110

getBaseUrl

public String getBaseUrl()

获取基类 URL 用于 API 端点。

Gets the base URL for the API endpoint.

返回Returns String
返回字符串结果。the base URL, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:120–122

getEndpointPath

public String getEndpointPath()

获取端点路径用于 API 请求。

Gets the endpoint path for the API request.

返回Returns String
返回字符串结果。the endpoint path, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:135–137

getModelName

public String getModelName()

获取模型名称。

Gets the model name to use for generation.

返回Returns String
返回字符串结果。the model name, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:147–149

getStream

public Boolean getStream()

获取流。

Gets whether streaming mode is enabled.

返回Returns Boolean
返回布尔值,表示判断结果。true for streaming, false for non-streaming, null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:160–162

getTemperature

public Double getTemperature()

获取 getTemperature。

Gets the temperature for text generation.

返回Returns Double
返回数值结果。the temperature value between 0 and 2, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:172–174

getTopP

public Double getTopP()

获取 getTopP。

Gets the top-p (nucleus sampling) parameter.

返回Returns Double
返回数值结果。the top-p value between 0 and 1, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:184–186

getMaxTokens

public Integer getMaxTokens()

获取最大令牌数。

Gets the maximum number of tokens to generate.

返回Returns Integer
返回数值结果。the maximum tokens limit, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:193–195

getMaxCompletionTokens

public Integer getMaxCompletionTokens()

获取最大补全令牌数。

Gets the maximum number of completion tokens to generate.

返回Returns Integer
返回数值结果。the maximum completion tokens limit, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:207–209

getFrequencyPenalty

public Double getFrequencyPenalty()

获取 getFrequencyPenalty。

Gets the frequency penalty.

返回Returns Double
返回数值结果。the frequency penalty between -2 and 2, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:219–221

getPresencePenalty

public Double getPresencePenalty()

获取 getPresencePenalty。

Gets the presence penalty.

返回Returns Double
返回数值结果。the presence penalty between -2 and 2, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:231–233

getThinkingBudget

public Integer getThinkingBudget()

获取 getThinkingBudget。

Gets the maximum number of tokens for reasoning/thinking content.

返回Returns Integer
返回数值结果。the thinking budget in tokens, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:244–246

getReasoningEffort

public String getReasoningEffort()

获取 getReasoningEffort。

Gets the reasoning effort level for o1 models.

返回Returns String
返回字符串结果。the reasoning effort level, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:256–258

getExecutionConfig

public ExecutionConfig getExecutionConfig()

获取执行配置用于超时和重试行为。

Gets the execution configuration for timeout and retry behavior.

返回Returns ExecutionConfig
返回ExecutionConfig。the execution configuration, or null if not configured
源码Source io/agentscope/core/model/GenerateOptions.java:268–270

getToolChoice

public ToolChoice getToolChoice()

获取工具选项。

Gets the tool choice configuration for controlling how the model uses tools.

另见See also @see ToolChoice
返回Returns ToolChoice
返回ToolChoice。the tool choice configuration, or null if not set (defaults to auto)
源码Source io/agentscope/core/model/GenerateOptions.java:281–283

getTopK

public Integer getTopK()

获取 getTopK。

Gets the top-k sampling parameter.

返回Returns Integer
返回数值结果。the top-k value, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:293–295

getSeed

public Long getSeed()

获取预置。

Gets the random seed for deterministic generation.

返回Returns Long
返回数值结果。the seed value, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:305–307

getCacheControl

public Boolean getCacheControl()

获取 getCacheControl。

Gets whether cache control is enabled for prompt caching.

返回Returns Boolean
返回布尔值,表示判断结果。true if cache control is enabled, false or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:324–326

getParallelToolCalls

public Boolean getParallelToolCalls()

获取 getParallelToolCalls。

Gets whether parallel tool calls are enabled.

返回Returns Boolean
返回布尔值,表示判断结果。true if parallel tool calls are enabled, false or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:335–337

getResponseFormat

public ResponseFormat getResponseFormat()

获取响应格式用于结构化输出。

Gets the response format for structured output.

返回Returns ResponseFormat
返回ResponseFormat。the response format, or null if not set
源码Source io/agentscope/core/model/GenerateOptions.java:348–350

getAdditionalHeaders

public Map<String, String> getAdditionalHeaders()

获取 getAdditionalHeaders。

Gets the additional HTTP headers to include in API requests.

返回Returns Map<String, String>
返回映射。an unmodifiable map of additional headers, empty if none set
源码Source io/agentscope/core/model/GenerateOptions.java:360–362

getAdditionalBodyParams

public Map<String, Object> getAdditionalBodyParams()

获取 getAdditionalBodyParams。

Gets the additional parameters to include in the request body.

返回Returns Map<String, Object>
返回映射。an unmodifiable map of additional body parameters, empty if none set
源码Source io/agentscope/core/model/GenerateOptions.java:372–374

getAdditionalQueryParams

public Map<String, String> getAdditionalQueryParams()

获取 getAdditionalQueryParams。

Gets the additional query parameters to include in API requests.

返回Returns Map<String, String>
返回映射。an unmodifiable map of additional query parameters, empty if none set
源码Source io/agentscope/core/model/GenerateOptions.java:383–385

builder

public static Builder builder()
static

创建新的构建器用于 GenerateOptions。

Creates a new builder for GenerateOptions.

返回Returns Builder
一种新的构建器实例。a new Builder instance
源码Source io/agentscope/core/model/GenerateOptions.java:392–394

mergeOptions

public static GenerateOptions mergeOptions(GenerateOptions primary, GenerateOptions fallback)
static

合并选项。

Merges two GenerateOptions instances, with primary options taking precedence.

参数Parameters
名称Name类型Type说明Description
primaryGenerateOptionsprimary(类型 `GenerateOptions`)。the primary options (higher priority)
fallbackGenerateOptions回退(类型 `GenerateOptions`)。the fallback options (lower priority)
返回Returns GenerateOptions
返回GenerateOptions。merged options, or null if both are null
源码Source io/agentscope/core/model/GenerateOptions.java:439–502

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.model 包。核心成员包括 apiKey、baseUrl、endpointPath、modelName、stream、temperature。

A class in io.agentscope.core.model that talks to model services and returns generated or embedded output. Declared in io.agentscope.core.model.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.