AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:253–387

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

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

方法摘要Method Summary

方法Method说明Description
public Builder apiKey(String apiKey)
设置API 键。
Performs the api key operation.
public Builder baseUrl(String baseUrl)
设置基类 URL。
Performs the base url operation.
public Builder modelName(String modelName)
设置模型名称。
Performs the model name operation.
public Builder stream(boolean stream)
设置流。
Performs the stream operation.
public Builder generateOptions(GenerateOptions generateOptions)
设置该配置项。
Performs the generate options operation.
public Builder contextWindowSize(int contextWindowSize)
设置该配置项。
Performs the context window size operation.
public Builder strictTools(Boolean strictTools)
设置该配置项。
Performs the strict tools operation.
public Builder strictJsonSchema(Boolean strictJsonSchema)
设置该配置项。
Performs the strict json schema operation.
public Builder formatter(ResponsesMultiAgentFormatter formatter)
设置格式化器。
Performs the formatter operation.
public Builder additionalHeaders(Map<String, String> headers)
设置该参数。
Performs the additional headers operation.
public Builder proxy(ProxyConfig proxyConfig)
设置代理。
Performs the proxy operation.
public OpenAIResponsesChatModel build()
构建并返回最终实例。
Creates and returns an instance.

方法详情Method Detail

apiKey

public Builder apiKey(String apiKey)

设置API 键。

Performs the api key operation.

参数Parameters
名称Name类型Type说明Description
apiKeyStringAPI 键(类型 `String`)。The api key.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:266–269

baseUrl

public Builder baseUrl(String baseUrl)

设置基类 URL。

Performs the base url operation.

参数Parameters
名称Name类型Type说明Description
baseUrlString基类 URL(类型 `String`)。The base url.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:271–274

modelName

public Builder modelName(String modelName)

设置模型名称。

Performs the model name operation.

参数Parameters
名称Name类型Type说明Description
modelNameString模型名称(类型 `String`)。The model name.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:276–279

stream

public Builder stream(boolean stream)

设置流。

Performs the stream operation.

参数Parameters
名称Name类型Type说明Description
streamboolean流(类型 `boolean`)。The stream.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:281–284

generateOptions

public Builder generateOptions(GenerateOptions generateOptions)

设置该配置项。

Performs the generate options operation.

参数Parameters
名称Name类型Type说明Description
generateOptionsGenerateOptionsgenerate 选项(类型 `GenerateOptions`)。The generate options.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:286–289

contextWindowSize

public Builder contextWindowSize(int contextWindowSize)

设置该配置项。

Performs the context window size operation.

参数Parameters
名称Name类型Type说明Description
contextWindowSizeint上下文 Window 大小(类型 `int`)。The context window size.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:291–294

strictTools

public Builder strictTools(Boolean strictTools)

设置该配置项。

Performs the strict tools operation.

参数Parameters
名称Name类型Type说明Description
strictToolsBooleanstrict 工具(类型 `Boolean`)。The strict tools.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:296–299

strictJsonSchema

public Builder strictJsonSchema(Boolean strictJsonSchema)

设置该配置项。

Performs the strict json schema operation.

参数Parameters
名称Name类型Type说明Description
strictJsonSchemaBooleanstrict JSON 模式(类型 `Boolean`)。The strict json schema.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:301–304

formatter

public Builder formatter(ResponsesMultiAgentFormatter formatter)

设置格式化器。

Performs the formatter operation.

参数Parameters
名称Name类型Type说明Description
formatterResponsesMultiAgentFormatter格式化器(类型 `ResponsesMultiAgentFormatter`)。The formatter.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:306–309

additionalHeaders

public Builder additionalHeaders(Map<String, String> headers)

设置该参数。

Performs the additional headers operation.

参数Parameters
名称Name类型Type说明Description
headersMap<String, String>请求头(类型 `Map`)。The headers.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:311–314

proxy

public Builder proxy(ProxyConfig proxyConfig)

设置代理。

Performs the proxy operation.

参数Parameters
名称Name类型Type说明Description
proxyConfigProxyConfig代理配置(类型 `ProxyConfig`)。The proxy config.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:316–319

build

public OpenAIResponsesChatModel build()

构建并返回最终实例。

Creates and returns an instance.

返回Returns OpenAIResponsesChatModel
返回OpenAIResponsesChatModel。Returns openairesponse s chat model.
源码Source io/agentscope/extensions/model/openaiofficial/OpenAIResponsesChatModel.java:321–386
基于官方固定版本源码静态生成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.