The whole hunk
from line 110, old and new numbered
/
lines
from line 110
110110
111111 // The response contains summarized thinking blocks and text blocks
112112 for (const block of response.content) {
113 if (block.type === "thinking") {
114 console.log(`\nThinking summary: ${block.thinking}`);
115 } else if (block.type === "text") {
116 console.log(`\nResponse: ${block.text}`);
113 switch (block.type) {
114 case "thinking":
115 console.log(`\nThinking summary: ${block.thinking}`);
116 break;
117 case "text":
118 console.log(`\nResponse: ${block.text}`);
119 break;
117120 }
118121 }
119122 ```
from line 225
222225
223226 // The response contains summarized thinking blocks and text blocks
224227 foreach ($response->content as $block) {
225 echo match ($block->type) {
226 'thinking' => "\nThinking summary: {$block->thinking}",
227 'text' => "\nResponse: {$block->text}",
228 echo match (true) {
229 $block instanceof \Anthropic\Messages\ThinkingBlock => "\nThinking summary: {$block->thinking}",
230 $block instanceof \Anthropic\Messages\TextBlock => "\nResponse: {$block->text}",
228231 default => '',
229232 };
230233 }
from line 254
251254 # The response contains summarized thinking blocks and text blocks
252255 response.content.each do |block|
253256 case block
254 in {type: :thinking, thinking:}
255 puts "\nThinking summary: #{thinking}"
256 in {type: :text, text:}
257 puts "\nResponse: #{text}"
258 else
257 when Anthropic::Models::ThinkingBlock
258 puts "\nThinking summary: #{block.thinking}"
259 when Anthropic::Models::TextBlock
260 puts "\nResponse: #{block.text}"
259261 end
260262 end
261263 ```