GenerateOptions
public class GenerateOptions
io/agentscope/core/model/GenerateOptions.java:32–903Generate 选项,保存相关配置项。位于 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.
Stringio/agentscope/core/model/GenerateOptions.java:108–110getBaseUrl
public String getBaseUrl()
获取基类 URL 用于 API 端点。
Gets the base URL for the API endpoint.
Stringio/agentscope/core/model/GenerateOptions.java:120–122getEndpointPath
public String getEndpointPath()
获取端点路径用于 API 请求。
Gets the endpoint path for the API request.
Stringio/agentscope/core/model/GenerateOptions.java:135–137getModelName
public String getModelName()
获取模型名称。
Gets the model name to use for generation.
Stringio/agentscope/core/model/GenerateOptions.java:147–149getStream
public Boolean getStream()
获取流。
Gets whether streaming mode is enabled.
Booleanio/agentscope/core/model/GenerateOptions.java:160–162getTemperature
public Double getTemperature()
获取 getTemperature。
Gets the temperature for text generation.
Doubleio/agentscope/core/model/GenerateOptions.java:172–174getTopP
public Double getTopP()
获取 getTopP。
Gets the top-p (nucleus sampling) parameter.
Doubleio/agentscope/core/model/GenerateOptions.java:184–186getMaxTokens
public Integer getMaxTokens()
获取最大令牌数。
Gets the maximum number of tokens to generate.
Integerio/agentscope/core/model/GenerateOptions.java:193–195getMaxCompletionTokens
public Integer getMaxCompletionTokens()
获取最大补全令牌数。
Gets the maximum number of completion tokens to generate.
Integerio/agentscope/core/model/GenerateOptions.java:207–209getFrequencyPenalty
public Double getFrequencyPenalty()
获取 getFrequencyPenalty。
Gets the frequency penalty.
Doubleio/agentscope/core/model/GenerateOptions.java:219–221getPresencePenalty
public Double getPresencePenalty()
获取 getPresencePenalty。
Gets the presence penalty.
Doubleio/agentscope/core/model/GenerateOptions.java:231–233getThinkingBudget
public Integer getThinkingBudget()
获取 getThinkingBudget。
Gets the maximum number of tokens for reasoning/thinking content.
Integerio/agentscope/core/model/GenerateOptions.java:244–246getReasoningEffort
public String getReasoningEffort()
获取 getReasoningEffort。
Gets the reasoning effort level for o1 models.
Stringio/agentscope/core/model/GenerateOptions.java:256–258getExecutionConfig
public ExecutionConfig getExecutionConfig()
获取执行配置用于超时和重试行为。
Gets the execution configuration for timeout and retry behavior.
ExecutionConfigio/agentscope/core/model/GenerateOptions.java:268–270getToolChoice
public ToolChoice getToolChoice()
获取工具选项。
Gets the tool choice configuration for controlling how the model uses tools.
ToolChoiceio/agentscope/core/model/GenerateOptions.java:281–283getTopK
public Integer getTopK()
获取 getTopK。
Gets the top-k sampling parameter.
Integerio/agentscope/core/model/GenerateOptions.java:293–295getSeed
public Long getSeed()
获取预置。
Gets the random seed for deterministic generation.
Longio/agentscope/core/model/GenerateOptions.java:305–307getCacheControl
public Boolean getCacheControl()
获取 getCacheControl。
Gets whether cache control is enabled for prompt caching.
Booleanio/agentscope/core/model/GenerateOptions.java:324–326getParallelToolCalls
public Boolean getParallelToolCalls()
获取 getParallelToolCalls。
Gets whether parallel tool calls are enabled.
Booleanio/agentscope/core/model/GenerateOptions.java:335–337getResponseFormat
public ResponseFormat getResponseFormat()
获取响应格式用于结构化输出。
Gets the response format for structured output.
ResponseFormatio/agentscope/core/model/GenerateOptions.java:348–350getAdditionalHeaders
public Map<String, String> getAdditionalHeaders()
获取 getAdditionalHeaders。
Gets the additional HTTP headers to include in API requests.
Map<String, String>io/agentscope/core/model/GenerateOptions.java:360–362getAdditionalBodyParams
public Map<String, Object> getAdditionalBodyParams()
获取 getAdditionalBodyParams。
Gets the additional parameters to include in the request body.
Map<String, Object>io/agentscope/core/model/GenerateOptions.java:372–374getAdditionalQueryParams
public Map<String, String> getAdditionalQueryParams()
获取 getAdditionalQueryParams。
Gets the additional query parameters to include in API requests.
Map<String, String>io/agentscope/core/model/GenerateOptions.java:383–385builder
public static Builder builder()
创建新的构建器用于 GenerateOptions。
Creates a new builder for GenerateOptions.
Builderio/agentscope/core/model/GenerateOptions.java:392–394mergeOptions
public static GenerateOptions mergeOptions(GenerateOptions primary, GenerateOptions fallback)
合并选项。
Merges two GenerateOptions instances, with primary options taking precedence.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
primary | GenerateOptions | primary(类型 `GenerateOptions`)。the primary options (higher priority) |
fallback | GenerateOptions | 回退(类型 `GenerateOptions`)。the fallback options (lower priority) |
GenerateOptionsio/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.