Skip to content

1.13.0

Choose a tag to compare

@sebsto sebsto released this 23 May 19:21
· 12 commits to main since this release
1b84e1d

What's New

Structured output — Constrain Claude responses (and tool inputs) to conform to a JSON schema. The model is forced to return a value that matches the schema, removing the need for post-processing or retry-on-malformed-JSON loops.

let schema: JSON = [
    "type": "object",
    "properties": [
        "title": ["type": "string"],
        "summary": ["type": "string"],
        "tags": ["type": "array", "items": ["type": "string"]],
    ],
    "required": ["title", "summary"],
]

let output = try OutputFormat(name: "Article", schema: schema)

let builder = try ConverseRequestBuilder(with: .claude_sonnet_v4_5)
    .withPrompt("Summarize WWDC 2026")
    .withOutputFormat(output)

let reply = try await bedrock.converse(with: builder)

This adds:

  • OutputFormat — a new struct with JSON schema validation and a memorable name; converts cleanly to the AWS SDK type.
  • ConverseRequestBuilder.withOutputFormat(...) — fluent API for both regular and streaming requests.
  • A strict: Bool parameter on Tool so tool-call inputs can be constrained the same way.
  • A new .structuredOutput case on ConverseFeature, enabled for Anthropic Claude models.
  • A new DocC article and a Examples/structured-output/ example demonstrating both mechanisms, wired into the CI integration-tests matrix.

Closes #70.

What's Changed

Full Changelog: 1.12.0...1.13.0