AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:199–352

HttpTransportConfig的构建器。位于 io.agentscope.core.model.transport 包。核心成员包括 connectTimeout、responseTimeout、streamIdleTimeout、readTimeout、writeTimeout、maxIdleConnections。

Builder for HttpTransportConfig.

方法摘要Method Summary

方法Method说明Description
public Builder connectTimeout(Duration connectTimeout)
设置连接超时。
Set the connect timeout.
public Builder responseTimeout(Duration responseTimeout)
设置响应超时。
Set the response timeout for streaming requests.
public Builder streamIdleTimeout(Duration streamIdleTimeout)
设置该配置项。
Set the stream idle timeout.
public Builder readTimeout(Duration readTimeout)
设置读取超时。
Set the read timeout.
public Builder writeTimeout(Duration writeTimeout)
设置写入超时。
Set the write timeout.
public Builder maxIdleConnections(int maxIdleConnections)
设置该配置项。
Set the maximum number of idle connections in the pool.
public Builder keepAliveDuration(Duration keepAliveDuration)
设置该配置项。
Set the keep-alive duration for idle connections.
public Builder ignoreSsl(boolean ignoreSsl)
设置该配置项。
Set whether to ignore SSL certificate verification.
public Builder proxy(ProxyConfig proxyConfig)
设置代理配置。
Set the proxy configuration.
public Builder httpVersion(HttpVersion httpVersion)
设置HTTP 版本。
Set the HTTP version, or null for automatic resolution (the default): cleartext requests use HTTP/1.1, https requests use HTTP/2 via ALPN.
public HttpTransportConfig build()
构建HttpTransportConfig。
Build the HttpTransportConfig.

方法详情Method Detail

connectTimeout

public Builder connectTimeout(Duration connectTimeout)

设置连接超时。

Set the connect timeout.

参数Parameters
名称Name类型Type说明Description
connectTimeoutDuration连接超时时长。the connect timeout duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:217–220

responseTimeout

public Builder responseTimeout(Duration responseTimeout)

设置响应超时。

Set the response timeout for streaming requests.

参数Parameters
名称Name类型Type说明Description
responseTimeoutDuration响应超时时长。the response timeout duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:232–235

streamIdleTimeout

public Builder streamIdleTimeout(Duration streamIdleTimeout)

设置该配置项。

Set the stream idle timeout.

参数Parameters
名称Name类型Type说明Description
streamIdleTimeoutDuration流 Idle 超时(类型 `Duration`)。the stream idle timeout duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:247–250

readTimeout

public Builder readTimeout(Duration readTimeout)

设置读取超时。

Set the read timeout.

参数Parameters
名称Name类型Type说明Description
readTimeoutDuration读取超时时长。the read timeout duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:263–266

writeTimeout

public Builder writeTimeout(Duration writeTimeout)

设置写入超时。

Set the write timeout.

参数Parameters
名称Name类型Type说明Description
writeTimeoutDuration写入超时时长。the write timeout duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:274–277

maxIdleConnections

public Builder maxIdleConnections(int maxIdleConnections)

设置该配置项。

Set the maximum number of idle connections in the pool.

参数Parameters
名称Name类型Type说明Description
maxIdleConnectionsint最大 Idle Connections(类型 `int`)。the max idle connections
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:285–288

keepAliveDuration

public Builder keepAliveDuration(Duration keepAliveDuration)

设置该配置项。

Set the keep-alive duration for idle connections.

参数Parameters
名称Name类型Type说明Description
keepAliveDurationDurationkeep Alive 时长(类型 `Duration`)。the keep-alive duration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:296–299

ignoreSsl

public Builder ignoreSsl(boolean ignoreSsl)

设置该配置项。

Set whether to ignore SSL certificate verification.

参数Parameters
名称Name类型Type说明Description
ignoreSslbooleanignore Ssl(类型 `boolean`)。true to ignore SSL certificate verification, false otherwise
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:311–314

proxy

public Builder proxy(ProxyConfig proxyConfig)

设置代理配置。

Set the proxy configuration.

参数Parameters
名称Name类型Type说明Description
proxyConfigProxyConfig代理配置。the proxy configuration
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:324–327

httpVersion

public Builder httpVersion(HttpVersion httpVersion)

设置HTTP 版本。

Set the HTTP version, or null for automatic resolution (the default): cleartext requests use HTTP/1.1, https requests use HTTP/2 via ALPN.

参数Parameters
名称Name类型Type说明Description
httpVersionHttpVersionHTTP 版本(类型 `HttpVersion`)。the HTTP version, or null for auto
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:339–342

build

public HttpTransportConfig build()

构建HttpTransportConfig。

Build the HttpTransportConfig.

返回Returns HttpTransportConfig
一种新的HttpTransportConfig 实例。a new HttpTransportConfig instance
源码Source io/agentscope/core/model/transport/HttpTransportConfig.java:349–351
基于官方固定版本源码静态生成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.