Class DashScopeResponseParser
java.lang.Object
io.agentscope.extensions.model.dashscope.formatter.DashScopeResponseParser
Parses DashScope API responses to AgentScope ChatResponse.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringPlaceholder name for tool call argument fragments in streaming responses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToolCallsFromMessage(DashScopeMessage message, List<io.agentscope.core.message.ContentBlock> blocks) Parse tool calls from DashScopeMessage and add to blocks.io.agentscope.core.model.ChatResponseparseResponse(DashScopeResponse response, Instant startTime) Parse DashScopeResponse to AgentScope ChatResponse.
-
Field Details
-
FRAGMENT_PLACEHOLDER
Placeholder name for tool call argument fragments in streaming responses.- See Also:
-
-
Constructor Details
-
DashScopeResponseParser
public DashScopeResponseParser()
-
-
Method Details
-
parseResponse
public io.agentscope.core.model.ChatResponse parseResponse(DashScopeResponse response, Instant startTime) Parse DashScopeResponse to AgentScope ChatResponse.- Parameters:
response- DashScope response DTOstartTime- Request start time for calculating duration- Returns:
- AgentScope ChatResponse
-
addToolCallsFromMessage
protected void addToolCallsFromMessage(DashScopeMessage message, List<io.agentscope.core.message.ContentBlock> blocks) Parse tool calls from DashScopeMessage and add to blocks.- Parameters:
message- DashScopeMessageblocks- Content blocks to add tool use blocks to
-