Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ private List<ContentBlock> parseContentBlocks(JsonNode arrayNode) throws Message
case "text" -> parseTextBlock(blockNode);
case "tool_use" -> parseToolUseBlock(blockNode);
case "tool_result" -> parseToolResultBlock(blockNode);
case "thinking" -> parseThinkingBlock(blockNode);
default -> throw new MessageParseException("Unknown content block type: " + type);
};

Expand Down Expand Up @@ -226,6 +227,15 @@ else if (content instanceof List) {
return builder.build();
}

private ThinkingBlock parseThinkingBlock(JsonNode node) throws MessageParseException {
String thinking = getStringField(node, "thinking");
if (thinking == null) {
throw new MessageParseException("Missing 'thinking' field in thinking block");
}
String signature = getStringField(node, "signature");
return ThinkingBlock.of(thinking, signature);
}

private Map<String, Object> parseDataMap(JsonNode node) {
Map<String, Object> map = new HashMap<>();
node.fields().forEachRemaining(entry -> {
Expand Down