The whole hunk
from line 144, old and new numbered
/
lines
from line 144
144144
145145 // The response contains summarized thinking blocks and text blocks
146146 for (const block of response.content) {
147 if (block.type === "thinking") {
148 console.log(`\nThinking summary: ${block.thinking}`);
149 } else if (block.type === "text") {
150 console.log(`\nResponse: ${block.text}`);
147 switch (block.type) {
148 case "thinking":
149 console.log(`\nThinking summary: ${block.thinking}`);
150 break;
151 case "text":
152 console.log(`\nResponse: ${block.text}`);
153 break;
151154 }
152155 }
153156 ```
from line 258
255258 ```
256259
257260 ```php PHP
261 use Anthropic\Messages\TextBlock;
262 use Anthropic\Messages\ThinkingBlock;
263
258264 $client = new Client();
259265
260266 $response = $client->messages->create(
from line 278
272278
273279 // The response contains summarized thinking blocks and text blocks
274280 foreach ($response->content as $block) {
275 echo match ($block->type) {
276 'thinking' => "\nThinking summary: {$block->thinking}",
277 'text' => "\nResponse: {$block->text}",
281 echo match (true) {
282 $block instanceof ThinkingBlock => "\nThinking summary: {$block->thinking}",
283 $block instanceof TextBlock => "\nResponse: {$block->text}",
278284 default => '',
279285 };
280286 }
from line 305
299305 # The response contains summarized thinking blocks and text blocks
300306 response.content.each do |block|
301307 case block
302 in {type: :thinking, thinking:}
303 puts "\nThinking summary: #{thinking}"
304 in {type: :text, text:}
305 puts "\nResponse: #{text}"
306 else
308 when Anthropic::Models::ThinkingBlock
309 puts "\nThinking summary: #{block.thinking}"
310 when Anthropic::Models::TextBlock
311 puts "\nResponse: #{block.text}"
307312 end
308313 end
309314 ```
from line 396
391396
392397 // The response contains summarized thinking blocks and text blocks
393398 for (const block of response.content) {
394 if (block.type === "thinking") {
395 console.log(`\nThinking summary: ${block.thinking}`);
396 } else if (block.type === "text") {
397 console.log(`\nResponse: ${block.text}`);
399 switch (block.type) {
400 case "thinking":
401 console.log(`\nThinking summary: ${block.thinking}`);
402 break;
403 case "text":
404 console.log(`\nResponse: ${block.text}`);
405 break;
398406 }
399407 }
400408 ```
from line 511
503511
504512 // The response contains summarized thinking blocks and text blocks
505513 foreach ($response->content as $block) {
506 echo match ($block->type) {
507 'thinking' => "\nThinking summary: {$block->thinking}",
508 'text' => "\nResponse: {$block->text}",
514 echo match (true) {
515 $block instanceof \Anthropic\Messages\ThinkingBlock => "\nThinking summary: {$block->thinking}",
516 $block instanceof \Anthropic\Messages\TextBlock => "\nResponse: {$block->text}",
509517 default => '',
510518 };
511519 }
from line 540
532540 # The response contains summarized thinking blocks and text blocks
533541 response.content.each do |block|
534542 case block
535 in {type: :thinking, thinking:}
536 puts "\nThinking summary: #{thinking}"
537 in {type: :text, text:}
538 puts "\nResponse: #{text}"
539 else
543 when Anthropic::Models::ThinkingBlock
544 puts "\nThinking summary: #{block.thinking}"
545 when Anthropic::Models::TextBlock
546 puts "\nResponse: #{block.text}"
540547 end
541548 end
542549 ```