WebSocketRequest
public final class WebSocketRequest
源码Source
io/agentscope/core/model/transport/websocket/WebSocketRequest.java:37–139WebSocket 请求,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.core.model.transport.websocket 包。核心成员包括 getUrl、getHeaders、getConnectTimeout、builder。
WebSocket connection request configuration.
Usage example:
`WebSocketRequest request = WebSocketRequest.builder("wss://api.openai.com/v1/realtime")
.header("Authorization", "Bearer " + apiKey)
.header("OpenAI-Beta", "realtime=v1")
.connectTimeout(Duration.ofSeconds(30))
.build();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | WebSocketRequest的构建器。 Builder for WebSocketRequest. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getUrl() | 获取WebSocket URL。 Get the WebSocket URL. |
public Map<String, String> getHeaders() | 获取请求请求头。 Get the request headers. |
public Duration getConnectTimeout() | 获取连接超时。 Get the connection timeout. |
public static Builder builder(String url)static | 返回构建器实例。 Create a new builder with the specified URL. |
方法详情Method Detail
getUrl
public String getUrl()
获取WebSocket URL。
Get the WebSocket URL.
String返回字符串结果。WebSocket URL
源码Source
io/agentscope/core/model/transport/websocket/WebSocketRequest.java:54–56getHeaders
public Map<String, String> getHeaders()
获取请求请求头。
Get the request headers.
Map<String, String>返回映射。Request headers (immutable)
源码Source
io/agentscope/core/model/transport/websocket/WebSocketRequest.java:63–65getConnectTimeout
public Duration getConnectTimeout()
获取连接超时。
Get the connection timeout.
Duration返回时长。Connection timeout
源码Source
io/agentscope/core/model/transport/websocket/WebSocketRequest.java:72–74builder
public static Builder builder(String url)
static
返回构建器实例。
Create a new builder with the specified URL.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
url | String | 服务地址(类型 `String`)。WebSocket URL |
Builder返回当前实例,以支持链式调用。Builder instance
源码Source
io/agentscope/core/model/transport/websocket/WebSocketRequest.java:82–84嵌套类详情Nested Class Detail
Builder
public static class BuilderWebSocketRequest的构建器。位于 io.agentscope.core.model.transport.websocket 包。核心成员包括 header、headers、connectTimeout、build。
Builder for WebSocketRequest.