Skip to content

build-on-aws/swift-bedrock-library

Swift Bedrock Library

A Swift library for interacting with Amazon Bedrock foundation models.

📖 Complete Documentation - Comprehensive guides and API reference

TL;DR - Quick Start

import BedrockService

// Initialize the service
let bedrock = try await BedrockService(region: .uswest2)

// Send a simple text prompt
let model: BedrockModel = .nova_lite
let builder = try ConverseRequestBuilder(with: model)
    .withPrompt("Tell me about rainbows")

let reply = try await bedrock.converse(with: builder)
print("Assistant: \(reply)")

Installation

Add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/build-on-aws/swift-bedrock-library.git", from: "1.5.0")
],
targets: [
    .target(
        name: "YourTarget",
        dependencies: [
            .product(name: "BedrockService", package: "swift-bedrock-library")
        ]
    )
]

Requires: platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)]

Documentation

📖 Complete Documentation - Comprehensive guides and API reference

Key topics:

Examples

Explore the Examples directory for complete sample applications including:

  • Basic conversation chat
  • Streaming responses
  • Image generation
  • iOS math solver app
  • Web playground with frontend/backend

Acknowledgment

This library and playground have been written by Mona Dierickx, during her last year of studies at HoGent, Belgium.

Thank you for your enthusiasm and positive attitude during the three months we worked together (February 2025 - May 2025).

Thank you Professor Steven Van Impe for allowing us to work with these young talents.

About

A Swift Library to create AI Agent based on Amazon Bedrock

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks