Skip to content

Releases: sebsto/swift-bedrock-library

v1.18.0

Choose a tag to compare

@sebsto sebsto released this 27 Jul 15:06
5f05e9f

What's Changed

  • Add MiniMax model support (M2, M2.1, M2.5) by @sebsto in #94
  • Add Claude Opus 5 model support by @sebsto in #98

Chore

  • Bump postcss from 8.5.10 to 8.5.18 in /Examples/web-playground/frontend by @dependabot[bot] in #96
  • Bump next from 16.2.6 to 16.2.11 in /Examples/web-playground/frontend by @dependabot[bot] in #97
  • Bump brace-expansion and sucrase in /Examples/web-playground/frontend by @dependabot[bot] in #95

Full Changelog: v1.17.0...v1.18.0

v1.17.0

Choose a tag to compare

@sebsto sebsto released this 16 Jun 11:37
b89d5e8

xAI Grok 4.3

Grok 4.3 is now available through the library via the bedrock-mantle endpoint. It works with both the Chat Completions and Responses APIs.

  • xAI Grok 4.3 (.grok_4_3)

Grok 4.3 has a 1M-token context window and is currently only available in us-west-2. Parameter defaults match xAI's published values: temperature=0.7, top_p=0.95, max_completion_tokens=131_072.

let bedrock = try await BedrockService(region: .uswest2)

let reply = try await bedrock.completeChatCompletion(
    "Explain quantum entanglement in two sentences.",
    with: .grok_4_3,
    authentication: .default
)
print(reply.text)

The Responses API works the same way:

let response = try await bedrock.createResponse(
    "What are three benefits of open-source software?",
    with: .grok_4_3,
    authentication: .default
)
print(response.text)

New example

  • Examples/xai-grok/ shows both the Chat Completions and Responses APIs with Grok 4.3.

What's Changed

  • Add xAI Grok 4.3 model support by @sebsto in #93

Full Changelog: v1.16.0...v1.17.0

v1.16.0

Choose a tag to compare

@sebsto sebsto released this 12 Jun 15:50
7e9136e

Google Gemma 4 and Gemma 3 models

Six Google Gemma models are now available through the library. Gemma 4 models work via the Chat Completions and Responses APIs on the bedrock-mantle endpoint. Gemma 3 models also support InvokeModel and Converse.

Gemma 4 (mantle-only):

  • Gemma 4 31B (.gemma4_31b)
  • Gemma 4 26B-A4B (.gemma4_26b_a4b)
  • Gemma 4 E2B (.gemma4_e2b)

Gemma 3 (InvokeModel + Converse + Chat Completions):

  • Gemma 3 27B IT (.gemma3_27b_it)
  • Gemma 3 12B IT (.gemma3_12b_it)
  • Gemma 3 4B IT (.gemma3_4b_it)
// Chat Completions API (Gemma 4)
let reply = try await bedrock.completeChatCompletion(
    "Explain the difference between a compiler and an interpreter",
    with: .gemma4_31b,
    authentication: .default
)
print(reply.text)

Chat Completions API

A new OpenAI-compatible Chat Completions endpoint for multi-turn conversations. Works with all Gemma models and supports both API key and SigV4 authentication.

var messages: [ChatCompletionsMessage] = []
messages.append("What is Swift?")

let reply = try await bedrock.completeChatCompletion(
    messages,
    with: .gemma4_31b,
    authentication: .default
)

messages.append(reply)
messages.append("How does it compare to Kotlin?")

let followUp = try await bedrock.completeChatCompletion(
    messages,
    with: .gemma4_31b,
    authentication: .default
)

Gemma 4 with the Responses API

Gemma 4 models also work with the Responses API introduced in v1.14.0:

let response = try await bedrock.createResponse(
    "What are three benefits of open-source software?",
    with: .gemma4_31b,
    authentication: .default
)
print(response.text)

New example

  • Examples/google-gemma/ shows both the Chat Completions and Responses APIs with Gemma 4.

What'''s Changed

  • Add Google Gemma 4 and Gemma 3 model support by @sebsto in #90
  • Extract shared makeMantleURL and makeMantleClient helpers by @sebsto in #91

Full Changelog: v1.15.0...v1.16.0'

v1.15.0

Choose a tag to compare

@sebsto sebsto released this 11 Jun 07:03
1e2763d

What's New

Claude Fable 5 — Anthropic's most capable model, now on Bedrock

You can now use Claude Fable 5 through the native Anthropic Messages API on the bedrock-mantle endpoint. Fable 5 brings a 1M token context window, 128K max output, and always-on reasoning — ideal for complex, multi-step tasks.

let reply = try await bedrock.createMessage(
    "Explain quantum computing",
    with: .claude_fable_v5,
    authentication: .default
)
print(reply.text)

Multi-turn conversations made easy

Building a conversation is as simple as appending strings and replies:

var conversation: [AnthropicMessage] = []
conversation.append("What is quantum computing?")

let reply = try await bedrock.createMessage(
    conversation, with: .claude_fable_v5, authentication: .default
)

conversation.append(reply)
conversation.append("Give me a real-world example")

let followUp = try await bedrock.createMessage(
    conversation, with: .claude_fable_v5, authentication: .default
)

Prerequisites

Claude Fable 5 requires a one-time data retention opt-in before first use. See the Messages API documentation for setup instructions.

What's Changed

Full Changelog: v1.14.0...v1.15.0

v1.14.0

Choose a tag to compare

@sebsto sebsto released this 06 Jun 10:37
7888da7

What's New

OpenAI Responses API and bedrock-mantle endpoint

The library now supports the OpenAI Responses API via the bedrock-mantle endpoint. This is a new API surface built with AsyncHTTPClient, supporting both API key and SigV4 authentication.

let reply = try await bedrock.createResponse(
    "Explain Amazon Bedrock",
    with: .openai_gpt_5_5,
    authentication: .apiKey(key: myKey)
)
print(reply.text)

All existing BedrockAuthentication methods work: .default, .profile, .sso, .login, .webIdentity, .static, and .apiKey.

New models

  • OpenAI GPT 5.5 (openai.gpt-5.5) — Responses API only, 272K context
  • OpenAI GPT 5.4 (openai.gpt-5.4) — Responses API only, 272K context
  • Claude Opus 4.8 (anthropic.claude-opus-4-8) — 128K output, 1M context, global cross-region inference

Existing models with new capabilities

  • openai_gpt_oss_20b and openai_gpt_oss_120b now support the Responses API in addition to Invoke and Converse

Bug fixes

  • Fixed build error with newer AWS SDK versions that added a .system case to ConversationRole

New example

  • Examples/responses/ — demonstrates calling GPT 5.5 with both API key and SigV4 authentication

What's Changed

  • Add Claude Opus 4.8 support by @sebsto in #86
  • Add OpenAI Responses API support (GPT 5.5, 5.4, gpt-oss) by @sebsto in #87

Full Changelog: 1.13.0...v1.14.0

1.13.0

Choose a tag to compare

@sebsto sebsto released this 23 May 19:21
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

1.12.0

Choose a tag to compare

@sebsto sebsto released this 23 May 19:14
383f188

What's New

Stability AI image generation — Three new text-to-image models on Amazon Bedrock are now first-class BedrockModel constants:

  • BedrockModel.stable_image_corestability.stable-image-core-v1:1
  • BedrockModel.stable_image_ultrastability.stable-image-ultra-v1:1
  • BedrockModel.sd3_5_largestability.sd3-5-large-v1:0

All three are available in us-west-2. They slot into the existing BedrockService.generateImage(...) API without any signature changes — ImageResolution is mapped internally to the closest supported aspect_ratio (16:9, 1:1, 21:9, 2:3, 3:2, 4:5, 5:4, 9:16, 9:21).

let bedrock = try await BedrockService(region: .uswest2)
let output = try await bedrock.generateImage(
    "A serene landscape with mountains at sunset",
    with: .stable_image_core,
    seed: 42,
    resolution: ImageResolution(width: 1920, height: 1080)
)
try output.images.first?.write(to: URL(fileURLWithPath: "out.png"))

Stability-specific constraints surface as clear BedrockLibraryError.notSupported errors rather than silent ignores: Stability returns exactly one image per call (nrOfImages must be nil or 1), cfgScale and quality are not accepted, and negativePrompt is supported only by sd3_5_large. Image-to-image for sd3_5_large is intentionally deferred.

A new DocC article (Stability AI Image Generation) and a new Examples/stability-image/ standalone example are included.

Fixes

  • Removed a broken check-foundation CI job that has been a false pass since #22 — the script targeted the wrong binary path, so ldd never actually ran. Tracking the correct foundation-free goal in #84 and upstream at awslabs/aws-sdk-swift#2171.

What's Changed

  • Add support for Stability AI text-to-image models by @sebsto in #82
  • Remove broken check-foundation CI job by @sebsto in #83

Full Changelog: 1.11.0...1.12.0

1.11.0

Choose a tag to compare

@sebsto sebsto released this 23 May 15:29
3d8bb18

What's New

Claude Opus 4.7 support — You can now use anthropic.claude-opus-4-7 with its full 1M token context window and 128K max output. It supports text generation, system prompts, documents, vision, tool use, reasoning, and global cross-region inference.

AWS Login authentication — A new .login(profileName:) authentication method lets you authenticate using aws login (SSO) credentials. Handy if your org uses IAM Identity Center.

Fixes

  • Fixed deprecation warnings introduced by recent AWS SDK updates (migrated to new client config types, removed redundant Sendable conformances).

Dependency Updates

  • aws-sdk-swift bumped to 1.7.0

What's Changed

  • Bump minimatch from 9.0.5 to 9.0.9 in /Examples/web-playground/frontend by @dependabot[bot] in #71
  • Bump picomatch from 2.3.1 to 2.3.2 in /Examples/web-playground/frontend by @dependabot[bot] in #73
  • Bump postcss from 8.5.3 to 8.5.10 in /Examples/web-playground/frontend by @dependabot[bot] in #75
  • Bump next from 16.1.5 to 16.2.6 in /Examples/web-playground/frontend by @dependabot[bot] in #76
  • Fix deprecation warnings from AWS SDK update by @sebsto in #77
  • Add aws login authentication support by @sebsto in #78
  • Add support for Claude Opus 4.7 by @sebsto in #79
  • Trigger CI on push to main to seed SPM cache by @sebsto in #80
  • Migrate steering rules from Amazon Q to Kiro by @sebsto in #81

Full Changelog: 1.10.0...1.11.0

1.10.0

Choose a tag to compare

@sebsto sebsto released this 09 Feb 16:07
158dfa6

Claude Opus 4.6 Support

Added support for Anthropic's latest Claude Opus 4.6 model, bringing enhanced reasoning capabilities and improved performance to your applications.

Model ID: anthropic.claude-opus-4-6-v1

Key Capabilities:

  • Extended context window: 200,000 tokens
  • Maximum output: 128,000 tokens
  • Advanced reasoning with up to 8,191 reasoning tokens
  • Full support for vision, document processing, and tool use
  • Compatible with Converse API (streaming and non-streaming)
  • Global cross-region inference support

Usage Example

Basic Conversation with Claude Opus 4.6

import BedrockService
import Logging

// Initialize the Bedrock service
let bedrock = try await BedrockService(
    region: .useast1,
    logger: Logger(label: "MyApp")
)

// Use the new Claude Opus 4.6 model
let model: BedrockModel = .claude_opus_v4_6

// Create a conversation request
let builder = try ConverseRequestBuilder(with: model)
    .withPrompt("Explain quantum entanglement in simple terms")
    .withTemperature(0.7)
    .withMaxTokens(2048)

// Send the request and get the response
let reply = try await bedrock.converse(with: builder)
print("Assistant: \(reply)")

Multi-turn Conversation

// Continue the conversation
let followUp = try ConverseRequestBuilder(from: builder, with: reply)
    .withPrompt("Can you provide a real-world analogy?")

let secondReply = try await bedrock.converse(with: followUp)
print("Assistant: \(secondReply)")

Using Advanced Reasoning

// Leverage Claude Opus 4.6's reasoning capabilities
let reasoningBuilder = try ConverseRequestBuilder(with: .claude_opus_v4_6)
    .withPrompt("Solve this complex problem step by step: ...")
    .withMaxTokens(8192)
    // The model will automatically use reasoning tokens as needed

let solution = try await bedrock.converse(with: reasoningBuilder)
print("Solution: \(solution)")

Streaming Responses

// Stream responses for real-time output
let streamBuilder = try ConverseRequestBuilder(with: .claude_opus_v4_6)
    .withPrompt("Write a detailed explanation of machine learning")

for try await chunk in bedrock.converseStream(with: streamBuilder) {
    if let text = chunk.text {
        print(text, terminator: "")
    }
}

Installation

Update your Package.swift to use version 1.10.0:

dependencies: [
    .package(url: "https://github.com/build-on-aws/swift-bedrock-library.git", from: "1.10.0")
]

What's Changed

  • Add support for Claude Opus 4.6 by @sebsto in #69
  • Bump next from 15.4.10 to 16.1.5 in /Examples/web-playground/frontend by @dependabot[bot] in #68

Full Changelog: 1.9.0...1.10.0

1.9.0

Choose a tag to compare

@sebsto sebsto released this 19 Dec 10:57
9c8a796

This release adds support for Nova 2 Lite model with Converse API.
You can learn more about Amazon Nova models here: https://docs.aws.amazon.com/nova/latest/nova2-userguide/what-is-nova-2.html

What's Changed

  • Bump next from 15.4.7 to 15.4.9 in /Examples/web-playground/frontend by @dependabot[bot] in #65
  • Add support for nova 2 lite by @sebsto in #66
  • Bump next from 15.4.9 to 15.4.10 in /Examples/web-playground/frontend by @dependabot[bot] in #67

Full Changelog: 1.8.0...1.9.0