Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

structured-outputs changedbuild-with-claude/structured-outputs

Nearest release: v2.1.309, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+56added
Lines−46removed
From line 29 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits22to this page, all time

The whole hunk

from line 29, old and new numbered
/
lines
from line 29
2929 Claude API: ga
3030 Claude Platform on AWS: ga
3131 Amazon Bedrock: ga
32 Google Cloud: ga
32 Claude Models on Google Cloud (Google managed): ga
3333 Microsoft Foundry: ga
3434---
3535 
from line 260
260260 {
261261 Model = Model.ClaudeOpus5_5,
262262 MaxTokens = 1024,
263 Messages = [new UserMessageParam {
264 Content = "Extract the key information from this email: "
265 + "John Smith ([email protected]) is interested in our Enterprise plan "
266 + "and wants to schedule a demo for next Tuesday at 2pm."
267 }],
263 Messages = [
264 new UserMessageParam
265 {
266 Content = "Extract the key information from this email: "
267 + "John Smith ([email protected]) is interested in our Enterprise plan "
268 + "and wants to schedule a demo for next Tuesday at 2pm."
269 }
270 ],
268271 });
269272 
270273 if (response.Content.Select(block => block.Parsed()).OfType<ContactInfo>().FirstOrDefault() is { } contact)
from line 395
392395 
393396 * **Local validation** occurs without sending requests to the remote AI model.
394397 * **Remote validation** is also performed by the AI model upon receiving the JSON schema.
395 * **Version compatibility:** Local validation might fail while remote validation succeeds if the SDK version is outdated.
398 * **Version compatibility:** If the SDK version is outdated, local validation might reject a schema that remote validation accepts.
396399 * **Disabling local validation:** Pass `JsonSchemaLocalValidation.NO` if you encounter compatibility issues:
397400 
398401 ```java
from line 463
460463 
461464 The JSON output has this nested structure:
462465 
463 ```json
466 ```text Output wrap
464467 {
465468 "composedA": { "a": "hello" },
466469 "composedB": { "b": "world" }
from line 484
481484 
482485 The JSON output has this flat structure:
483486 
484 ```json
487 ```text Output wrap
485488 {
486489 "a": "hello",
487490 "b": "world"
from line 502
499502 
500503 static class Person {
501504 
502 @JsonPropertyDescription("The first name and surname of the person")
503 public String name;
505 @JsonPropertyDescription("The first name and surname of the person")
506 public String name;
504507 
505 public int birthYear;
508 public int birthYear;
506509 
507 @JsonPropertyDescription("The year the person died, or 'present' if the person is living.")
508 public String deathYear;
510 @JsonPropertyDescription("The year the person died, or 'present' if the person is living.")
511 public String deathYear;
509512 }
510513 
511514 @JsonClassDescription("The details of one published book")
512515 static class Book {
513516 
514 public String title;
515 public Person author;
517 public String title;
518 public Person author;
516519 
517 @JsonPropertyDescription("The year in which the book was first published.")
518 public int publicationYear;
520 @JsonPropertyDescription("The year in which the book was first published.")
521 public int publicationYear;
519522 
520 @JsonIgnore
521 public String genre;
523 @JsonIgnore
524 public String genre;
522525 }
523526 
524527 static class BookList {
525 public List<Book> books;
528 public List<Book> books;
526529 }
527530 ```
528531 
from line 546
543546 
544547 static class Article {
545548 
546 @ArraySchema(minItems = 1)
547 public List<String> authors;
549 @ArraySchema(minItems = 1)
550 public List<String> authors;
548551 
549 public String title;
552 public String title;
550553 
551 @Schema(format = "date")
552 public String publicationDate;
554 @Schema(format = "date")
555 public String publicationDate;
553556 
554 public int pageCount;
557 public int pageCount;
555558 }
556559 ```
557560 
from line 943
940943 {
941944 Model = Model.ClaudeOpus5_5,
942945 MaxTokens = 1024,
943 Messages = [new UserMessageParam {
944 Content = "Extract the key information from this email: "
945 + "John Smith ([email protected]) is interested in our Enterprise plan "
946 + "and wants to schedule a demo for next Tuesday at 2pm."
947 }],
946 Messages = [
947 new UserMessageParam
948 {
949 Content = "Extract the key information from this email: "
950 + "John Smith ([email protected]) is interested in our Enterprise plan "
951 + "and wants to schedule a demo for next Tuesday at 2pm."
952 }
953 ],
948954 OutputConfig = new OutputConfig
949955 {
950956 Format = new JsonOutputFormat
from line 973
967973 },
968974 });
969975 
970 if (response.Content.Select(b => b.Value).OfType<TextBlock>().FirstOrDefault() is { } textBlock)
976 if (response.Content.Select(block => block.Value).OfType<TextBlock>().FirstOrDefault() is { } textBlock)
971977 {
972978 // JSON is guaranteed to match the schema
973979 var contact = JsonSerializer.Deserialize<JsonElement>(textBlock.Text);
from line 981
975981 }
976982 ```
977983 
978 The example above outputs:
984 The previous example outputs:
979985 
980986 ```text Output wrap
981987 {"name":"John Smith","email":"[email protected]","plan_interest":"Enterprise","demo_requested":true}
from line 1071
10651071 .build();
10661072 
10671073 OutputConfig outputConfig = OutputConfig.builder()
1068 .format(JsonOutputFormat.builder().schema(schema).build())
1074 .format(JsonOutputFormat.builder()
1075 .schema(schema)
1076 .build())
10691077 .build();
10701078 
10711079 MessageCreateParams createParams = MessageCreateParams.builder()
from line 1778
17701778 public string $sentiment;
17711779 }
17721780 
1773 $feedbackText = "Great product, fast shipping!";
1781 $feedbackText = 'Great product, fast shipping!';
17741782 
17751783 $message = $client->messages->create(
17761784 maxTokens: 1024,
from line 2348
23402348 ]
23412349 });
23422350 
2343 // Claude may call the tool first (tool_use) or respond with JSON (text)
2351 // Claude might call the tool first (tool_use) or respond with JSON (text)
23442352 console.log("Stop reason:", response.stop_reason);
23452353 for (const block of response.content) {
23462354 switch (block.type) {
from line 2486
24782486 .maxTokens(1024L)
24792487 .addUserMessage("Help me plan a trip to Paris departing May 15, 2026")
24802488 .outputConfig(OutputConfig.builder()
2481 .format(JsonOutputFormat.builder().schema(outputSchema).build())
2489 .format(JsonOutputFormat.builder()
2490 .schema(outputSchema)
2491 .build())
24822492 .build())
24832493 .addTool(Tool.builder()
24842494 .name("search_flights")
from line 2543
25332543 ],
25342544 );
25352545 
2536 // Claude may call the tool first (tool_use) or respond with JSON (text)
2546 // Claude might call the tool first (tool_use) or respond with JSON (text)
25372547 $plan = $message->parsedOutput();
25382548 if ($plan instanceof TripPlan) {
25392549 echo $plan->summary, "\n";
Feedback