AS AgentScopeAPI 手册 / API Reference

AnthropicResponseParser

public class AnthropicResponseParser
源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicResponseParser.java:42–285

Anthropic 响应解析器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.anthropic.formatter 包。核心成员包括 parseMessage、parseStreamEvents。

Parses Anthropic API responses (both streaming and non-streaming) into AgentScope ChatResponse objects.

方法摘要Method Summary

方法Method说明Description
public static ChatResponse parseMessage(Message message, Instant startTime)
static
解析消息。
Parse non-streaming Anthropic Message to ChatResponse.
public static Flux<ChatResponse> parseStreamEvents(Flux<RawMessageStreamEvent> eventFlux, Instant startTime)
static
解析流事件。
Parse streaming Anthropic events to ChatResponse Flux.

方法详情Method Detail

parseMessage

public static ChatResponse parseMessage(Message message, Instant startTime)
static

解析消息。

Parse non-streaming Anthropic Message to ChatResponse.

参数Parameters
名称Name类型Type说明Description
messageMessage消息(类型 `Message`)。The message.
startTimeInstant启动时间(类型 `Instant`)。The start time.
返回Returns ChatResponse
返回ChatResponse。Returns chat response.
源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicResponseParser.java:49–109

parseStreamEvents

public static Flux<ChatResponse> parseStreamEvents(Flux<RawMessageStreamEvent> eventFlux, Instant startTime)
static

解析流事件。

Parse streaming Anthropic events to ChatResponse Flux.

参数Parameters
名称Name类型Type说明Description
eventFluxFlux<RawMessageStreamEvent>事件 Flux(类型 `Flux`)。The event flux.
startTimeInstant启动时间(类型 `Instant`)。The start time.
返回Returns Flux<ChatResponse>
返回Flux。Returns flux.
源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicResponseParser.java:124–148
基于官方固定版本源码静态生成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.