diff --git a/.github/workflows/build_soundness.yml b/.github/workflows/build_soundness.yml index d5e46e49..d944c14e 100644 --- a/.github/workflows/build_soundness.yml +++ b/.github/workflows/build_soundness.yml @@ -9,7 +9,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Run tests - working-directory: swift-bedrock-library run: swift test playground-backend: @@ -17,8 +16,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Web playground backend tests - working-directory: web-playground/backend + - name: Web playground backend build + working-directory: Examples/web-playground/backend run: swift build soundness: @@ -26,7 +25,7 @@ jobs: uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main with: license_header_check_enabled: true - license_header_check_project_name: "Swift Foundation Models Playground" + license_header_check_project_name: "Swift Bedrock Library" shell_check_enabled: false python_lint_check_enabled: false api_breakage_check_enabled: false diff --git a/.license_header_template b/.license_header_template index c1c46110..c0f1ca1a 100644 --- a/.license_header_template +++ b/.license_header_template @@ -1,13 +1,13 @@ @@===----------------------------------------------------------------------===@@ @@ -@@ This source file is part of the Swift Foundation Models Playground open source project +@@ This source file is part of the Swift Bedrock Library open source project @@ @@ Copyright (c) YEARS Amazon.com, Inc. or its affiliates -@@ and the Swift Foundation Models Playground project authors +@@ and the Swift Bedrock Library project authors @@ Licensed under Apache License v2.0 @@ @@ See LICENSE.txt for license information -@@ See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +@@ See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors @@ @@ SPDX-License-Identifier: Apache-2.0 @@ diff --git a/web-playground/README.md b/Examples/web-playground/README.md similarity index 100% rename from web-playground/README.md rename to Examples/web-playground/README.md diff --git a/web-playground/backend/Package.swift b/Examples/web-playground/backend/Package.swift similarity index 74% rename from web-playground/backend/Package.swift rename to Examples/web-playground/backend/Package.swift index 993ae81f..a42d9d8e 100644 --- a/web-playground/backend/Package.swift +++ b/Examples/web-playground/backend/Package.swift @@ -12,7 +12,12 @@ let package = Package( dependencies: [ .package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0"), .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"), - .package(name: "swift-bedrock-library", path: "../.."), + + // Uncomment the following line to use the Bedrock library from a specific branch or commit + // .package(url: "https://github.com/build-on-aws/swift-bedrock-library.git", branch: "main"), + + // for CI or testing purposes, you can use a local path + .package(name: "swift-bedrock-library", path: "../../.."), ], targets: [ .executableTarget( diff --git a/web-playground/backend/Sources/PlaygroundAPI/App.swift b/Examples/web-playground/backend/Sources/PlaygroundAPI/App.swift similarity index 82% rename from web-playground/backend/Sources/PlaygroundAPI/App.swift rename to Examples/web-playground/backend/Sources/PlaygroundAPI/App.swift index b7abd0d3..262f88ec 100644 --- a/web-playground/backend/Sources/PlaygroundAPI/App.swift +++ b/Examples/web-playground/backend/Sources/PlaygroundAPI/App.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/web-playground/backend/Sources/PlaygroundAPI/Application+build.swift b/Examples/web-playground/backend/Sources/PlaygroundAPI/Application+build.swift similarity index 97% rename from web-playground/backend/Sources/PlaygroundAPI/Application+build.swift rename to Examples/web-playground/backend/Sources/PlaygroundAPI/Application+build.swift index c581632a..6608e35f 100644 --- a/web-playground/backend/Sources/PlaygroundAPI/Application+build.swift +++ b/Examples/web-playground/backend/Sources/PlaygroundAPI/Application+build.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/web-playground/backend/Sources/PlaygroundAPI/Types/Chat.swift b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/Chat.swift similarity index 79% rename from web-playground/backend/Sources/PlaygroundAPI/Types/Chat.swift rename to Examples/web-playground/backend/Sources/PlaygroundAPI/Types/Chat.swift index 7cbaed5c..fa439020 100644 --- a/web-playground/backend/Sources/PlaygroundAPI/Types/Chat.swift +++ b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/Chat.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/web-playground/backend/Sources/PlaygroundAPI/Types/ImageGeneration.swift b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/ImageGeneration.swift similarity index 84% rename from web-playground/backend/Sources/PlaygroundAPI/Types/ImageGeneration.swift rename to Examples/web-playground/backend/Sources/PlaygroundAPI/Types/ImageGeneration.swift index 22a00fc3..43b3ccb4 100644 --- a/web-playground/backend/Sources/PlaygroundAPI/Types/ImageGeneration.swift +++ b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/ImageGeneration.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/web-playground/backend/Sources/PlaygroundAPI/Types/ListModels.swift b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/ListModels.swift similarity index 64% rename from web-playground/backend/Sources/PlaygroundAPI/Types/ListModels.swift rename to Examples/web-playground/backend/Sources/PlaygroundAPI/Types/ListModels.swift index 2e60bafd..8710e588 100644 --- a/web-playground/backend/Sources/PlaygroundAPI/Types/ListModels.swift +++ b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/ListModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/web-playground/backend/Sources/PlaygroundAPI/Types/TextGeneration.swift b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/TextGeneration.swift similarity index 71% rename from web-playground/backend/Sources/PlaygroundAPI/Types/TextGeneration.swift rename to Examples/web-playground/backend/Sources/PlaygroundAPI/Types/TextGeneration.swift index 8b00e432..b21188f2 100644 --- a/web-playground/backend/Sources/PlaygroundAPI/Types/TextGeneration.swift +++ b/Examples/web-playground/backend/Sources/PlaygroundAPI/Types/TextGeneration.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/web-playground/backend/img/image.png b/Examples/web-playground/backend/img/image.png similarity index 100% rename from web-playground/backend/img/image.png rename to Examples/web-playground/backend/img/image.png diff --git a/web-playground/frontend/app/app.config.js b/Examples/web-playground/frontend/app/app.config.js similarity index 100% rename from web-playground/frontend/app/app.config.js rename to Examples/web-playground/frontend/app/app.config.js diff --git a/web-playground/frontend/app/chat/loading.js b/Examples/web-playground/frontend/app/chat/loading.js similarity index 100% rename from web-playground/frontend/app/chat/loading.js rename to Examples/web-playground/frontend/app/chat/loading.js diff --git a/web-playground/frontend/app/chat/page.js b/Examples/web-playground/frontend/app/chat/page.js similarity index 100% rename from web-playground/frontend/app/chat/page.js rename to Examples/web-playground/frontend/app/chat/page.js diff --git a/web-playground/frontend/app/favicon.ico b/Examples/web-playground/frontend/app/favicon.ico similarity index 100% rename from web-playground/frontend/app/favicon.ico rename to Examples/web-playground/frontend/app/favicon.ico diff --git a/web-playground/frontend/app/globals.css b/Examples/web-playground/frontend/app/globals.css similarity index 100% rename from web-playground/frontend/app/globals.css rename to Examples/web-playground/frontend/app/globals.css diff --git a/web-playground/frontend/app/image/loading.js b/Examples/web-playground/frontend/app/image/loading.js similarity index 100% rename from web-playground/frontend/app/image/loading.js rename to Examples/web-playground/frontend/app/image/loading.js diff --git a/web-playground/frontend/app/image/page.js b/Examples/web-playground/frontend/app/image/page.js similarity index 100% rename from web-playground/frontend/app/image/page.js rename to Examples/web-playground/frontend/app/image/page.js diff --git a/web-playground/frontend/app/image_variation/loading.js b/Examples/web-playground/frontend/app/image_variation/loading.js similarity index 100% rename from web-playground/frontend/app/image_variation/loading.js rename to Examples/web-playground/frontend/app/image_variation/loading.js diff --git a/web-playground/frontend/app/image_variation/page.js b/Examples/web-playground/frontend/app/image_variation/page.js similarity index 100% rename from web-playground/frontend/app/image_variation/page.js rename to Examples/web-playground/frontend/app/image_variation/page.js diff --git a/web-playground/frontend/app/layout.js b/Examples/web-playground/frontend/app/layout.js similarity index 100% rename from web-playground/frontend/app/layout.js rename to Examples/web-playground/frontend/app/layout.js diff --git a/web-playground/frontend/app/models/[modelId]/loading.js b/Examples/web-playground/frontend/app/models/[modelId]/loading.js similarity index 100% rename from web-playground/frontend/app/models/[modelId]/loading.js rename to Examples/web-playground/frontend/app/models/[modelId]/loading.js diff --git a/web-playground/frontend/app/models/[modelId]/page.js b/Examples/web-playground/frontend/app/models/[modelId]/page.js similarity index 100% rename from web-playground/frontend/app/models/[modelId]/page.js rename to Examples/web-playground/frontend/app/models/[modelId]/page.js diff --git a/web-playground/frontend/app/models/loading.js b/Examples/web-playground/frontend/app/models/loading.js similarity index 100% rename from web-playground/frontend/app/models/loading.js rename to Examples/web-playground/frontend/app/models/loading.js diff --git a/web-playground/frontend/app/models/page.js b/Examples/web-playground/frontend/app/models/page.js similarity index 100% rename from web-playground/frontend/app/models/page.js rename to Examples/web-playground/frontend/app/models/page.js diff --git a/web-playground/frontend/app/page.js b/Examples/web-playground/frontend/app/page.js similarity index 100% rename from web-playground/frontend/app/page.js rename to Examples/web-playground/frontend/app/page.js diff --git a/web-playground/frontend/app/reasoning_chat/loading.js b/Examples/web-playground/frontend/app/reasoning_chat/loading.js similarity index 100% rename from web-playground/frontend/app/reasoning_chat/loading.js rename to Examples/web-playground/frontend/app/reasoning_chat/loading.js diff --git a/web-playground/frontend/app/reasoning_chat/page.js b/Examples/web-playground/frontend/app/reasoning_chat/page.js similarity index 100% rename from web-playground/frontend/app/reasoning_chat/page.js rename to Examples/web-playground/frontend/app/reasoning_chat/page.js diff --git a/web-playground/frontend/app/text/loading.js b/Examples/web-playground/frontend/app/text/loading.js similarity index 100% rename from web-playground/frontend/app/text/loading.js rename to Examples/web-playground/frontend/app/text/loading.js diff --git a/web-playground/frontend/app/text/page.js b/Examples/web-playground/frontend/app/text/page.js similarity index 100% rename from web-playground/frontend/app/text/page.js rename to Examples/web-playground/frontend/app/text/page.js diff --git a/web-playground/frontend/components/Content.jsx b/Examples/web-playground/frontend/components/Content.jsx similarity index 100% rename from web-playground/frontend/components/Content.jsx rename to Examples/web-playground/frontend/components/Content.jsx diff --git a/web-playground/frontend/components/Header.jsx b/Examples/web-playground/frontend/components/Header.jsx similarity index 100% rename from web-playground/frontend/components/Header.jsx rename to Examples/web-playground/frontend/components/Header.jsx diff --git a/web-playground/frontend/components/Navigation.jsx b/Examples/web-playground/frontend/components/Navigation.jsx similarity index 100% rename from web-playground/frontend/components/Navigation.jsx rename to Examples/web-playground/frontend/components/Navigation.jsx diff --git a/web-playground/frontend/components/NumericInput.jsx b/Examples/web-playground/frontend/components/NumericInput.jsx similarity index 100% rename from web-playground/frontend/components/NumericInput.jsx rename to Examples/web-playground/frontend/components/NumericInput.jsx diff --git a/web-playground/frontend/components/Spinner.jsx b/Examples/web-playground/frontend/components/Spinner.jsx similarity index 100% rename from web-playground/frontend/components/Spinner.jsx rename to Examples/web-playground/frontend/components/Spinner.jsx diff --git a/web-playground/frontend/components/chatPlayground/Assistant.jsx b/Examples/web-playground/frontend/components/chatPlayground/Assistant.jsx similarity index 100% rename from web-playground/frontend/components/chatPlayground/Assistant.jsx rename to Examples/web-playground/frontend/components/chatPlayground/Assistant.jsx diff --git a/web-playground/frontend/components/chatPlayground/ChatComponent.jsx b/Examples/web-playground/frontend/components/chatPlayground/ChatComponent.jsx similarity index 100% rename from web-playground/frontend/components/chatPlayground/ChatComponent.jsx rename to Examples/web-playground/frontend/components/chatPlayground/ChatComponent.jsx diff --git a/web-playground/frontend/components/chatPlayground/ChatModelSelector.jsx b/Examples/web-playground/frontend/components/chatPlayground/ChatModelSelector.jsx similarity index 100% rename from web-playground/frontend/components/chatPlayground/ChatModelSelector.jsx rename to Examples/web-playground/frontend/components/chatPlayground/ChatModelSelector.jsx diff --git a/web-playground/frontend/components/chatPlayground/Human.jsx b/Examples/web-playground/frontend/components/chatPlayground/Human.jsx similarity index 100% rename from web-playground/frontend/components/chatPlayground/Human.jsx rename to Examples/web-playground/frontend/components/chatPlayground/Human.jsx diff --git a/web-playground/frontend/components/chatPlayground/Loader.jsx b/Examples/web-playground/frontend/components/chatPlayground/Loader.jsx similarity index 100% rename from web-playground/frontend/components/chatPlayground/Loader.jsx rename to Examples/web-playground/frontend/components/chatPlayground/Loader.jsx diff --git a/web-playground/frontend/components/chatPlayground/ModelIndicator.jsx b/Examples/web-playground/frontend/components/chatPlayground/ModelIndicator.jsx similarity index 100% rename from web-playground/frontend/components/chatPlayground/ModelIndicator.jsx rename to Examples/web-playground/frontend/components/chatPlayground/ModelIndicator.jsx diff --git a/web-playground/frontend/components/foundationModels/ModelDetails.jsx b/Examples/web-playground/frontend/components/foundationModels/ModelDetails.jsx similarity index 100% rename from web-playground/frontend/components/foundationModels/ModelDetails.jsx rename to Examples/web-playground/frontend/components/foundationModels/ModelDetails.jsx diff --git a/web-playground/frontend/components/imagePlayground/ImageComponent.jsx b/Examples/web-playground/frontend/components/imagePlayground/ImageComponent.jsx similarity index 100% rename from web-playground/frontend/components/imagePlayground/ImageComponent.jsx rename to Examples/web-playground/frontend/components/imagePlayground/ImageComponent.jsx diff --git a/web-playground/frontend/components/imagePlayground/ImageModelSelector.jsx b/Examples/web-playground/frontend/components/imagePlayground/ImageModelSelector.jsx similarity index 100% rename from web-playground/frontend/components/imagePlayground/ImageModelSelector.jsx rename to Examples/web-playground/frontend/components/imagePlayground/ImageModelSelector.jsx diff --git a/web-playground/frontend/components/imagePlayground/StyleSelector.jsx b/Examples/web-playground/frontend/components/imagePlayground/StyleSelector.jsx similarity index 100% rename from web-playground/frontend/components/imagePlayground/StyleSelector.jsx rename to Examples/web-playground/frontend/components/imagePlayground/StyleSelector.jsx diff --git a/web-playground/frontend/components/imageVariationPlayground/ImageModelSelector.jsx b/Examples/web-playground/frontend/components/imageVariationPlayground/ImageModelSelector.jsx similarity index 100% rename from web-playground/frontend/components/imageVariationPlayground/ImageModelSelector.jsx rename to Examples/web-playground/frontend/components/imageVariationPlayground/ImageModelSelector.jsx diff --git a/web-playground/frontend/components/imageVariationPlayground/ImageVariationComponent.jsx b/Examples/web-playground/frontend/components/imageVariationPlayground/ImageVariationComponent.jsx similarity index 100% rename from web-playground/frontend/components/imageVariationPlayground/ImageVariationComponent.jsx rename to Examples/web-playground/frontend/components/imageVariationPlayground/ImageVariationComponent.jsx diff --git a/web-playground/frontend/components/imageVariationPlayground/StyleSelector.jsx b/Examples/web-playground/frontend/components/imageVariationPlayground/StyleSelector.jsx similarity index 100% rename from web-playground/frontend/components/imageVariationPlayground/StyleSelector.jsx rename to Examples/web-playground/frontend/components/imageVariationPlayground/StyleSelector.jsx diff --git a/web-playground/frontend/components/reasoningChatPlayground/Assistant.jsx b/Examples/web-playground/frontend/components/reasoningChatPlayground/Assistant.jsx similarity index 100% rename from web-playground/frontend/components/reasoningChatPlayground/Assistant.jsx rename to Examples/web-playground/frontend/components/reasoningChatPlayground/Assistant.jsx diff --git a/web-playground/frontend/components/reasoningChatPlayground/Human.jsx b/Examples/web-playground/frontend/components/reasoningChatPlayground/Human.jsx similarity index 100% rename from web-playground/frontend/components/reasoningChatPlayground/Human.jsx rename to Examples/web-playground/frontend/components/reasoningChatPlayground/Human.jsx diff --git a/web-playground/frontend/components/reasoningChatPlayground/Loader.jsx b/Examples/web-playground/frontend/components/reasoningChatPlayground/Loader.jsx similarity index 100% rename from web-playground/frontend/components/reasoningChatPlayground/Loader.jsx rename to Examples/web-playground/frontend/components/reasoningChatPlayground/Loader.jsx diff --git a/web-playground/frontend/components/reasoningChatPlayground/ModelIndicator.jsx b/Examples/web-playground/frontend/components/reasoningChatPlayground/ModelIndicator.jsx similarity index 100% rename from web-playground/frontend/components/reasoningChatPlayground/ModelIndicator.jsx rename to Examples/web-playground/frontend/components/reasoningChatPlayground/ModelIndicator.jsx diff --git a/web-playground/frontend/components/reasoningChatPlayground/ReasoningChatComponent.jsx b/Examples/web-playground/frontend/components/reasoningChatPlayground/ReasoningChatComponent.jsx similarity index 100% rename from web-playground/frontend/components/reasoningChatPlayground/ReasoningChatComponent.jsx rename to Examples/web-playground/frontend/components/reasoningChatPlayground/ReasoningChatComponent.jsx diff --git a/web-playground/frontend/components/reasoningChatPlayground/ReasoningModelSelector.jsx b/Examples/web-playground/frontend/components/reasoningChatPlayground/ReasoningModelSelector.jsx similarity index 100% rename from web-playground/frontend/components/reasoningChatPlayground/ReasoningModelSelector.jsx rename to Examples/web-playground/frontend/components/reasoningChatPlayground/ReasoningModelSelector.jsx diff --git a/web-playground/frontend/components/textPlayground/TextComponent.jsx b/Examples/web-playground/frontend/components/textPlayground/TextComponent.jsx similarity index 100% rename from web-playground/frontend/components/textPlayground/TextComponent.jsx rename to Examples/web-playground/frontend/components/textPlayground/TextComponent.jsx diff --git a/web-playground/frontend/components/textPlayground/TextModelSelector.jsx b/Examples/web-playground/frontend/components/textPlayground/TextModelSelector.jsx similarity index 100% rename from web-playground/frontend/components/textPlayground/TextModelSelector.jsx rename to Examples/web-playground/frontend/components/textPlayground/TextModelSelector.jsx diff --git a/web-playground/frontend/components/textPlayground/Textarea.jsx b/Examples/web-playground/frontend/components/textPlayground/Textarea.jsx similarity index 100% rename from web-playground/frontend/components/textPlayground/Textarea.jsx rename to Examples/web-playground/frontend/components/textPlayground/Textarea.jsx diff --git a/web-playground/frontend/helpers/chatModelData.js b/Examples/web-playground/frontend/helpers/chatModelData.js similarity index 100% rename from web-playground/frontend/helpers/chatModelData.js rename to Examples/web-playground/frontend/helpers/chatModelData.js diff --git a/web-playground/frontend/helpers/imageModelData.js b/Examples/web-playground/frontend/helpers/imageModelData.js similarity index 100% rename from web-playground/frontend/helpers/imageModelData.js rename to Examples/web-playground/frontend/helpers/imageModelData.js diff --git a/web-playground/frontend/helpers/modelData.js b/Examples/web-playground/frontend/helpers/modelData.js similarity index 100% rename from web-playground/frontend/helpers/modelData.js rename to Examples/web-playground/frontend/helpers/modelData.js diff --git a/web-playground/frontend/helpers/reasoningModelData.js b/Examples/web-playground/frontend/helpers/reasoningModelData.js similarity index 100% rename from web-playground/frontend/helpers/reasoningModelData.js rename to Examples/web-playground/frontend/helpers/reasoningModelData.js diff --git a/web-playground/frontend/jsconfig.json b/Examples/web-playground/frontend/jsconfig.json similarity index 100% rename from web-playground/frontend/jsconfig.json rename to Examples/web-playground/frontend/jsconfig.json diff --git a/web-playground/frontend/next.config.js b/Examples/web-playground/frontend/next.config.js similarity index 100% rename from web-playground/frontend/next.config.js rename to Examples/web-playground/frontend/next.config.js diff --git a/web-playground/frontend/package-lock.json b/Examples/web-playground/frontend/package-lock.json similarity index 100% rename from web-playground/frontend/package-lock.json rename to Examples/web-playground/frontend/package-lock.json diff --git a/web-playground/frontend/package.json b/Examples/web-playground/frontend/package.json similarity index 100% rename from web-playground/frontend/package.json rename to Examples/web-playground/frontend/package.json diff --git a/web-playground/frontend/postcss.config.js b/Examples/web-playground/frontend/postcss.config.js similarity index 100% rename from web-playground/frontend/postcss.config.js rename to Examples/web-playground/frontend/postcss.config.js diff --git a/web-playground/frontend/public/next.svg b/Examples/web-playground/frontend/public/next.svg similarity index 100% rename from web-playground/frontend/public/next.svg rename to Examples/web-playground/frontend/public/next.svg diff --git a/web-playground/frontend/public/placeholder.png b/Examples/web-playground/frontend/public/placeholder.png similarity index 100% rename from web-playground/frontend/public/placeholder.png rename to Examples/web-playground/frontend/public/placeholder.png diff --git a/web-playground/frontend/public/vercel.svg b/Examples/web-playground/frontend/public/vercel.svg similarity index 100% rename from web-playground/frontend/public/vercel.svg rename to Examples/web-playground/frontend/public/vercel.svg diff --git a/web-playground/frontend/tailwind.config.js b/Examples/web-playground/frontend/tailwind.config.js similarity index 100% rename from web-playground/frontend/tailwind.config.js rename to Examples/web-playground/frontend/tailwind.config.js diff --git a/web-playground/openapi.yaml b/Examples/web-playground/openapi.yaml similarity index 100% rename from web-playground/openapi.yaml rename to Examples/web-playground/openapi.yaml diff --git a/Package.swift b/Package.swift index 2df17675..52c78f68 100644 --- a/Package.swift +++ b/Package.swift @@ -27,14 +27,14 @@ let package = Package( .product(name: "Logging", package: "swift-log"), .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"), ], - path: "swift-bedrock-library/Sources/BedrockService" + path: "Sources/BedrockService" ), .testTarget( name: "BedrockServiceTests", dependencies: [ .target(name: "BedrockService") ], - path: "swift-bedrock-library/Tests/BedrockServiceTests" + path: "Tests/BedrockServiceTests" ), ] ) diff --git a/README.md b/README.md index 33a0bb7d..5265afc9 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,1081 @@ +# Swift Bedrock Library -[![Build, tests & soundness checks](https://github.com/build-on-aws/swift-fm-playground/actions/workflows/build_soundness.yml/badge.svg)](https://github.com/build-on-aws/swift-fm-playground/actions/workflows/build_soundness.yml) +A tiny layer on top of the [AWS SDK for Swift](https://github.com/awslabs/aws-sdk-swift) for interacting with [Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html) foundation models. This library provides a convenient way to access Amazon Bedrock's capabilities from Swift applications. -![language](https://img.shields.io/badge/swift-6.0-orange) +## Acknowledgment -![platform-macos](https://img.shields.io/badge/platform-macOS-blue) -![platform-ios](https://img.shields.io/badge/platform-iOS-blue) -![platform-linux](https://img.shields.io/badge/platform-linux-blue) +This library and playground have been written by [Mona Dierickx](https://www.linkedin.com/in/mona-dierickx/), during her last year of studies at [HoGent](https://www.hogent.be/), Belgium. -[![license](https://img.shields.io/badge/License-Apache%202.0-green.svg)](LICENSE) +Thank you for your enthousiasm and positive attitude during the three months we worked together. (February 2025 - May 2025). -# Amazon Bedrock Swift Library and web playground +Thank for Professor Steven Van Impe for allowing us to work with these young talents. -This repository contains projects demonstrating how to use [Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html) with Swift. +## Getting started with BedrockService -## Projects +1. Set-up your `Package.swift` -### 1. Swift Bedrock Library +First add dependencies: +```bash +swift package add-dependency https://github.com/build-on-aws/swift-bedrock-library.git --branch main +swift package add-target-dependency BedrockService TargetName --package swift-bedrock-library +``` -A tiny layer on top of the [AWS SDK for Swift](https://github.com/awslabs/aws-sdk-swift) for interacting with Amazon Bedrock foundation models. This library provides a convenient way to access Amazon Bedrock's capabilities from Swift applications. +Next up add `platforms` configuration after `name` -[Go to Swift Bedrock Library →](swift-bedrock-library/README.md) +```swift +platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)], +``` -### 2. Swift FM Playground +Your `Package.swift` should now look something like this: +```swift +import PackageDescription -An interactive web application that demonstrates the capabilities of Amazon Bedrock foundation models using the Swift Bedrock Library. The playground includes: +let package = Package( + name: "ProjectName", + platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)], + dependencies: [ + .package(url: "https://github.com/build-on-aws/swift-bedrock-library.git", branch: "main"), + ], + targets: [ + .executableTarget( + name: "TargetName", + dependencies: [ + .product(name: "BedrockService", package: "swift-bedrock-library"), + ] + ) + ] +) +``` -- A Swift "backend for frontend" that interfaces with Amazon Bedrock -- A React frontend for interacting with the models through a user-friendly interface +2. Import the BedrockService -[Go to Swift FM Playground →](swift-fm-playground/web-playground/README.md) +```swift +import BedrockService +``` -## Getting Started +3. Initialize the BedrockService -Each project has its own README with specific setup instructions: +Choose what Region to use, whether to use AWS SSO authentication instead of standard credentials and pass a logger. If no region is passed it will default to `.useast1`, if no logger is provided a default logger with the name `bedrock.service` is created. The log level will be set to the environment variable `BEDROCK_SERVICE_LOG_LEVEL` or default to `.trace`. Choose the form of authentication you wish to use. -- For the Swift Bedrock Library, see the [library README](swift-bedrock-library/README.md) -- For the Swift FM Playground, see the [playground README](swift-fm-playground/web-playground/README.md) +```swift +let bedrock = try await BedrockService( + region: .uswest1, + logger: logger, + authentication: .sso +) +``` -## Prerequisites +4. List the available models -- Swift 6.0 or later -- AWS account with access to Amazon Bedrock -- [AWS credentials configured locally](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) or [SSO configured with AWS Identity Center](https://docs.aws.amazon.com/singlesignon/latest/userguide/manage-your-accounts.html) configured +Use the `listModels()` function to test your set-up. This function will return an array of `ModelSummary` objects, each one representing a model supported by Amazon Bedrock. The ModelSummaries that contain a `BedrockModel` object are the models supported by BedrockService. -## Acknowledgment +```swift +let models = try await bedrock.listModels() +``` -This library and playground have been written by [Mona Dierickx](https://www.linkedin.com/in/mona-dierickx/), during her last year of studies at [HoGent](https://www.hogent.be/), Belgium. +## Chatting using the Converse or ConverseStream API -Thank you for your enthousiasm and positive attitude during the three months we worked together. (February 2025 - May 2025). +### Text prompt -Thank for Professor Steven Van Impe for allowing us to work with these young talents. +To send a text prompt to a model, first choose a model that supports converse, you can verify this by using the `hasConverseModality` function on the `BedrockModel`. Then use the model to create a `ConverseRequestBuilder`, add your prompt to it with the `.withPrompt` function. Use the builder to send your request to the Converse API with the `converse` function. You can then easily print the reply and use it to create a new builder with the same model and inference parameters but with an updated history. + +```swift +let model: BedrockModel = .nova_lite + +guard model.hasConverseModality() else { + throw MyError.incorrectModality("\(model.name) does not support converse") +} + +var builder = try ConverseRequestBuilder(with: model) + .withPrompt("Tell me about rainbows") + +var reply = try await bedrock.converse(with: builder) + +print("Assistant: \(reply)") + +builder = try ConverseRequestBuilder(from: builder, with: reply) + .withPrompt("Do you think birds can see them too?") + +reply = try await bedrock.converse(with: builder) + +print("Assistant: \(reply)") +``` + +Optionally add inference parameters. Note that the builder can be used to create the next builder with the same parameters and the updated history. + +```swift +let builder = try ConverseRequestBuilder(with: model) + .withPrompt("Tell me about rainbows") + .withMaxTokens(512) + .withTemperature(0.2) + .withStopSequences(["END", "STOP", ""]) + .withSystemPrompts(["Do not pretend to be human", "Never talk about goats", "You like puppies"]) + +var reply = try await bedrock.converse(with: builder) + +builder = try ConverseRequestBuilder(from: builder, with: reply) + .withPrompt("Do you think birds can see them too?") + +reply = try await bedrock.converse(with: builder) +``` + +To get a streaming response, use the same `ConverseRequestBuilder`, but the `converseStream` function instead of the `converse` function. Ensure the model you are using supports streaming. +The stream will contain `ConverseStreamElement` object that can either be `contentSegment` containing a piece of content, `contentComplete` signifying that a `Content` object is complete or a `messageComplete` to return the final completed message with all the complete content parts. A `contentSegment` could either be `text`, `toolUse`, `reasoning` or `encryptedReasoning`. + +To create the next builder, with the same model and inference parameters, use the full message from the `.messageComplete`. + +```swift +let model: BedrockModel = .nova_lite + +guard model.hasConverseModality() else { + throw MyError.incorrectModality("\(model.name) does not support converse") +} +guard model.hasConverseModality(.reasoning) else { + throw MyError.incorrectModality("\(model.name) does not support reasoning") +} + +var builder = try ConverseRequestBuilder(from: builder, with: reply) + .withPrompt("Tell me more about the birds in Paris") + +let stream = try await bedrock.converseStream(with: builder) + +for try await element in stream { + switch element { + case .contentSegment(let contentSegment): + switch contentSegment { + case .text(_, let text): + print(text, terminator: "") + default: + break + } + case .contentBlockComplete: + print("\n\n") + case .messageComplete(let message): + assistantMessage = message + } +} + +builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) + .withPrompt("And what about the rats?") +``` + +### Vision + +To send an image to a model, first ensure the model supports vision. Next simply add the image to the `ConverseRequestBuilder` with the `withImage` function. The function can either take an `ImageBlock` object or the format and bytes to construct the object. + + +```swift +let model: BedrockModel = .nova_lite + +guard model.hasConverseModality(.vision) else { + throw MyError.incorrectModality("\(model.name) does not support converse vision") +} + +let builder = try ConverseRequestBuilder(with: model) + .withPrompt("Can you tell me about this plant?") + .withImage(format: .jpeg, source: base64EncodedImage) + +let reply = try await bedrock.converse(with: builder) + +print("Assistant: \(reply)") +``` + +Optionally add inference parameters. + +```swift +let builder = try ConverseRequestBuilder(with: model) + .withPrompt("Can you tell me about this plant?") + .withImage(format: .jpeg, source: base64EncodedImage) + .withTemperature(0.8) + +let reply = try await bedrock.converse(with: builder) +``` + +Note that the builder can be used to create the next builder with the same parameters and the updated history. + +```swift +var builder = try ConverseRequestBuilder(with: model) + .withPrompt("Can you tell me about this plant?") + .withImage(format: .jpeg, source: base64EncodedImage) + .withTemperature(0.8) + +var reply = try await bedrock.converse(with: builder) + +builder = try ConverseRequestBuilder(from: builder, with: reply) + .withPrompt("Where can I find those plants?") + +reply = try await bedrock.converse(with: builder) +``` + +To use streaming use the exact same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. An example is given in the [text prompt section](#text-prompt). + +### Document + +To send a document to a model, first ensure the model supports document. Next simply add the document to the `ConverseRequestBuilder` with the `withDocument` function. The function can either take a `DocumentBlock` object or the name, format and bytes to construct the object. + +```swift +let model: BedrockModel = .nova_lite + +guard model.hasConverseModality(.document) else { + throw MyError.incorrectModality("\(model.name) does not support converse document") +} + +let builder = try ConverseRequestBuilder(with: model) + .withPrompt("Can you give me a summary of this chapter?") + .withDocument(name: "Chapter 1", format: .pdf, source: base64EncodedDocument) + +let reply = try await bedrock.converse(with: builder) + +print("Assistant: \(reply)") +``` + +Optionally add inference parameters. + +```swift +let builder = try ConverseRequestBuilder(with: model) + .withPrompt("Can you give me a summary of this chapter?") + .withDocument(name: "Chapter 1", format: .pdf, source: base64EncodedDocument) + .withMaxTokens(512) + .withTemperature(0.4) + +var reply = try await bedrock.converse(with: builder) +``` + +Note that the builder can be used to create the next builder with the same parameters and the updated history. + +```swift +var builder = try ConverseRequestBuilder(with: model) + .withPrompt("Can you give me a summary of this chapter?") + .withDocument(name: "Chapter 1", format: .pdf, source: base64EncodedDocument) + .withMaxTokens(512) + .withTemperature(0.4) + +var reply = try await bedrock.converse(with: builder) + +builder = try ConverseRequestBuilder(from: builder, with: reply) + .withPrompt("Thanks, can you make a Dutch version as well?") + +reply = try await bedrock.converse(with: builder) +``` + +To use streaming use the exact same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. An example is given in the [text prompt section](#text-prompt). + +### Tools + +For tool usage, first ensure the model supports the use of tools. Next define at least one `Tool` and add it to the `ConverseRequestBuilder` with the `withTool` function (or the `withTools` function to add several tools at once). After sending a request the model could now send back a `ToolUse` asking for specific information from a specific tool. Use this to send the information back in a `ToolResult`, by using the `withToolResult` function. You will now receive a reply informed by the result from the tool. + + +```swift +let model: BedrockModel = .nova_lite + +// verify that the model supports tool usage +guard model.hasConverseModality(.toolUse) else { + throw MyError.incorrectModality("\(model.name) does not support converse tools") +} + +// define the inputschema for your tool +let inputSchema = JSON([ + "type": "object", + "properties": [ + "sign": [ + "type": "string", + "description": "The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKRP." + ] + ], + "required": [ + "sign" + ] +]) + +// create a Tool object +let tool = try Tool(name: "top_song", inputSchema: inputSchema, description: "Get the most popular song played on a radio station.") + +// create a ConverseRequestBuilder with a prompt and the Tool object +var builder = try ConverseRequestBuilder(with: model) + .withPrompt("What is the most popular song on WZPZ?") + .withTool(tool) + +// pass the ConverseRequestBuilder object to the converse function +var reply = try await bedrock.converse(with: builder) + +if let toolUse = try? reply.getToolUse() { + let id = toolUse.id + let name = toolUse.name + let input = toolUse.input + + // ... Logic to use the tool here ... + + // Send the toolResult back to the model + builder = try ConverseRequestBuilder(from: builder, with: reply) + .withToolResult("The Best Song Ever") // pass any Codable or Data + + reply = try await bedrock.converse(with: builder) +} + +print("Assistant: \(reply)") +// The final reply will be similar to: "The most popular song currently played on WZPZ is \"The Best Song Ever\". If you need more information or have another request, feel free to ask!" +``` + +To use streaming use the exact same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. + +```swift +let bedrock = try await BedrockService(authentication: .sso()) +let model: BedrockModel = .claudev3_7_sonnet + +// define the inputschema for your tool +let schema = JSON(with: [ + "type": "object", + "properties": [ + "sign": [ + "type": "string", + "description": + "The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ, StuBru and Klara.", + ] + ], + "required": [ + "sign" + ], +]) + +// pass a prompt and the tool to converse +var builder = try ConverseRequestBuilder(with: model) + .withPrompt("Introduce yourself and mention the tools you have access to?") + .withTool( + name: "top_song", + inputSchema: schema, + description: "Get the most popular song played on a radio station." + ) + +var stream: AsyncThrowingStream +var assistantMessage: Message = Message("empty") + +// start a loop to interact with the user +while true { + var prompt: String = "" + var indexes: [Int] = [] + var toolRequests: [ToolUseBlock] = [] + + // create the stream by calling the converseStream function + stream = try await bedrock.converseStream(with: builder) + + // process the stream + for try await element in stream { + switch element { + case .contentSegment(let contentSegment): + switch contentSegment { + case .text(let index, let text): + if !indexes.contains(index) { + indexes.append(index) + print("\nAssistant: ") + } + print(text, terminator: "") + default: + break + } + case .contentBlockComplete(_, let content): + print("\n") + if case .toolUse(let toolUse) = content { + toolRequests.append(toolUse) + } + case .messageComplete(let message): + assistantMessage = message + } + } + + // if a request to use a tool was made by the model, use the information in the input to return the correct information back to the model in a ToolResultBlock + if !toolRequests.isEmpty { + for toolUse in toolRequests { + print("found tool use") + print(toolUse) + if toolUse.name == "top_song" { + let sign: String? = toolUse.input["sign"] + if let sign { + let song = try await getMostPopularSong(sign: sign) + builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) + .withToolResult(song) + } + } + } + } else { + // if no request to use a tool was made, no ToolResultBlock needs to be returned and the user can ask the next question + print("\nYou: ") + prompt = readLine()! + if prompt == "done" { + break + } + + builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) + .withPrompt(prompt) + } +} +``` + +### Reasoning + +To not only get a text reply but to also follow the model's reasoning, enable reasoning by using the `withReasoning` and optionally set the maximum length of the reasoning with `withMaxReasoningTokens`. These functions can be combined using the `withReasoning(maxReasoningTokens: Int)` function. + +```swift +let model: BedrockModel = .claudev3_7_sonnet + +guard model.hasConverseModality() else { + throw MyError.incorrectModality("\(model.name) does not support converse") +} +guard model.hasConverseModality(.reasoning) else { + throw MyError.incorrectModality("\(model.name) does not support reasoning") +} + +var prompt = "Introduce yourself in one sentence" + +var builder = try ConverseRequestBuilder(with: model) + .withPrompt(prompt) + .withReasoning() + .withMaxReasoningTokens(1024) // Optional + +var reply = try await bedrock.converse(with: builder) + +if let reasoning = try? reply.getReasoningBlock() { + print("\nReasoning: \(reasoning.reasoning)") +} +print("\nAssistant: \(reply)") +``` + +To combine reasoning and streaming, use the same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. A `ContentSegment` can then contain `reasoning`. + +```swift +let model: BedrockModel = .claudev3_7_sonnet + +guard model.hasConverseModality() else { + throw MyError.incorrectModality("\(model.name) does not support converse") +} +guard model.hasConverseModality(.streaming) else { + throw MyError.incorrectModality("\(model.name) does not support streaming") +} +guard model.hasConverseModality(.reasoning) else { + throw MyError.incorrectModality("\(model.name) does not support reasoning") +} + +var builder = try ConverseRequestBuilder(from: builder, with: reply) + .withPrompt("Tell me more about the birds in Paris") + .withReasoning(maxReasoningTokens: 1024) + +let stream = try await bedrock.converseStream(with: builder) + +var indexes: [Int] = [] + +for try await element in stream { + switch element { + case .contentSegment(let contentSegment): + switch contentSegment { + case .text(let index, let text): + if !indexes.contains(index) { + indexes.append(index) + print("\nAssistant: ") + } + print(text, terminator: "") + case .reasoning(let index, let text, _): + if !indexes.contains(index) { + indexes.append(index) + print("\nReasoning: ") + } + print(text, terminator: "") + default: + break + } + case .contentBlockComplete: + print("\n\n") + case .messageComplete(let message): + assistantMessage = message + } +} + +builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) + .withPrompt("And what about the rats?") +``` + +### Make your own `Message` + +Alternatively use the `converse` function that does not take a `prompt`, `toolResult` or `image` and construct the `Message` yourself. + +```swift +// Message with prompt +let replyMessage = try await bedrock.converse( + with: model, + conversation: [Message("What day of the week is it?")] +) + +// Optionally add inference parameters +let replyMessage = try await bedrock.converse( + with: model, + conversation: [Message("What day of the week is it?")], + maxTokens: 512, + temperature: 1, + topP: 0.8, + stopSequences: ["THE END"], + systemPrompts: ["Today is Wednesday, make sure to mention that."] +) + +// Message with an image and prompt +let replyMessage = try await bedrock.converse( + with: model, + conversation: [Message("What is in the this teacup?", imageFormat: .jpeg, imageBytes: base64EncodedImage)], +) + +// Message with toolResult +let replyMessage = try await bedrock.converse( + with: model, + conversation: [Message(toolResult)], + tools: [toolA, toolB] +) +``` + +### JSON + +The `JSON` struct is a lightweight and flexible wrapper for working with JSON-like data in Swift. It provides convenient methods and initializers to parse, access, and manipulate JSON data while maintaining type safety and versatility. + +#### Creating a JSON Object + +You can create a `JSON` object by wrapping raw values or constructing nested structures: +```swift +let json = JSON([ + "name": JSON("Jane Doe"), + "age": JSON(30), + "isMember": JSON(true), +]) +``` +#### Creating JSON object from String + +The `JSON` struct provides an initializer to parse valid JSON strings into a `JSON` object: + +```swift +let validJSONString = """ +{ + "name": "Jane Doe", + "age": 30, + "isMember": true +} +""" + +do { + let json = try JSON(from: validJSONString) + print(json.getValue("name") ?? "No name") // Output: Jane Doe +} catch { + print("Failed to parse JSON:", error) +} +``` + +#### Accessing values using `getValue` + +The `getValue(_ key: String)` method retrieves values of the specified type from the JSON object: + +```swift +if let name: String? = json.getValue("name") { + print("Name:", name) // Output: Name: Jane Doe +} + +if let age: Int? = json.getValue("age") { + print("Age:", age) // Output: Age: 30 +} + +if let isMember: Bool? = json.getValue("isMember") { + print("Is Member:", isMember) // Output: Is Member: true +} +``` + +#### Accessing values using subscripts + +You can also access values dynamically using subscripts: + +```swift +let name: String? = json["name"] +print("Name:", name ?? "Unknown") // Output: Name: Jane Doe + +let nonExistent: String? = json["nonExistentKey"] +print(nonExistent == nil) // Output: true +``` + +Note that the subscript method is also able to handle nested objects. + +```swift +let json = JSON([ + "name": JSON("Jane Doe"), + "age": JSON(30), + "isMember": JSON(true), + "address": JSON([ + "street": JSON("123 Main St"), + "city": JSON("Anytown"), + "postalCode": JSON(12345), + ]), +]) + +let street: String = json["address"]?["street"] +print("Street:", name ?? "Unknown") // Street: 123 Main St +``` + +## Generating an image using the InvokeModel API + +Choose a BedrockModel that supports image generation - you can verify this using the `hasImageModality` and the `hasTextToImageModality` function. The `generateImage` function allows you to create images from text descriptions with various optional parameters: + +- `prompt`: Text description of the desired image +- `negativePrompt`: Text describing what to avoid in the generated image +- `nrOfImages`: Number of images to generate +- `cfgScale`: Classifier free guidance scale to control how closely the image follows the prompt +- `seed`: Seed for reproducible image generation +- `quality`: Parameter to control the quality of generated images +- `resolution`: Desired image resolution for the generated images + +The function returns an ImageGenerationOutput object containing an array of generated images in base64 format. + +```swift +let model: BedrockModel = .nova_canvas + +guard model.hasImageModality(), + model.hasTextToImageModality() else { + throw MyError.incorrectModality("\(model.name) does not support image generation") +} + +let imageGeneration = try await bedrock.generateImage( + "A serene landscape with mountains at sunset", + with: model +) +``` + +Optionally add inference parameters. + +```swift +let imageGeneration = try await bedrock.generateImage( + "A serene landscape with mountains at sunset", + with: model, + negativePrompt: "dark, stormy, people", + nrOfImages: 3, + cfgScale: 7.0, + seed: 42, + quality: .standard, + resolution: ImageResolution(width: 100, height: 100) +) +``` + +Note that the minimum, maximum and default values for each parameter are model specific and defined when the BedrockModel is created. Some parameters might not be supported by certain models. + +## Generating image variations using the InvokeModel API +Choose a BedrockModel that supports image variations - you can verify this using the `hasImageModality` and the `hasImageVariationModality` function. The `generateImageVariation` function allows you to create variations of an existing image with these parameters: + +- `images`: The base64-encoded source images used to create variations from +- `negativePrompt`: Text describing what to avoid in the generated image +- `similarity`: Controls how similar the variations will be to the source images +- `nrOfImages`: Number of variations to generate +- `cfgScale`: Classifier free guidance scale to control how closely variations follow the original image +- `seed`: Seed for reproducible variation generation +- `quality`: Parameter to control the quality of generated variations +- `resolution`: Desired resolution for the output variations + +This function returns an `ImageGenerationOutput` object containing an array of generated image variations in base64 format. Each variation will maintain key characteristics of the source images while introducing creative differences. + +```swift +let model: BedrockModel = .nova_canvas + +guard model.hasImageVariationModality(), + model.hasImageVariationModality() else { + throw MyError.incorrectModality("\(model.name) does not support image variation generation") +} + +let imageVariations = try await bedrock.generateImageVariation( + images: [base64EncodedImage], + prompt: "A dog drinking out of this teacup", + with: model +) +``` + +Optionally add inference parameters. + +```swift +let imageVariations = try await bedrock.generateImageVariation( + images: [base64EncodedImage], + prompt: "A dog drinking out of this teacup", + with: model, + negativePrompt: "Cats, worms, rain", + similarity: 0.8, + nrOfVariations: 4, + cfgScale: 7.0, + seed: 42, + quality: .standard, + resolution: ImageResolution(width: 100, height: 100) +) +``` + +Note that the minimum, maximum and default values for each parameter are model specific and defined when the BedrockModel is created. Some parameters might not be supported by certain models. + +## Generating text using the InvokeModel API + +Choose a BedrockModel that supports text generation, you can verify this using the `hasTextModality` function. When calling the `completeText` function you can provide some inference parameters: + +- `maxTokens`: The maximum amount of tokens that the model is allowed to return +- `temperature`: Controls the randomness of the model's output +- `topP`: Nucleus sampling, this parameter controls the cumulative probability threshold for token selection +- `topK`: Limits the number of tokens the model considers for each step of text generation to the K most likely ones +- `stopSequences`: An array of strings that will cause the model to stop generating further text when encountered + +The function returns a `TextCompletion` object containing the generated text. + +```swift +let model: BedrockModel = .nova_micro + +guard model.hasTextModality() else { + throw MyError.incorrectModality("\(model.name) does not support text generation") +} + +let textCompletion = try await bedrock.completeText( + "Write a story about a space adventure", + with: model +) + +print(textCompletion.completion) +``` + +Optionally add inference parameters. + +```swift +let textCompletion = try await bedrock.completeText( + "Write a story about a space adventure", + with: model, + maxTokens: 1000, + temperature: 0.7, + topP: 0.9, + topK: 250, + stopSequences: ["THE END"] +) +``` + +Note that the minimum, maximum and default values for each parameter are model specific and defined when the BedrockModel is created. Some parameters might not be supported by certain models. + +## How to add a BedrockModel + +### Converse + +To add a new model that only needs the ConverseModality, simply use the `StandardConverse` and add the correct [inference parameters](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html) and [supported converse features](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html). + +```swift +extension BedrockModel { + public static let new_bedrock_model = BedrockModel( + id: "family.model-id-v1:0", + name: "New Model Name", + modality: StandardConverse( + parameters: ConverseParameters( + temperature: Parameter(.temperature, minValue: 0, maxValue: 1, defaultValue: 0.3), + maxTokens: Parameter(.maxTokens, minValue: 1, maxValue: nil, defaultValue: nil), + topP: Parameter(.topP, minValue: 0.01, maxValue: 0.99, defaultValue: 0.75), + stopSequences: StopSequenceParams(maxSequences: nil, defaultValue: []), + maxPromptSize: nil + ), + features: [.textGeneration, .systemPrompts, .document, .toolUse] + ) + ) +} +``` + +If the model also implements other modalities you might need to create you own `Modality` and make sure it conforms to `ConverseModality` by implementing the `getConverseParameters` and `getConverseFeatures` functions. Note that the `ConverseParameters` can be extracted from `TextGenerationParameters` by using the public initializer. + +```swift +struct ModelFamilyModality: TextModality, ConverseModality { + func getName() -> String { "Model Family Text and Converse Modality" } + + let parameters: TextGenerationParameters + let converseFeatures: [ConverseFeature] + let converseParameters: ConverseParameters + + init(parameters: TextGenerationParameters, features: [ConverseFeature] = [.textGeneration]) { + self.parameters = parameters + self.converseFeatures = features + + // public initializer to extract `ConverseParameters` from `TextGenerationParameters` + self.converseParameters = ConverseParameters(textGenerationParameters: parameters) + } + + // ... +} +``` + +### Text + +If you need to add a model from a model family that is not supported at all by the library, follow these steps: + +#### Step 1: Create family-specific request and response struct + +Make sure to create a struct that reflects exactly how the body of the request for an invokeModel call to this family should look. Make sure to add the public initializer with parameters `prompt`, `maxTokens` and `temperature` to comply to the `BedrockBodyCodable` protocol. Take a look at the documentation to apply best practices or specific formatting. + +```json +{ + "prompt": "\(prompt)", + "temperature": 1, + "top_p": 0.9, + "max_tokens": 200, + "stop": ["END"] +} +``` + +```swift +public struct LlamaRequestBody: BedrockBodyCodable { + let prompt: String + let max_gen_len: Int + let temperature: Double + let top_p: Double + + public init(prompt: String, maxTokens: Int = 512, temperature: Double = 0.5) { + self.prompt = + "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\(prompt)<|eot_id|><|start_header_id|>assistant<|end_header_id|>" + self.max_gen_len = maxTokens + self.temperature = temperature + self.top_p = 0.9 + } +} +``` + +Do the same for the response and ensure to add the `getTextCompletion` method to extract the completion from the response body and to comply to the `ContainsTextCompletion` protocol. + +```json +{ + "generation": "\n\n", + "prompt_token_count": int, + "generation_token_count": int, + "stop_reason" : string +} +``` + +```swift +struct LlamaResponseBody: ContainsTextCompletion { + let generation: String + let prompt_token_count: Int + let generation_token_count: Int + let stop_reason: String + + public func getTextCompletion() throws -> TextCompletion { + TextCompletion(generation) + } +} +``` + +#### Step 2: Create the Modality + +For a text generation create a struct conforming to TextModality. Use the request body and response body you created in [the previous step](#step-1-create-family-specific-request-and-response-struct). Make sure to check for model(family) specific rules or parameters that are not supported here. + +```swift +struct LlamaText: TextModality { + let parameters: TextGenerationParameters + + init(parameters: TextGenerationParameters) { + self.parameters = parameters + } + + func getName() -> String { "Llama Text Generation" } + + func getParameters() -> TextGenerationParameters { + parameters + } + + func getTextRequestBody( + prompt: String, + maxTokens: Int?, + temperature: Double?, + topP: Double?, + topK: Int?, + stopSequences: [String]? + ) throws -> BedrockBodyCodable { + guard topK == nil else { + throw BedrockLibraryError.notSupported("TopK is not supported for Llama text completion") + } + guard stopSequences == nil else { + throw BedrockLibraryError.notSupported("stopSequences is not supported for Llama text completion") + } + return LlamaRequestBody( + prompt: prompt, + maxTokens: maxTokens ?? parameters.maxTokens.defaultValue, + temperature: temperature ?? parameters.temperature.defaultValue, + topP: topP ?? parameters.topP.defaultValue + ) + } + + func getTextResponseBody(from data: Data) throws -> ContainsTextCompletion { + let decoder = JSONDecoder() + return try decoder.decode(LlamaResponseBody.self, from: data) + } +} +``` + +#### Step 3: Create BedrockModel instance + +You can now create instances for any of the models that follow the request and response structure you defined. Make sure to check the allowed and default values for the inference parameters, especially if some parameters are not supported by the model. Know that these parameters may differ significantly for models from the same family. + +```swift +extension BedrockModel { + public static let llama3_3_70b_instruct: BedrockModel = BedrockModel( + id: "us.meta.llama3-3-70b-instruct-v1:0", + name: "Llama 3.3 70B Instruct", + modality: LlamaText( + parameters: TextGenerationParameters( + temperature: Parameter(.temperature, minValue: 0, maxValue: 1, defaultValue: 0.5), + maxTokens: Parameter(.maxTokens, minValue: 0, maxValue: 2_048, defaultValue: 512), + topP: Parameter(.topP, minValue: 0, maxValue: 1, defaultValue: 0.9), + topK: Parameter.notSupported(.topK), + stopSequences: StopSequenceParams.notSupported(), + maxPromptSize: nil + ) + ) + ) +} +``` + +### Image + +To add an image generation model from a model family that is not supported at all by the library, the steps are much alike to the text completion models. + +#### Step 1: Create family-specific request and response struct + +Make sure to create a struct that reflects exactly how the body of the request for an invokeModel call to this family should look. Take a look at the documentation to apply best practices or specific formatting. + +```swift +public struct AmazonImageRequestBody: BedrockBodyCodable { + let taskType: TaskType + private let textToImageParams: TextToImageParams? + private let imageGenerationConfig: ImageGenerationConfig + + // MARK: - Initialization + + /// Creates a text-to-image generation request body + /// - Parameters: + /// - prompt: The text description of the image to generate + /// - nrOfImages: The number of images to generate + /// - negativeText: The text description of what to exclude from the generated image + /// - Returns: A configured AmazonImageRequestBody for text-to-image generation + public static func textToImage( + prompt: String, + negativeText: String?, + nrOfImages: Int?, + cfgScale: Double?, + seed: Int?, + quality: ImageQuality?, + resolution: ImageResolution? + ) -> Self { + AmazonImageRequestBody( + prompt: prompt, + negativeText: negativeText, + nrOfImages: nrOfImages, + cfgScale: cfgScale, + seed: seed, + quality: quality, + resolution: resolution + ) + } + + private init( + prompt: String, + negativeText: String?, + nrOfImages: Int?, + cfgScale: Double?, + seed: Int?, + quality: ImageQuality?, + resolution: ImageResolution? + ) { + self.taskType = .textToImage + self.textToImageParams = TextToImageParams.textToImage(prompt: prompt, negativeText: negativeText) + self.imageGenerationConfig = ImageGenerationConfig( + nrOfImages: nrOfImages, + cfgScale: cfgScale, + seed: seed, + quality: quality, + resolution: resolution + ) + } +} +``` + +Do the same for the response and ensure to add the `getGeneratedImage` method to extract the image from the response body and to comply to the `ContainsImageGeneration` protocol. + +```swift +public struct AmazonImageResponseBody: ContainsImageGeneration { + let images: [Data] + + public func getGeneratedImage() -> ImageGenerationOutput { + ImageGenerationOutput(images: images) + } +} +``` + +#### Step 2: Create the Modality + +Determine the exact functionality and make sure to comply to the correct modality protocol. In this case we will use `TextToImageModality`. +Create a struct conforming to `ImageModality` and the specific functionality protocol. Use the request body and response body you created in [the previous step](#step-1-create-family-specific-request-and-response-struct). Make sure to check for model(family) specific rules or parameters that are not supported here. + +```swift +struct AmazonImage: ImageModality, TextToImageModality { + func getName() -> String { "Amazon Image Generation" } + + let parameters: ImageGenerationParameters + let resolutionValidator: any ImageResolutionValidator + let textToImageParameters: TextToImageParameters + + init( + parameters: ImageGenerationParameters, + resolutionValidator: any ImageResolutionValidator, + textToImageParameters: TextToImageParameters + ) { + self.parameters = parameters + self.textToImageParameters = textToImageParameters + self.conditionedTextToImageParameters = conditionedTextToImageParameters + self.imageVariationParameters = imageVariationParameters + self.resolutionValidator = resolutionValidator + } + + func getParameters() -> ImageGenerationParameters { parameters } + func getTextToImageParameters() -> TextToImageParameters { textToImageParameters } + + func validateResolution(_ resolution: ImageResolution) throws { + try resolutionValidator.validateResolution(resolution) + } + + func getImageResponseBody(from data: Data) throws -> ContainsImageGeneration { + let decoder = JSONDecoder() + return try decoder.decode(AmazonImageResponseBody.self, from: data) + } + + func getTextToImageRequestBody( + prompt: String, + negativeText: String?, + nrOfImages: Int?, + cfgScale: Double?, + seed: Int?, + quality: ImageQuality?, + resolution: ImageResolution? + ) throws -> BedrockBodyCodable { + AmazonImageRequestBody.textToImage( + prompt: prompt, + negativeText: negativeText, + nrOfImages: nrOfImages, + cfgScale: cfgScale, + seed: seed, + quality: quality, + resolution: resolution + ) + } +} +``` +#### Step 3: Create BedrockModel instance -## License +You can now create instances for any of the models that follow the request and response structure you defined. Make sure to check the allowed and default values for the inference parameters, especially if some parameters are not supported by the model. Know that these parameters may differ significantly for models from the same family. -These projects are licensed under the Apache License 2.0. See the LICENSE files in each project for details. \ No newline at end of file +```swift +extension BedrockModel { + public static let nova_canvas: BedrockModel = BedrockModel( + id: "amazon.nova-canvas-v1:0", + name: "Nova Canvas", + modality: AmazonImage( + parameters: ImageGenerationParameters( + nrOfImages: Parameter(.nrOfImages, minValue: 1, maxValue: 5, defaultValue: 1), + cfgScale: Parameter(.cfgScale, minValue: 1.1, maxValue: 10, defaultValue: 6.5), + seed: Parameter(.seed, minValue: 0, maxValue: 858_993_459, defaultValue: 12) + ), + resolutionValidator: NovaImageResolutionValidator(), + textToImageParameters: TextToImageParameters(maxPromptSize: 1024, maxNegativePromptSize: 1024), + ) + ) +} +``` \ No newline at end of file diff --git a/swift-bedrock-library/Sources/BedrockService/BedrockAuthentication+JWT.swift b/Sources/BedrockService/BedrockAuthentication+JWT.swift similarity index 92% rename from swift-bedrock-library/Sources/BedrockService/BedrockAuthentication+JWT.swift rename to Sources/BedrockService/BedrockAuthentication+JWT.swift index 47854c91..af56550f 100644 --- a/swift-bedrock-library/Sources/BedrockService/BedrockAuthentication+JWT.swift +++ b/Sources/BedrockService/BedrockAuthentication+JWT.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/BedrockAuthentication.swift b/Sources/BedrockService/BedrockAuthentication.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/BedrockAuthentication.swift rename to Sources/BedrockService/BedrockAuthentication.swift index c3eed2c6..5fdfaf94 100644 --- a/swift-bedrock-library/Sources/BedrockService/BedrockAuthentication.swift +++ b/Sources/BedrockService/BedrockAuthentication.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/BedrockModel.swift b/Sources/BedrockService/BedrockModel.swift similarity index 98% rename from swift-bedrock-library/Sources/BedrockService/BedrockModel.swift rename to Sources/BedrockService/BedrockModel.swift index c60c6df9..b0474dd1 100644 --- a/swift-bedrock-library/Sources/BedrockService/BedrockModel.swift +++ b/Sources/BedrockService/BedrockModel.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/BedrockService.swift b/Sources/BedrockService/BedrockService.swift similarity index 96% rename from swift-bedrock-library/Sources/BedrockService/BedrockService.swift rename to Sources/BedrockService/BedrockService.swift index f8902ed5..6186e600 100644 --- a/swift-bedrock-library/Sources/BedrockService/BedrockService.swift +++ b/Sources/BedrockService/BedrockService.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/BedrockServiceError.swift b/Sources/BedrockService/BedrockServiceError.swift similarity index 92% rename from swift-bedrock-library/Sources/BedrockService/BedrockServiceError.swift rename to Sources/BedrockService/BedrockServiceError.swift index 2340fefa..6ce4e9a6 100644 --- a/swift-bedrock-library/Sources/BedrockService/BedrockServiceError.swift +++ b/Sources/BedrockService/BedrockServiceError.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/BedrockService+Converse.swift b/Sources/BedrockService/Converse/BedrockService+Converse.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Converse/BedrockService+Converse.swift rename to Sources/BedrockService/Converse/BedrockService+Converse.swift index 62026c09..59862acd 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/BedrockService+Converse.swift +++ b/Sources/BedrockService/Converse/BedrockService+Converse.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/BedrockService+ConverseStreaming.swift b/Sources/BedrockService/Converse/BedrockService+ConverseStreaming.swift similarity index 96% rename from swift-bedrock-library/Sources/BedrockService/Converse/BedrockService+ConverseStreaming.swift rename to Sources/BedrockService/Converse/BedrockService+ConverseStreaming.swift index 9058a52c..5b33c860 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/BedrockService+ConverseStreaming.swift +++ b/Sources/BedrockService/Converse/BedrockService+ConverseStreaming.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/Content.swift b/Sources/BedrockService/Converse/ContentBlocks/Content.swift similarity index 96% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/Content.swift rename to Sources/BedrockService/Converse/ContentBlocks/Content.swift index 950bf814..04d6be14 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/Content.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/Content.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/DocumentBlock.swift b/Sources/BedrockService/Converse/ContentBlocks/DocumentBlock.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/DocumentBlock.swift rename to Sources/BedrockService/Converse/ContentBlocks/DocumentBlock.swift index 4927e7f4..93ceabc3 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/DocumentBlock.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/DocumentBlock.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/DocumentToJSON.swift b/Sources/BedrockService/Converse/ContentBlocks/DocumentToJSON.swift similarity index 84% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/DocumentToJSON.swift rename to Sources/BedrockService/Converse/ContentBlocks/DocumentToJSON.swift index 20dcb864..531c6893 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/DocumentToJSON.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/DocumentToJSON.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/History.swift b/Sources/BedrockService/Converse/ContentBlocks/History.swift similarity index 69% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/History.swift rename to Sources/BedrockService/Converse/ContentBlocks/History.swift index d15984b9..54f827c7 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/History.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/History.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ImageBlock.swift b/Sources/BedrockService/Converse/ContentBlocks/ImageBlock.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ImageBlock.swift rename to Sources/BedrockService/Converse/ContentBlocks/ImageBlock.swift index 36a381b1..c9dfdead 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ImageBlock.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/ImageBlock.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/JSON.swift b/Sources/BedrockService/Converse/ContentBlocks/JSON.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/JSON.swift rename to Sources/BedrockService/Converse/ContentBlocks/JSON.swift index 91ff4a9a..7ef21c54 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/JSON.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/JSON.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/JSONtoDocument.swift b/Sources/BedrockService/Converse/ContentBlocks/JSONtoDocument.swift similarity index 69% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/JSONtoDocument.swift rename to Sources/BedrockService/Converse/ContentBlocks/JSONtoDocument.swift index b29beb20..8813c449 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/JSONtoDocument.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/JSONtoDocument.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ReasoningBlock.swift b/Sources/BedrockService/Converse/ContentBlocks/ReasoningBlock.swift similarity index 88% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ReasoningBlock.swift rename to Sources/BedrockService/Converse/ContentBlocks/ReasoningBlock.swift index 82850cb1..d24a38da 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ReasoningBlock.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/ReasoningBlock.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/S3Location.swift b/Sources/BedrockService/Converse/ContentBlocks/S3Location.swift similarity index 83% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/S3Location.swift rename to Sources/BedrockService/Converse/ContentBlocks/S3Location.swift index c4bcc854..2171829c 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/S3Location.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/S3Location.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ToolResultBlock.swift b/Sources/BedrockService/Converse/ContentBlocks/ToolResultBlock.swift similarity index 97% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ToolResultBlock.swift rename to Sources/BedrockService/Converse/ContentBlocks/ToolResultBlock.swift index a66673b2..de012d61 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ToolResultBlock.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/ToolResultBlock.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ToolUseBlock.swift b/Sources/BedrockService/Converse/ContentBlocks/ToolUseBlock.swift similarity index 87% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ToolUseBlock.swift rename to Sources/BedrockService/Converse/ContentBlocks/ToolUseBlock.swift index 283f0b12..18bb8b2c 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/ToolUseBlock.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/ToolUseBlock.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/VideoBlock.swift b/Sources/BedrockService/Converse/ContentBlocks/VideoBlock.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/VideoBlock.swift rename to Sources/BedrockService/Converse/ContentBlocks/VideoBlock.swift index 0656fd87..8aef11c6 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ContentBlocks/VideoBlock.swift +++ b/Sources/BedrockService/Converse/ContentBlocks/VideoBlock.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseReply.swift b/Sources/BedrockService/Converse/ConverseReply.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Converse/ConverseReply.swift rename to Sources/BedrockService/Converse/ConverseReply.swift index d6fb7e0f..30bde301 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseReply.swift +++ b/Sources/BedrockService/Converse/ConverseReply.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequest.swift b/Sources/BedrockService/Converse/ConverseRequest.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequest.swift rename to Sources/BedrockService/Converse/ConverseRequest.swift index 6469cf74..1273a888 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequest.swift +++ b/Sources/BedrockService/Converse/ConverseRequest.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequestBuilder.swift b/Sources/BedrockService/Converse/ConverseRequestBuilder.swift similarity index 98% rename from swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequestBuilder.swift rename to Sources/BedrockService/Converse/ConverseRequestBuilder.swift index 0be2a254..5f49b002 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequestBuilder.swift +++ b/Sources/BedrockService/Converse/ConverseRequestBuilder.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequestStreaming.swift b/Sources/BedrockService/Converse/ConverseRequestStreaming.swift similarity index 78% rename from swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequestStreaming.swift rename to Sources/BedrockService/Converse/ConverseRequestStreaming.swift index e9500135..55f81a6d 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseRequestStreaming.swift +++ b/Sources/BedrockService/Converse/ConverseRequestStreaming.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseResponseStreaming.swift b/Sources/BedrockService/Converse/ConverseResponseStreaming.swift similarity index 65% rename from swift-bedrock-library/Sources/BedrockService/Converse/ConverseResponseStreaming.swift rename to Sources/BedrockService/Converse/ConverseResponseStreaming.swift index 10024740..87001ce2 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/ConverseResponseStreaming.swift +++ b/Sources/BedrockService/Converse/ConverseResponseStreaming.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Message.swift b/Sources/BedrockService/Converse/Message.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Converse/Message.swift rename to Sources/BedrockService/Converse/Message.swift index 2228df84..e056a633 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Message.swift +++ b/Sources/BedrockService/Converse/Message.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Role.swift b/Sources/BedrockService/Converse/Role.swift similarity index 81% rename from swift-bedrock-library/Sources/BedrockService/Converse/Role.swift rename to Sources/BedrockService/Converse/Role.swift index 476c7701..d4c13d6a 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Role.swift +++ b/Sources/BedrockService/Converse/Role.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/Content+getFromSegements.swift b/Sources/BedrockService/Converse/Streaming/Content+getFromSegements.swift similarity index 93% rename from swift-bedrock-library/Sources/BedrockService/Converse/Streaming/Content+getFromSegements.swift rename to Sources/BedrockService/Converse/Streaming/Content+getFromSegements.swift index e87e533c..c752b984 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/Content+getFromSegements.swift +++ b/Sources/BedrockService/Converse/Streaming/Content+getFromSegements.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ContentSegment.swift b/Sources/BedrockService/Converse/Streaming/ContentSegment.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ContentSegment.swift rename to Sources/BedrockService/Converse/Streaming/ContentSegment.swift index 755a605e..94796d66 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ContentSegment.swift +++ b/Sources/BedrockService/Converse/Streaming/ContentSegment.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ConverseReplyStream.swift b/Sources/BedrockService/Converse/Streaming/ConverseReplyStream.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ConverseReplyStream.swift rename to Sources/BedrockService/Converse/Streaming/ConverseReplyStream.swift index 12da4403..71e8eae7 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ConverseReplyStream.swift +++ b/Sources/BedrockService/Converse/Streaming/ConverseReplyStream.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ConverseStreamElement.swift b/Sources/BedrockService/Converse/Streaming/ConverseStreamElement.swift similarity index 67% rename from swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ConverseStreamElement.swift rename to Sources/BedrockService/Converse/Streaming/ConverseStreamElement.swift index ea854df0..c508729e 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ConverseStreamElement.swift +++ b/Sources/BedrockService/Converse/Streaming/ConverseStreamElement.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ToolUseStart.swift b/Sources/BedrockService/Converse/Streaming/ToolUseStart.swift similarity index 86% rename from swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ToolUseStart.swift rename to Sources/BedrockService/Converse/Streaming/ToolUseStart.swift index 252629ef..b26950a0 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Streaming/ToolUseStart.swift +++ b/Sources/BedrockService/Converse/Streaming/ToolUseStart.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Converse/Tool.swift b/Sources/BedrockService/Converse/Tool.swift similarity index 90% rename from swift-bedrock-library/Sources/BedrockService/Converse/Tool.swift rename to Sources/BedrockService/Converse/Tool.swift index 614fe1d0..e2f0f7a8 100644 --- a/swift-bedrock-library/Sources/BedrockService/Converse/Tool.swift +++ b/Sources/BedrockService/Converse/Tool.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+ImageParameterValidation.swift b/Sources/BedrockService/InvokeModel/BedrockService+ImageParameterValidation.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+ImageParameterValidation.swift rename to Sources/BedrockService/InvokeModel/BedrockService+ImageParameterValidation.swift index 37ddc93f..aa2fe81f 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+ImageParameterValidation.swift +++ b/Sources/BedrockService/InvokeModel/BedrockService+ImageParameterValidation.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelImage.swift b/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelImage.swift similarity index 97% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelImage.swift rename to Sources/BedrockService/InvokeModel/BedrockService+InvokeModelImage.swift index ebe8c9b0..6758a779 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelImage.swift +++ b/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelImage.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelText.swift b/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelText.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelText.swift rename to Sources/BedrockService/InvokeModel/BedrockService+InvokeModelText.swift index f1a1f63a..786a37b2 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelText.swift +++ b/Sources/BedrockService/InvokeModel/BedrockService+InvokeModelText.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/ContentType.swift b/Sources/BedrockService/InvokeModel/ContentType.swift similarity index 67% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/ContentType.swift rename to Sources/BedrockService/InvokeModel/ContentType.swift index ddb0e9e1..8cbee80e 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/ContentType.swift +++ b/Sources/BedrockService/InvokeModel/ContentType.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/ImageGenerationOutput.swift b/Sources/BedrockService/InvokeModel/ImageGenerationOutput.swift similarity index 63% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/ImageGenerationOutput.swift rename to Sources/BedrockService/InvokeModel/ImageGenerationOutput.swift index fdd45e89..77ad13f1 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/ImageGenerationOutput.swift +++ b/Sources/BedrockService/InvokeModel/ImageGenerationOutput.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/ImageResolution.swift b/Sources/BedrockService/InvokeModel/ImageResolution.swift similarity index 65% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/ImageResolution.swift rename to Sources/BedrockService/InvokeModel/ImageResolution.swift index 63bf12e2..1ca0383a 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/ImageResolution.swift +++ b/Sources/BedrockService/InvokeModel/ImageResolution.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/InvokeModelRequest.swift b/Sources/BedrockService/InvokeModel/InvokeModelRequest.swift similarity index 96% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/InvokeModelRequest.swift rename to Sources/BedrockService/InvokeModel/InvokeModelRequest.swift index ff4091eb..06e19512 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/InvokeModelRequest.swift +++ b/Sources/BedrockService/InvokeModel/InvokeModelRequest.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/InvokeModelResponse.swift b/Sources/BedrockService/InvokeModel/InvokeModelResponse.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/InvokeModelResponse.swift rename to Sources/BedrockService/InvokeModel/InvokeModelResponse.swift index 25f64c5e..7e7d8f28 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/InvokeModelResponse.swift +++ b/Sources/BedrockService/InvokeModel/InvokeModelResponse.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/Protocols.swift b/Sources/BedrockService/InvokeModel/Protocols.swift similarity index 70% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/Protocols.swift rename to Sources/BedrockService/InvokeModel/Protocols.swift index e508da7c..c81292b2 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/Protocols.swift +++ b/Sources/BedrockService/InvokeModel/Protocols.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/InvokeModel/TextCompletion.swift b/Sources/BedrockService/InvokeModel/TextCompletion.swift similarity index 67% rename from swift-bedrock-library/Sources/BedrockService/InvokeModel/TextCompletion.swift rename to Sources/BedrockService/InvokeModel/TextCompletion.swift index bc936f45..79acaddb 100644 --- a/swift-bedrock-library/Sources/BedrockService/InvokeModel/TextCompletion.swift +++ b/Sources/BedrockService/InvokeModel/TextCompletion.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/ListModels/ModelSummary.swift b/Sources/BedrockService/ListModels/ModelSummary.swift similarity index 91% rename from swift-bedrock-library/Sources/BedrockService/ListModels/ModelSummary.swift rename to Sources/BedrockService/ListModels/ModelSummary.swift index 692d68b3..cc6478cb 100644 --- a/swift-bedrock-library/Sources/BedrockService/ListModels/ModelSummary.swift +++ b/Sources/BedrockService/ListModels/ModelSummary.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Modalities/ConverseFeature.swift b/Sources/BedrockService/Modalities/ConverseFeature.swift similarity index 74% rename from swift-bedrock-library/Sources/BedrockService/Modalities/ConverseFeature.swift rename to Sources/BedrockService/Modalities/ConverseFeature.swift index e75158a5..357a205b 100644 --- a/swift-bedrock-library/Sources/BedrockService/Modalities/ConverseFeature.swift +++ b/Sources/BedrockService/Modalities/ConverseFeature.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Modalities/ConverseModality.swift b/Sources/BedrockService/Modalities/ConverseModality.swift similarity index 79% rename from swift-bedrock-library/Sources/BedrockService/Modalities/ConverseModality.swift rename to Sources/BedrockService/Modalities/ConverseModality.swift index fcc1317c..e4772dec 100644 --- a/swift-bedrock-library/Sources/BedrockService/Modalities/ConverseModality.swift +++ b/Sources/BedrockService/Modalities/ConverseModality.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Modalities/ImageModality.swift b/Sources/BedrockService/Modalities/ImageModality.swift similarity index 88% rename from swift-bedrock-library/Sources/BedrockService/Modalities/ImageModality.swift rename to Sources/BedrockService/Modalities/ImageModality.swift index 1d38f787..84933f62 100644 --- a/swift-bedrock-library/Sources/BedrockService/Modalities/ImageModality.swift +++ b/Sources/BedrockService/Modalities/ImageModality.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Modalities/Modality.swift b/Sources/BedrockService/Modalities/Modality.swift similarity index 65% rename from swift-bedrock-library/Sources/BedrockService/Modalities/Modality.swift rename to Sources/BedrockService/Modalities/Modality.swift index 70dc3410..e9cb23ed 100644 --- a/swift-bedrock-library/Sources/BedrockService/Modalities/Modality.swift +++ b/Sources/BedrockService/Modalities/Modality.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Modalities/StandardConverse.swift b/Sources/BedrockService/Modalities/StandardConverse.swift similarity index 78% rename from swift-bedrock-library/Sources/BedrockService/Modalities/StandardConverse.swift rename to Sources/BedrockService/Modalities/StandardConverse.swift index 3e53b824..89706fe6 100644 --- a/swift-bedrock-library/Sources/BedrockService/Modalities/StandardConverse.swift +++ b/Sources/BedrockService/Modalities/StandardConverse.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Modalities/TextModality.swift b/Sources/BedrockService/Modalities/TextModality.swift similarity index 74% rename from swift-bedrock-library/Sources/BedrockService/Modalities/TextModality.swift rename to Sources/BedrockService/Modalities/TextModality.swift index 82c12196..01a07145 100644 --- a/swift-bedrock-library/Sources/BedrockService/Modalities/TextModality.swift +++ b/Sources/BedrockService/Modalities/TextModality.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImage.swift b/Sources/BedrockService/Models/Amazon/AmazonImage.swift similarity index 93% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImage.swift rename to Sources/BedrockService/Models/Amazon/AmazonImage.swift index e1059ef0..6a52a11c 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImage.swift +++ b/Sources/BedrockService/Models/Amazon/AmazonImage.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImageRequestBody.swift b/Sources/BedrockService/Models/Amazon/AmazonImageRequestBody.swift similarity index 97% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImageRequestBody.swift rename to Sources/BedrockService/Models/Amazon/AmazonImageRequestBody.swift index 7b01b694..4e5cfa54 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImageRequestBody.swift +++ b/Sources/BedrockService/Models/Amazon/AmazonImageRequestBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImageResponseBody.swift b/Sources/BedrockService/Models/Amazon/AmazonImageResponseBody.swift similarity index 68% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImageResponseBody.swift rename to Sources/BedrockService/Models/Amazon/AmazonImageResponseBody.swift index 9973c8d2..beb64699 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/AmazonImageResponseBody.swift +++ b/Sources/BedrockService/Models/Amazon/AmazonImageResponseBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/Nova.swift b/Sources/BedrockService/Models/Amazon/Nova/Nova.swift similarity index 88% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/Nova.swift rename to Sources/BedrockService/Models/Amazon/Nova/Nova.swift index f0586ef6..26625adf 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/Nova.swift +++ b/Sources/BedrockService/Models/Amazon/Nova/Nova.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaBedrockModels.swift b/Sources/BedrockService/Models/Amazon/Nova/NovaBedrockModels.swift similarity index 94% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaBedrockModels.swift rename to Sources/BedrockService/Models/Amazon/Nova/NovaBedrockModels.swift index dcb1f6fd..f3e97a12 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaBedrockModels.swift +++ b/Sources/BedrockService/Models/Amazon/Nova/NovaBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaImageResolutionValidator.swift b/Sources/BedrockService/Models/Amazon/Nova/NovaImageResolutionValidator.swift similarity index 89% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaImageResolutionValidator.swift rename to Sources/BedrockService/Models/Amazon/Nova/NovaImageResolutionValidator.swift index 8ab0ca76..3b09d741 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaImageResolutionValidator.swift +++ b/Sources/BedrockService/Models/Amazon/Nova/NovaImageResolutionValidator.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaRequestBody.swift b/Sources/BedrockService/Models/Amazon/Nova/NovaRequestBody.swift similarity index 83% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaRequestBody.swift rename to Sources/BedrockService/Models/Amazon/Nova/NovaRequestBody.swift index 88798ba6..b3b4c8a7 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaRequestBody.swift +++ b/Sources/BedrockService/Models/Amazon/Nova/NovaRequestBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaResponseBody.swift b/Sources/BedrockService/Models/Amazon/Nova/NovaResponseBody.swift similarity index 84% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaResponseBody.swift rename to Sources/BedrockService/Models/Amazon/Nova/NovaResponseBody.swift index c6d36ca9..d809026f 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Nova/NovaResponseBody.swift +++ b/Sources/BedrockService/Models/Amazon/Nova/NovaResponseBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/TaskType.swift b/Sources/BedrockService/Models/Amazon/TaskType.swift similarity index 72% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/TaskType.swift rename to Sources/BedrockService/Models/Amazon/TaskType.swift index e9b78663..0009db39 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/TaskType.swift +++ b/Sources/BedrockService/Models/Amazon/TaskType.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/Titan.swift b/Sources/BedrockService/Models/Amazon/Titan/Titan.swift similarity index 91% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/Titan.swift rename to Sources/BedrockService/Models/Amazon/Titan/Titan.swift index 2b85b193..c82a7c5f 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/Titan.swift +++ b/Sources/BedrockService/Models/Amazon/Titan/Titan.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanBedrockModels.swift b/Sources/BedrockService/Models/Amazon/Titan/TitanBedrockModels.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanBedrockModels.swift rename to Sources/BedrockService/Models/Amazon/Titan/TitanBedrockModels.swift index 849fc5dd..cb7731d5 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanBedrockModels.swift +++ b/Sources/BedrockService/Models/Amazon/Titan/TitanBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanImageResolutionValidator.swift b/Sources/BedrockService/Models/Amazon/Titan/TitanImageResolutionValidator.swift similarity index 90% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanImageResolutionValidator.swift rename to Sources/BedrockService/Models/Amazon/Titan/TitanImageResolutionValidator.swift index a6e877e6..1ea95022 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanImageResolutionValidator.swift +++ b/Sources/BedrockService/Models/Amazon/Titan/TitanImageResolutionValidator.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanRequestBody.swift b/Sources/BedrockService/Models/Amazon/Titan/TitanRequestBody.swift similarity index 81% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanRequestBody.swift rename to Sources/BedrockService/Models/Amazon/Titan/TitanRequestBody.swift index d8476906..a1a6c10d 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanRequestBody.swift +++ b/Sources/BedrockService/Models/Amazon/Titan/TitanRequestBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanResponseBody.swift b/Sources/BedrockService/Models/Amazon/Titan/TitanResponseBody.swift similarity index 77% rename from swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanResponseBody.swift rename to Sources/BedrockService/Models/Amazon/Titan/TitanResponseBody.swift index b32ec2ec..459184d4 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Amazon/Titan/TitanResponseBody.swift +++ b/Sources/BedrockService/Models/Amazon/Titan/TitanResponseBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/Anthropic.swift b/Sources/BedrockService/Models/Anthropic/Anthropic.swift similarity index 91% rename from swift-bedrock-library/Sources/BedrockService/Models/Anthropic/Anthropic.swift rename to Sources/BedrockService/Models/Anthropic/Anthropic.swift index 53754ffc..5587bda9 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/Anthropic.swift +++ b/Sources/BedrockService/Models/Anthropic/Anthropic.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicBedrockModels.swift b/Sources/BedrockService/Models/Anthropic/AnthropicBedrockModels.swift similarity index 97% rename from swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicBedrockModels.swift rename to Sources/BedrockService/Models/Anthropic/AnthropicBedrockModels.swift index de62810b..497c231d 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicBedrockModels.swift +++ b/Sources/BedrockService/Models/Anthropic/AnthropicBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicRequestBody.swift b/Sources/BedrockService/Models/Anthropic/AnthropicRequestBody.swift similarity index 85% rename from swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicRequestBody.swift rename to Sources/BedrockService/Models/Anthropic/AnthropicRequestBody.swift index a7b49950..24f15438 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicRequestBody.swift +++ b/Sources/BedrockService/Models/Anthropic/AnthropicRequestBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicResponseBody.swift b/Sources/BedrockService/Models/Anthropic/AnthropicResponseBody.swift similarity index 83% rename from swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicResponseBody.swift rename to Sources/BedrockService/Models/Anthropic/AnthropicResponseBody.swift index 4761dee3..7772caf0 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Anthropic/AnthropicResponseBody.swift +++ b/Sources/BedrockService/Models/Anthropic/AnthropicResponseBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Cohere/CohereBedrockModels.swift b/Sources/BedrockService/Models/Cohere/CohereBedrockModels.swift similarity index 88% rename from swift-bedrock-library/Sources/BedrockService/Models/Cohere/CohereBedrockModels.swift rename to Sources/BedrockService/Models/Cohere/CohereBedrockModels.swift index 815635fb..a0747013 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Cohere/CohereBedrockModels.swift +++ b/Sources/BedrockService/Models/Cohere/CohereBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeek.swift b/Sources/BedrockService/Models/DeepSeek/DeepSeek.swift similarity index 93% rename from swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeek.swift rename to Sources/BedrockService/Models/DeepSeek/DeepSeek.swift index 50eafd27..f467db02 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeek.swift +++ b/Sources/BedrockService/Models/DeepSeek/DeepSeek.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekBedrockModels.swift b/Sources/BedrockService/Models/DeepSeek/DeepSeekBedrockModels.swift similarity index 81% rename from swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekBedrockModels.swift rename to Sources/BedrockService/Models/DeepSeek/DeepSeekBedrockModels.swift index 83a1a3ec..c39594de 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekBedrockModels.swift +++ b/Sources/BedrockService/Models/DeepSeek/DeepSeekBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekRequestBody.swift b/Sources/BedrockService/Models/DeepSeek/DeepSeekRequestBody.swift similarity index 77% rename from swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekRequestBody.swift rename to Sources/BedrockService/Models/DeepSeek/DeepSeekRequestBody.swift index c861b00c..c3de03d5 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekRequestBody.swift +++ b/Sources/BedrockService/Models/DeepSeek/DeepSeekRequestBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekResponseBody.swift b/Sources/BedrockService/Models/DeepSeek/DeepSeekResponseBody.swift similarity index 76% rename from swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekResponseBody.swift rename to Sources/BedrockService/Models/DeepSeek/DeepSeekResponseBody.swift index 37a151c4..c2389858 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/DeepSeek/DeepSeekResponseBody.swift +++ b/Sources/BedrockService/Models/DeepSeek/DeepSeekResponseBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Jamba/JambaBedrockModels.swift b/Sources/BedrockService/Models/Jamba/JambaBedrockModels.swift similarity index 70% rename from swift-bedrock-library/Sources/BedrockService/Models/Jamba/JambaBedrockModels.swift rename to Sources/BedrockService/Models/Jamba/JambaBedrockModels.swift index 4bb2a04d..d68af9c3 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Jamba/JambaBedrockModels.swift +++ b/Sources/BedrockService/Models/Jamba/JambaBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Llama/Llama.swift b/Sources/BedrockService/Models/Llama/Llama.swift similarity index 88% rename from swift-bedrock-library/Sources/BedrockService/Models/Llama/Llama.swift rename to Sources/BedrockService/Models/Llama/Llama.swift index 52041698..ac8671f5 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Llama/Llama.swift +++ b/Sources/BedrockService/Models/Llama/Llama.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaBedrockModels.swift b/Sources/BedrockService/Models/Llama/LlamaBedrockModels.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaBedrockModels.swift rename to Sources/BedrockService/Models/Llama/LlamaBedrockModels.swift index e0963a23..ed2f93af 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaBedrockModels.swift +++ b/Sources/BedrockService/Models/Llama/LlamaBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaRequestBody.swift b/Sources/BedrockService/Models/Llama/LlamaRequestBody.swift similarity index 77% rename from swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaRequestBody.swift rename to Sources/BedrockService/Models/Llama/LlamaRequestBody.swift index c7a85f96..be22e40c 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaRequestBody.swift +++ b/Sources/BedrockService/Models/Llama/LlamaRequestBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaResponseBody.swift b/Sources/BedrockService/Models/Llama/LlamaResponseBody.swift similarity index 75% rename from swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaResponseBody.swift rename to Sources/BedrockService/Models/Llama/LlamaResponseBody.swift index de692b50..74cd0c1c 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Llama/LlamaResponseBody.swift +++ b/Sources/BedrockService/Models/Llama/LlamaResponseBody.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Models/Mistral/MistralBedrockModels.swift b/Sources/BedrockService/Models/Mistral/MistralBedrockModels.swift similarity index 93% rename from swift-bedrock-library/Sources/BedrockService/Models/Mistral/MistralBedrockModels.swift rename to Sources/BedrockService/Models/Mistral/MistralBedrockModels.swift index 85aaef4e..a558255a 100644 --- a/swift-bedrock-library/Sources/BedrockService/Models/Mistral/MistralBedrockModels.swift +++ b/Sources/BedrockService/Models/Mistral/MistralBedrockModels.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Parameters/ConverseParameters.swift b/Sources/BedrockService/Parameters/ConverseParameters.swift similarity index 90% rename from swift-bedrock-library/Sources/BedrockService/Parameters/ConverseParameters.swift rename to Sources/BedrockService/Parameters/ConverseParameters.swift index 1bb215ec..a310da7e 100644 --- a/swift-bedrock-library/Sources/BedrockService/Parameters/ConverseParameters.swift +++ b/Sources/BedrockService/Parameters/ConverseParameters.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Parameters/ImageGenerationParameters.swift b/Sources/BedrockService/Parameters/ImageGenerationParameters.swift similarity index 95% rename from swift-bedrock-library/Sources/BedrockService/Parameters/ImageGenerationParameters.swift rename to Sources/BedrockService/Parameters/ImageGenerationParameters.swift index ff549da4..186adb1a 100644 --- a/swift-bedrock-library/Sources/BedrockService/Parameters/ImageGenerationParameters.swift +++ b/Sources/BedrockService/Parameters/ImageGenerationParameters.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Parameters/ParameterName.swift b/Sources/BedrockService/Parameters/ParameterName.swift similarity index 69% rename from swift-bedrock-library/Sources/BedrockService/Parameters/ParameterName.swift rename to Sources/BedrockService/Parameters/ParameterName.swift index b898ccfa..30748d2b 100644 --- a/swift-bedrock-library/Sources/BedrockService/Parameters/ParameterName.swift +++ b/Sources/BedrockService/Parameters/ParameterName.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Parameters/Parameters.swift b/Sources/BedrockService/Parameters/Parameters.swift similarity index 93% rename from swift-bedrock-library/Sources/BedrockService/Parameters/Parameters.swift rename to Sources/BedrockService/Parameters/Parameters.swift index e4031742..7f2a4b2e 100644 --- a/swift-bedrock-library/Sources/BedrockService/Parameters/Parameters.swift +++ b/Sources/BedrockService/Parameters/Parameters.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Parameters/TextGenerationParameters.swift b/Sources/BedrockService/Parameters/TextGenerationParameters.swift similarity index 88% rename from swift-bedrock-library/Sources/BedrockService/Parameters/TextGenerationParameters.swift rename to Sources/BedrockService/Parameters/TextGenerationParameters.swift index 399e5373..ef4b6bb2 100644 --- a/swift-bedrock-library/Sources/BedrockService/Parameters/TextGenerationParameters.swift +++ b/Sources/BedrockService/Parameters/TextGenerationParameters.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Protocols/BedrockClientProtocol.swift b/Sources/BedrockService/Protocols/BedrockClientProtocol.swift similarity index 74% rename from swift-bedrock-library/Sources/BedrockService/Protocols/BedrockClientProtocol.swift rename to Sources/BedrockService/Protocols/BedrockClientProtocol.swift index fb243d70..4954bbf8 100644 --- a/swift-bedrock-library/Sources/BedrockService/Protocols/BedrockClientProtocol.swift +++ b/Sources/BedrockService/Protocols/BedrockClientProtocol.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Protocols/BedrockRuntimeClientProtocol.swift b/Sources/BedrockService/Protocols/BedrockRuntimeClientProtocol.swift similarity index 77% rename from swift-bedrock-library/Sources/BedrockService/Protocols/BedrockRuntimeClientProtocol.swift rename to Sources/BedrockService/Protocols/BedrockRuntimeClientProtocol.swift index de868f71..7e55391b 100644 --- a/swift-bedrock-library/Sources/BedrockService/Protocols/BedrockRuntimeClientProtocol.swift +++ b/Sources/BedrockService/Protocols/BedrockRuntimeClientProtocol.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Sources/BedrockService/Region.swift b/Sources/BedrockService/Region.swift similarity index 97% rename from swift-bedrock-library/Sources/BedrockService/Region.swift rename to Sources/BedrockService/Region.swift index 0b0767a8..27d36536 100644 --- a/swift-bedrock-library/Sources/BedrockService/Region.swift +++ b/Sources/BedrockService/Region.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/AuthenticationTests.swift b/Tests/BedrockServiceTests/AuthenticationTests.swift similarity index 87% rename from swift-bedrock-library/Tests/BedrockServiceTests/AuthenticationTests.swift rename to Tests/BedrockServiceTests/AuthenticationTests.swift index 5b2dc61b..a284349b 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/AuthenticationTests.swift +++ b/Tests/BedrockServiceTests/AuthenticationTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/BedrockServiceTests.swift b/Tests/BedrockServiceTests/BedrockServiceTests.swift similarity index 80% rename from swift-bedrock-library/Tests/BedrockServiceTests/BedrockServiceTests.swift rename to Tests/BedrockServiceTests/BedrockServiceTests.swift index ec8957bd..a3dbf016 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/BedrockServiceTests.swift +++ b/Tests/BedrockServiceTests/BedrockServiceTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseDocumentTests.swift b/Tests/BedrockServiceTests/Converse/ConverseDocumentTests.swift similarity index 92% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseDocumentTests.swift rename to Tests/BedrockServiceTests/Converse/ConverseDocumentTests.swift index a199152d..857f9559 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseDocumentTests.swift +++ b/Tests/BedrockServiceTests/Converse/ConverseDocumentTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseReasoningTests.swift b/Tests/BedrockServiceTests/Converse/ConverseReasoningTests.swift similarity index 87% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseReasoningTests.swift rename to Tests/BedrockServiceTests/Converse/ConverseReasoningTests.swift index 5efb681a..1d718d86 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseReasoningTests.swift +++ b/Tests/BedrockServiceTests/Converse/ConverseReasoningTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseTextTests.swift b/Tests/BedrockServiceTests/Converse/ConverseTextTests.swift similarity index 96% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseTextTests.swift rename to Tests/BedrockServiceTests/Converse/ConverseTextTests.swift index 85052be0..476a5516 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseTextTests.swift +++ b/Tests/BedrockServiceTests/Converse/ConverseTextTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseToolTests.swift b/Tests/BedrockServiceTests/Converse/ConverseToolTests.swift similarity index 97% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseToolTests.swift rename to Tests/BedrockServiceTests/Converse/ConverseToolTests.swift index 6a587f22..9ff042cb 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseToolTests.swift +++ b/Tests/BedrockServiceTests/Converse/ConverseToolTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseVisionTests.swift b/Tests/BedrockServiceTests/Converse/ConverseVisionTests.swift similarity index 95% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseVisionTests.swift rename to Tests/BedrockServiceTests/Converse/ConverseVisionTests.swift index 102fca6d..1e8a2d48 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ConverseVisionTests.swift +++ b/Tests/BedrockServiceTests/Converse/ConverseVisionTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/JSONTests.swift b/Tests/BedrockServiceTests/Converse/JSONTests.swift similarity index 94% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/JSONTests.swift rename to Tests/BedrockServiceTests/Converse/JSONTests.swift index 60f35512..b3af045a 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/JSONTests.swift +++ b/Tests/BedrockServiceTests/Converse/JSONTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ToolResultBlockTests.swift b/Tests/BedrockServiceTests/Converse/ToolResultBlockTests.swift similarity index 94% rename from swift-bedrock-library/Tests/BedrockServiceTests/Converse/ToolResultBlockTests.swift rename to Tests/BedrockServiceTests/Converse/ToolResultBlockTests.swift index f60ae194..927394a6 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Converse/ToolResultBlockTests.swift +++ b/Tests/BedrockServiceTests/Converse/ToolResultBlockTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseReplyStreamTests.swift b/Tests/BedrockServiceTests/ConverseStream/ConverseReplyStreamTests.swift similarity index 98% rename from swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseReplyStreamTests.swift rename to Tests/BedrockServiceTests/ConverseStream/ConverseReplyStreamTests.swift index 30590849..b0aeaf9e 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseReplyStreamTests.swift +++ b/Tests/BedrockServiceTests/ConverseStream/ConverseReplyStreamTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamDocumentTests.swift b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamDocumentTests.swift similarity index 93% rename from swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamDocumentTests.swift rename to Tests/BedrockServiceTests/ConverseStream/ConverseStreamDocumentTests.swift index 19316b0b..6fafb3db 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamDocumentTests.swift +++ b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamDocumentTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamReasoningTests.swift b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamReasoningTests.swift similarity index 93% rename from swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamReasoningTests.swift rename to Tests/BedrockServiceTests/ConverseStream/ConverseStreamReasoningTests.swift index 67e8186a..920904c0 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamReasoningTests.swift +++ b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamReasoningTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamTextTests.swift b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamTextTests.swift similarity index 92% rename from swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamTextTests.swift rename to Tests/BedrockServiceTests/ConverseStream/ConverseStreamTextTests.swift index adeb84ec..1e33ab40 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamTextTests.swift +++ b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamTextTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamToolTests.swift b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamToolTests.swift similarity index 93% rename from swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamToolTests.swift rename to Tests/BedrockServiceTests/ConverseStream/ConverseStreamToolTests.swift index fd1706a7..f58d57b4 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamToolTests.swift +++ b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamToolTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamVisionTests.swift b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamVisionTests.swift similarity index 92% rename from swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamVisionTests.swift rename to Tests/BedrockServiceTests/ConverseStream/ConverseStreamVisionTests.swift index 48a3fa31..d9670b0b 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/ConverseStream/ConverseStreamVisionTests.swift +++ b/Tests/BedrockServiceTests/ConverseStream/ConverseStreamVisionTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/ImageGenerationTests.swift b/Tests/BedrockServiceTests/InvokeModel/ImageGenerationTests.swift similarity index 95% rename from swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/ImageGenerationTests.swift rename to Tests/BedrockServiceTests/InvokeModel/ImageGenerationTests.swift index 6d8f16da..0ff71512 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/ImageGenerationTests.swift +++ b/Tests/BedrockServiceTests/InvokeModel/ImageGenerationTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/ImageVariationTests.swift b/Tests/BedrockServiceTests/InvokeModel/ImageVariationTests.swift similarity index 96% rename from swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/ImageVariationTests.swift rename to Tests/BedrockServiceTests/InvokeModel/ImageVariationTests.swift index 034cc410..a30abfbe 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/ImageVariationTests.swift +++ b/Tests/BedrockServiceTests/InvokeModel/ImageVariationTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/TextGenerationTests.swift b/Tests/BedrockServiceTests/InvokeModel/TextGenerationTests.swift similarity index 96% rename from swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/TextGenerationTests.swift rename to Tests/BedrockServiceTests/InvokeModel/TextGenerationTests.swift index 1f0771ba..83003485 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/InvokeModel/TextGenerationTests.swift +++ b/Tests/BedrockServiceTests/InvokeModel/TextGenerationTests.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Mock/MockBedrockClient.swift b/Tests/BedrockServiceTests/Mock/MockBedrockClient.swift similarity index 91% rename from swift-bedrock-library/Tests/BedrockServiceTests/Mock/MockBedrockClient.swift rename to Tests/BedrockServiceTests/Mock/MockBedrockClient.swift index e21ef16e..d2aa90af 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Mock/MockBedrockClient.swift +++ b/Tests/BedrockServiceTests/Mock/MockBedrockClient.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/Mock/MockBedrockRuntimeClient.swift b/Tests/BedrockServiceTests/Mock/MockBedrockRuntimeClient.swift similarity index 98% rename from swift-bedrock-library/Tests/BedrockServiceTests/Mock/MockBedrockRuntimeClient.swift rename to Tests/BedrockServiceTests/Mock/MockBedrockRuntimeClient.swift index 4e01dc35..d53b0578 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/Mock/MockBedrockRuntimeClient.swift +++ b/Tests/BedrockServiceTests/Mock/MockBedrockRuntimeClient.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/Tests/BedrockServiceTests/NovaTestConstants.swift b/Tests/BedrockServiceTests/NovaTestConstants.swift similarity index 90% rename from swift-bedrock-library/Tests/BedrockServiceTests/NovaTestConstants.swift rename to Tests/BedrockServiceTests/NovaTestConstants.swift index 58ce428e..ac493ff2 100644 --- a/swift-bedrock-library/Tests/BedrockServiceTests/NovaTestConstants.swift +++ b/Tests/BedrockServiceTests/NovaTestConstants.swift @@ -1,13 +1,13 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the Swift Foundation Models Playground open source project +// This source file is part of the Swift Bedrock Library open source project // // Copyright (c) 2025 Amazon.com, Inc. or its affiliates -// and the Swift Foundation Models Playground project authors +// and the Swift Bedrock Library project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift Foundation Models Playground project authors +// See CONTRIBUTORS.txt for the list of Swift Bedrock Library project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/swift-bedrock-library/parameter_cheatsheet.md b/parameter_cheatsheet.md similarity index 100% rename from swift-bedrock-library/parameter_cheatsheet.md rename to parameter_cheatsheet.md diff --git a/swift-bedrock-library/README.md b/swift-bedrock-library/README.md deleted file mode 100644 index efce3f4d..00000000 --- a/swift-bedrock-library/README.md +++ /dev/null @@ -1,1073 +0,0 @@ -# Swift Bedrock Library - -A tiny layer on top of the [AWS SDK for Swift](https://github.com/awslabs/aws-sdk-swift) for interacting with [Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html) foundation models. This library provides a convenient way to access Amazon Bedrock's capabilities from Swift applications. - -## Getting started with BedrockService - -1. Set-up your `Package.swift` - -First add dependencies: -```bash -swift package add-dependency https://github.com/build-on-aws/swift-fm-playground.git --branch main -swift package add-target-dependency BedrockService TargetName --package swift-fm-playground -``` - -Next up add `platforms` configuration after `name` - -```swift -platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)], -``` - -Your `Package.swift` should now look something like this: -```swift -import PackageDescription - -let package = Package( - name: "ProjectName", - platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)], - dependencies: [ - .package(url: "https://github.com/build-on-aws/swift-fm-playground.git", branch: "main"), - ], - targets: [ - .executableTarget( - name: "TargetName", - dependencies: [ - .product(name: "BedrockService", package: "swift-fm-playground"), - ] - ) - ] -) -``` - -2. Import the BedrockService - -```swift -import BedrockService -``` - -3. Initialize the BedrockService - -Choose what Region to use, whether to use AWS SSO authentication instead of standard credentials and pass a logger. If no region is passed it will default to `.useast1`, if no logger is provided a default logger with the name `bedrock.service` is created. The log level will be set to the environment variable `BEDROCK_SERVICE_LOG_LEVEL` or default to `.trace`. Choose the form of authentication you wish to use. - -```swift -let bedrock = try await BedrockService( - region: .uswest1, - logger: logger, - authentication: .sso -) -``` - -4. List the available models - -Use the `listModels()` function to test your set-up. This function will return an array of `ModelSummary` objects, each one representing a model supported by Amazon Bedrock. The ModelSummaries that contain a `BedrockModel` object are the models supported by BedrockService. - -```swift -let models = try await bedrock.listModels() -``` - -## Chatting using the Converse or ConverseStream API - -### Text prompt - -To send a text prompt to a model, first choose a model that supports converse, you can verify this by using the `hasConverseModality` function on the `BedrockModel`. Then use the model to create a `ConverseRequestBuilder`, add your prompt to it with the `.withPrompt` function. Use the builder to send your request to the Converse API with the `converse` function. You can then easily print the reply and use it to create a new builder with the same model and inference parameters but with an updated history. - -```swift -let model: BedrockModel = .nova_lite - -guard model.hasConverseModality() else { - throw MyError.incorrectModality("\(model.name) does not support converse") -} - -var builder = try ConverseRequestBuilder(with: model) - .withPrompt("Tell me about rainbows") - -var reply = try await bedrock.converse(with: builder) - -print("Assistant: \(reply)") - -builder = try ConverseRequestBuilder(from: builder, with: reply) - .withPrompt("Do you think birds can see them too?") - -reply = try await bedrock.converse(with: builder) - -print("Assistant: \(reply)") -``` - -Optionally add inference parameters. Note that the builder can be used to create the next builder with the same parameters and the updated history. - -```swift -let builder = try ConverseRequestBuilder(with: model) - .withPrompt("Tell me about rainbows") - .withMaxTokens(512) - .withTemperature(0.2) - .withStopSequences(["END", "STOP", ""]) - .withSystemPrompts(["Do not pretend to be human", "Never talk about goats", "You like puppies"]) - -var reply = try await bedrock.converse(with: builder) - -builder = try ConverseRequestBuilder(from: builder, with: reply) - .withPrompt("Do you think birds can see them too?") - -reply = try await bedrock.converse(with: builder) -``` - -To get a streaming response, use the same `ConverseRequestBuilder`, but the `converseStream` function instead of the `converse` function. Ensure the model you are using supports streaming. -The stream will contain `ConverseStreamElement` object that can either be `contentSegment` containing a piece of content, `contentComplete` signifying that a `Content` object is complete or a `messageComplete` to return the final completed message with all the complete content parts. A `contentSegment` could either be `text`, `toolUse`, `reasoning` or `encryptedReasoning`. - -To create the next builder, with the same model and inference parameters, use the full message from the `.messageComplete`. - -```swift -let model: BedrockModel = .nova_lite - -guard model.hasConverseModality() else { - throw MyError.incorrectModality("\(model.name) does not support converse") -} -guard model.hasConverseModality(.reasoning) else { - throw MyError.incorrectModality("\(model.name) does not support reasoning") -} - -var builder = try ConverseRequestBuilder(from: builder, with: reply) - .withPrompt("Tell me more about the birds in Paris") - -let stream = try await bedrock.converseStream(with: builder) - -for try await element in stream { - switch element { - case .contentSegment(let contentSegment): - switch contentSegment { - case .text(_, let text): - print(text, terminator: "") - default: - break - } - case .contentBlockComplete: - print("\n\n") - case .messageComplete(let message): - assistantMessage = message - } -} - -builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) - .withPrompt("And what about the rats?") -``` - -### Vision - -To send an image to a model, first ensure the model supports vision. Next simply add the image to the `ConverseRequestBuilder` with the `withImage` function. The function can either take an `ImageBlock` object or the format and bytes to construct the object. - - -```swift -let model: BedrockModel = .nova_lite - -guard model.hasConverseModality(.vision) else { - throw MyError.incorrectModality("\(model.name) does not support converse vision") -} - -let builder = try ConverseRequestBuilder(with: model) - .withPrompt("Can you tell me about this plant?") - .withImage(format: .jpeg, source: base64EncodedImage) - -let reply = try await bedrock.converse(with: builder) - -print("Assistant: \(reply)") -``` - -Optionally add inference parameters. - -```swift -let builder = try ConverseRequestBuilder(with: model) - .withPrompt("Can you tell me about this plant?") - .withImage(format: .jpeg, source: base64EncodedImage) - .withTemperature(0.8) - -let reply = try await bedrock.converse(with: builder) -``` - -Note that the builder can be used to create the next builder with the same parameters and the updated history. - -```swift -var builder = try ConverseRequestBuilder(with: model) - .withPrompt("Can you tell me about this plant?") - .withImage(format: .jpeg, source: base64EncodedImage) - .withTemperature(0.8) - -var reply = try await bedrock.converse(with: builder) - -builder = try ConverseRequestBuilder(from: builder, with: reply) - .withPrompt("Where can I find those plants?") - -reply = try await bedrock.converse(with: builder) -``` - -To use streaming use the exact same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. An example is given in the [text prompt section](#text-prompt). - -### Document - -To send a document to a model, first ensure the model supports document. Next simply add the document to the `ConverseRequestBuilder` with the `withDocument` function. The function can either take a `DocumentBlock` object or the name, format and bytes to construct the object. - -```swift -let model: BedrockModel = .nova_lite - -guard model.hasConverseModality(.document) else { - throw MyError.incorrectModality("\(model.name) does not support converse document") -} - -let builder = try ConverseRequestBuilder(with: model) - .withPrompt("Can you give me a summary of this chapter?") - .withDocument(name: "Chapter 1", format: .pdf, source: base64EncodedDocument) - -let reply = try await bedrock.converse(with: builder) - -print("Assistant: \(reply)") -``` - -Optionally add inference parameters. - -```swift -let builder = try ConverseRequestBuilder(with: model) - .withPrompt("Can you give me a summary of this chapter?") - .withDocument(name: "Chapter 1", format: .pdf, source: base64EncodedDocument) - .withMaxTokens(512) - .withTemperature(0.4) - -var reply = try await bedrock.converse(with: builder) -``` - -Note that the builder can be used to create the next builder with the same parameters and the updated history. - -```swift -var builder = try ConverseRequestBuilder(with: model) - .withPrompt("Can you give me a summary of this chapter?") - .withDocument(name: "Chapter 1", format: .pdf, source: base64EncodedDocument) - .withMaxTokens(512) - .withTemperature(0.4) - -var reply = try await bedrock.converse(with: builder) - -builder = try ConverseRequestBuilder(from: builder, with: reply) - .withPrompt("Thanks, can you make a Dutch version as well?") - -reply = try await bedrock.converse(with: builder) -``` - -To use streaming use the exact same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. An example is given in the [text prompt section](#text-prompt). - -### Tools - -For tool usage, first ensure the model supports the use of tools. Next define at least one `Tool` and add it to the `ConverseRequestBuilder` with the `withTool` function (or the `withTools` function to add several tools at once). After sending a request the model could now send back a `ToolUse` asking for specific information from a specific tool. Use this to send the information back in a `ToolResult`, by using the `withToolResult` function. You will now receive a reply informed by the result from the tool. - - -```swift -let model: BedrockModel = .nova_lite - -// verify that the model supports tool usage -guard model.hasConverseModality(.toolUse) else { - throw MyError.incorrectModality("\(model.name) does not support converse tools") -} - -// define the inputschema for your tool -let inputSchema = JSON([ - "type": "object", - "properties": [ - "sign": [ - "type": "string", - "description": "The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKRP." - ] - ], - "required": [ - "sign" - ] -]) - -// create a Tool object -let tool = try Tool(name: "top_song", inputSchema: inputSchema, description: "Get the most popular song played on a radio station.") - -// create a ConverseRequestBuilder with a prompt and the Tool object -var builder = try ConverseRequestBuilder(with: model) - .withPrompt("What is the most popular song on WZPZ?") - .withTool(tool) - -// pass the ConverseRequestBuilder object to the converse function -var reply = try await bedrock.converse(with: builder) - -if let toolUse = try? reply.getToolUse() { - let id = toolUse.id - let name = toolUse.name - let input = toolUse.input - - // ... Logic to use the tool here ... - - // Send the toolResult back to the model - builder = try ConverseRequestBuilder(from: builder, with: reply) - .withToolResult("The Best Song Ever") // pass any Codable or Data - - reply = try await bedrock.converse(with: builder) -} - -print("Assistant: \(reply)") -// The final reply will be similar to: "The most popular song currently played on WZPZ is \"The Best Song Ever\". If you need more information or have another request, feel free to ask!" -``` - -To use streaming use the exact same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. - -```swift -let bedrock = try await BedrockService(authentication: .sso()) -let model: BedrockModel = .claudev3_7_sonnet - -// define the inputschema for your tool -let schema = JSON(with: [ - "type": "object", - "properties": [ - "sign": [ - "type": "string", - "description": - "The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ, StuBru and Klara.", - ] - ], - "required": [ - "sign" - ], -]) - -// pass a prompt and the tool to converse -var builder = try ConverseRequestBuilder(with: model) - .withPrompt("Introduce yourself and mention the tools you have access to?") - .withTool( - name: "top_song", - inputSchema: schema, - description: "Get the most popular song played on a radio station." - ) - -var stream: AsyncThrowingStream -var assistantMessage: Message = Message("empty") - -// start a loop to interact with the user -while true { - var prompt: String = "" - var indexes: [Int] = [] - var toolRequests: [ToolUseBlock] = [] - - // create the stream by calling the converseStream function - stream = try await bedrock.converseStream(with: builder) - - // process the stream - for try await element in stream { - switch element { - case .contentSegment(let contentSegment): - switch contentSegment { - case .text(let index, let text): - if !indexes.contains(index) { - indexes.append(index) - print("\nAssistant: ") - } - print(text, terminator: "") - default: - break - } - case .contentBlockComplete(_, let content): - print("\n") - if case .toolUse(let toolUse) = content { - toolRequests.append(toolUse) - } - case .messageComplete(let message): - assistantMessage = message - } - } - - // if a request to use a tool was made by the model, use the information in the input to return the correct information back to the model in a ToolResultBlock - if !toolRequests.isEmpty { - for toolUse in toolRequests { - print("found tool use") - print(toolUse) - if toolUse.name == "top_song" { - let sign: String? = toolUse.input["sign"] - if let sign { - let song = try await getMostPopularSong(sign: sign) - builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) - .withToolResult(song) - } - } - } - } else { - // if no request to use a tool was made, no ToolResultBlock needs to be returned and the user can ask the next question - print("\nYou: ") - prompt = readLine()! - if prompt == "done" { - break - } - - builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) - .withPrompt(prompt) - } -} -``` - -### Reasoning - -To not only get a text reply but to also follow the model's reasoning, enable reasoning by using the `withReasoning` and optionally set the maximum length of the reasoning with `withMaxReasoningTokens`. These functions can be combined using the `withReasoning(maxReasoningTokens: Int)` function. - -```swift -let model: BedrockModel = .claudev3_7_sonnet - -guard model.hasConverseModality() else { - throw MyError.incorrectModality("\(model.name) does not support converse") -} -guard model.hasConverseModality(.reasoning) else { - throw MyError.incorrectModality("\(model.name) does not support reasoning") -} - -var prompt = "Introduce yourself in one sentence" - -var builder = try ConverseRequestBuilder(with: model) - .withPrompt(prompt) - .withReasoning() - .withMaxReasoningTokens(1024) // Optional - -var reply = try await bedrock.converse(with: builder) - -if let reasoning = try? reply.getReasoningBlock() { - print("\nReasoning: \(reasoning.reasoning)") -} -print("\nAssistant: \(reply)") -``` - -To combine reasoning and streaming, use the same `ConverseRequestBuilder`, but use the `converseStream` function instead of the `converse` function. A `ContentSegment` can then contain `reasoning`. - -```swift -let model: BedrockModel = .claudev3_7_sonnet - -guard model.hasConverseModality() else { - throw MyError.incorrectModality("\(model.name) does not support converse") -} -guard model.hasConverseModality(.streaming) else { - throw MyError.incorrectModality("\(model.name) does not support streaming") -} -guard model.hasConverseModality(.reasoning) else { - throw MyError.incorrectModality("\(model.name) does not support reasoning") -} - -var builder = try ConverseRequestBuilder(from: builder, with: reply) - .withPrompt("Tell me more about the birds in Paris") - .withReasoning(maxReasoningTokens: 1024) - -let stream = try await bedrock.converseStream(with: builder) - -var indexes: [Int] = [] - -for try await element in stream { - switch element { - case .contentSegment(let contentSegment): - switch contentSegment { - case .text(let index, let text): - if !indexes.contains(index) { - indexes.append(index) - print("\nAssistant: ") - } - print(text, terminator: "") - case .reasoning(let index, let text, _): - if !indexes.contains(index) { - indexes.append(index) - print("\nReasoning: ") - } - print(text, terminator: "") - default: - break - } - case .contentBlockComplete: - print("\n\n") - case .messageComplete(let message): - assistantMessage = message - } -} - -builder = try ConverseRequestBuilder(from: builder, with: assistantMessage) - .withPrompt("And what about the rats?") -``` - -### Make your own `Message` - -Alternatively use the `converse` function that does not take a `prompt`, `toolResult` or `image` and construct the `Message` yourself. - -```swift -// Message with prompt -let replyMessage = try await bedrock.converse( - with: model, - conversation: [Message("What day of the week is it?")] -) - -// Optionally add inference parameters -let replyMessage = try await bedrock.converse( - with: model, - conversation: [Message("What day of the week is it?")], - maxTokens: 512, - temperature: 1, - topP: 0.8, - stopSequences: ["THE END"], - systemPrompts: ["Today is Wednesday, make sure to mention that."] -) - -// Message with an image and prompt -let replyMessage = try await bedrock.converse( - with: model, - conversation: [Message("What is in the this teacup?", imageFormat: .jpeg, imageBytes: base64EncodedImage)], -) - -// Message with toolResult -let replyMessage = try await bedrock.converse( - with: model, - conversation: [Message(toolResult)], - tools: [toolA, toolB] -) -``` - -### JSON - -The `JSON` struct is a lightweight and flexible wrapper for working with JSON-like data in Swift. It provides convenient methods and initializers to parse, access, and manipulate JSON data while maintaining type safety and versatility. - -#### Creating a JSON Object - -You can create a `JSON` object by wrapping raw values or constructing nested structures: -```swift -let json = JSON([ - "name": JSON("Jane Doe"), - "age": JSON(30), - "isMember": JSON(true), -]) -``` -#### Creating JSON object from String - -The `JSON` struct provides an initializer to parse valid JSON strings into a `JSON` object: - -```swift -let validJSONString = """ -{ - "name": "Jane Doe", - "age": 30, - "isMember": true -} -""" - -do { - let json = try JSON(from: validJSONString) - print(json.getValue("name") ?? "No name") // Output: Jane Doe -} catch { - print("Failed to parse JSON:", error) -} -``` - -#### Accessing values using `getValue` - -The `getValue(_ key: String)` method retrieves values of the specified type from the JSON object: - -```swift -if let name: String? = json.getValue("name") { - print("Name:", name) // Output: Name: Jane Doe -} - -if let age: Int? = json.getValue("age") { - print("Age:", age) // Output: Age: 30 -} - -if let isMember: Bool? = json.getValue("isMember") { - print("Is Member:", isMember) // Output: Is Member: true -} -``` - -#### Accessing values using subscripts - -You can also access values dynamically using subscripts: - -```swift -let name: String? = json["name"] -print("Name:", name ?? "Unknown") // Output: Name: Jane Doe - -let nonExistent: String? = json["nonExistentKey"] -print(nonExistent == nil) // Output: true -``` - -Note that the subscript method is also able to handle nested objects. - -```swift -let json = JSON([ - "name": JSON("Jane Doe"), - "age": JSON(30), - "isMember": JSON(true), - "address": JSON([ - "street": JSON("123 Main St"), - "city": JSON("Anytown"), - "postalCode": JSON(12345), - ]), -]) - -let street: String = json["address"]?["street"] -print("Street:", name ?? "Unknown") // Street: 123 Main St -``` - -## Generating an image using the InvokeModel API - -Choose a BedrockModel that supports image generation - you can verify this using the `hasImageModality` and the `hasTextToImageModality` function. The `generateImage` function allows you to create images from text descriptions with various optional parameters: - -- `prompt`: Text description of the desired image -- `negativePrompt`: Text describing what to avoid in the generated image -- `nrOfImages`: Number of images to generate -- `cfgScale`: Classifier free guidance scale to control how closely the image follows the prompt -- `seed`: Seed for reproducible image generation -- `quality`: Parameter to control the quality of generated images -- `resolution`: Desired image resolution for the generated images - -The function returns an ImageGenerationOutput object containing an array of generated images in base64 format. - -```swift -let model: BedrockModel = .nova_canvas - -guard model.hasImageModality(), - model.hasTextToImageModality() else { - throw MyError.incorrectModality("\(model.name) does not support image generation") -} - -let imageGeneration = try await bedrock.generateImage( - "A serene landscape with mountains at sunset", - with: model -) -``` - -Optionally add inference parameters. - -```swift -let imageGeneration = try await bedrock.generateImage( - "A serene landscape with mountains at sunset", - with: model, - negativePrompt: "dark, stormy, people", - nrOfImages: 3, - cfgScale: 7.0, - seed: 42, - quality: .standard, - resolution: ImageResolution(width: 100, height: 100) -) -``` - -Note that the minimum, maximum and default values for each parameter are model specific and defined when the BedrockModel is created. Some parameters might not be supported by certain models. - -## Generating image variations using the InvokeModel API -Choose a BedrockModel that supports image variations - you can verify this using the `hasImageModality` and the `hasImageVariationModality` function. The `generateImageVariation` function allows you to create variations of an existing image with these parameters: - -- `images`: The base64-encoded source images used to create variations from -- `negativePrompt`: Text describing what to avoid in the generated image -- `similarity`: Controls how similar the variations will be to the source images -- `nrOfImages`: Number of variations to generate -- `cfgScale`: Classifier free guidance scale to control how closely variations follow the original image -- `seed`: Seed for reproducible variation generation -- `quality`: Parameter to control the quality of generated variations -- `resolution`: Desired resolution for the output variations - -This function returns an `ImageGenerationOutput` object containing an array of generated image variations in base64 format. Each variation will maintain key characteristics of the source images while introducing creative differences. - -```swift -let model: BedrockModel = .nova_canvas - -guard model.hasImageVariationModality(), - model.hasImageVariationModality() else { - throw MyError.incorrectModality("\(model.name) does not support image variation generation") -} - -let imageVariations = try await bedrock.generateImageVariation( - images: [base64EncodedImage], - prompt: "A dog drinking out of this teacup", - with: model -) -``` - -Optionally add inference parameters. - -```swift -let imageVariations = try await bedrock.generateImageVariation( - images: [base64EncodedImage], - prompt: "A dog drinking out of this teacup", - with: model, - negativePrompt: "Cats, worms, rain", - similarity: 0.8, - nrOfVariations: 4, - cfgScale: 7.0, - seed: 42, - quality: .standard, - resolution: ImageResolution(width: 100, height: 100) -) -``` - -Note that the minimum, maximum and default values for each parameter are model specific and defined when the BedrockModel is created. Some parameters might not be supported by certain models. - -## Generating text using the InvokeModel API - -Choose a BedrockModel that supports text generation, you can verify this using the `hasTextModality` function. When calling the `completeText` function you can provide some inference parameters: - -- `maxTokens`: The maximum amount of tokens that the model is allowed to return -- `temperature`: Controls the randomness of the model's output -- `topP`: Nucleus sampling, this parameter controls the cumulative probability threshold for token selection -- `topK`: Limits the number of tokens the model considers for each step of text generation to the K most likely ones -- `stopSequences`: An array of strings that will cause the model to stop generating further text when encountered - -The function returns a `TextCompletion` object containing the generated text. - -```swift -let model: BedrockModel = .nova_micro - -guard model.hasTextModality() else { - throw MyError.incorrectModality("\(model.name) does not support text generation") -} - -let textCompletion = try await bedrock.completeText( - "Write a story about a space adventure", - with: model -) - -print(textCompletion.completion) -``` - -Optionally add inference parameters. - -```swift -let textCompletion = try await bedrock.completeText( - "Write a story about a space adventure", - with: model, - maxTokens: 1000, - temperature: 0.7, - topP: 0.9, - topK: 250, - stopSequences: ["THE END"] -) -``` - -Note that the minimum, maximum and default values for each parameter are model specific and defined when the BedrockModel is created. Some parameters might not be supported by certain models. - -## How to add a BedrockModel - -### Converse - -To add a new model that only needs the ConverseModality, simply use the `StandardConverse` and add the correct [inference parameters](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html) and [supported converse features](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html). - -```swift -extension BedrockModel { - public static let new_bedrock_model = BedrockModel( - id: "family.model-id-v1:0", - name: "New Model Name", - modality: StandardConverse( - parameters: ConverseParameters( - temperature: Parameter(.temperature, minValue: 0, maxValue: 1, defaultValue: 0.3), - maxTokens: Parameter(.maxTokens, minValue: 1, maxValue: nil, defaultValue: nil), - topP: Parameter(.topP, minValue: 0.01, maxValue: 0.99, defaultValue: 0.75), - stopSequences: StopSequenceParams(maxSequences: nil, defaultValue: []), - maxPromptSize: nil - ), - features: [.textGeneration, .systemPrompts, .document, .toolUse] - ) - ) -} -``` - -If the model also implements other modalities you might need to create you own `Modality` and make sure it conforms to `ConverseModality` by implementing the `getConverseParameters` and `getConverseFeatures` functions. Note that the `ConverseParameters` can be extracted from `TextGenerationParameters` by using the public initializer. - -```swift -struct ModelFamilyModality: TextModality, ConverseModality { - func getName() -> String { "Model Family Text and Converse Modality" } - - let parameters: TextGenerationParameters - let converseFeatures: [ConverseFeature] - let converseParameters: ConverseParameters - - init(parameters: TextGenerationParameters, features: [ConverseFeature] = [.textGeneration]) { - self.parameters = parameters - self.converseFeatures = features - - // public initializer to extract `ConverseParameters` from `TextGenerationParameters` - self.converseParameters = ConverseParameters(textGenerationParameters: parameters) - } - - // ... -} -``` - -### Text - -If you need to add a model from a model family that is not supported at all by the library, follow these steps: - -#### Step 1: Create family-specific request and response struct - -Make sure to create a struct that reflects exactly how the body of the request for an invokeModel call to this family should look. Make sure to add the public initializer with parameters `prompt`, `maxTokens` and `temperature` to comply to the `BedrockBodyCodable` protocol. Take a look at the documentation to apply best practices or specific formatting. - -```json -{ - "prompt": "\(prompt)", - "temperature": 1, - "top_p": 0.9, - "max_tokens": 200, - "stop": ["END"] -} -``` - -```swift -public struct LlamaRequestBody: BedrockBodyCodable { - let prompt: String - let max_gen_len: Int - let temperature: Double - let top_p: Double - - public init(prompt: String, maxTokens: Int = 512, temperature: Double = 0.5) { - self.prompt = - "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\(prompt)<|eot_id|><|start_header_id|>assistant<|end_header_id|>" - self.max_gen_len = maxTokens - self.temperature = temperature - self.top_p = 0.9 - } -} -``` - -Do the same for the response and ensure to add the `getTextCompletion` method to extract the completion from the response body and to comply to the `ContainsTextCompletion` protocol. - -```json -{ - "generation": "\n\n", - "prompt_token_count": int, - "generation_token_count": int, - "stop_reason" : string -} -``` - -```swift -struct LlamaResponseBody: ContainsTextCompletion { - let generation: String - let prompt_token_count: Int - let generation_token_count: Int - let stop_reason: String - - public func getTextCompletion() throws -> TextCompletion { - TextCompletion(generation) - } -} -``` - -#### Step 2: Create the Modality - -For a text generation create a struct conforming to TextModality. Use the request body and response body you created in [the previous step](#step-1-create-family-specific-request-and-response-struct). Make sure to check for model(family) specific rules or parameters that are not supported here. - -```swift -struct LlamaText: TextModality { - let parameters: TextGenerationParameters - - init(parameters: TextGenerationParameters) { - self.parameters = parameters - } - - func getName() -> String { "Llama Text Generation" } - - func getParameters() -> TextGenerationParameters { - parameters - } - - func getTextRequestBody( - prompt: String, - maxTokens: Int?, - temperature: Double?, - topP: Double?, - topK: Int?, - stopSequences: [String]? - ) throws -> BedrockBodyCodable { - guard topK == nil else { - throw BedrockLibraryError.notSupported("TopK is not supported for Llama text completion") - } - guard stopSequences == nil else { - throw BedrockLibraryError.notSupported("stopSequences is not supported for Llama text completion") - } - return LlamaRequestBody( - prompt: prompt, - maxTokens: maxTokens ?? parameters.maxTokens.defaultValue, - temperature: temperature ?? parameters.temperature.defaultValue, - topP: topP ?? parameters.topP.defaultValue - ) - } - - func getTextResponseBody(from data: Data) throws -> ContainsTextCompletion { - let decoder = JSONDecoder() - return try decoder.decode(LlamaResponseBody.self, from: data) - } -} -``` - -#### Step 3: Create BedrockModel instance - -You can now create instances for any of the models that follow the request and response structure you defined. Make sure to check the allowed and default values for the inference parameters, especially if some parameters are not supported by the model. Know that these parameters may differ significantly for models from the same family. - -```swift -extension BedrockModel { - public static let llama3_3_70b_instruct: BedrockModel = BedrockModel( - id: "us.meta.llama3-3-70b-instruct-v1:0", - name: "Llama 3.3 70B Instruct", - modality: LlamaText( - parameters: TextGenerationParameters( - temperature: Parameter(.temperature, minValue: 0, maxValue: 1, defaultValue: 0.5), - maxTokens: Parameter(.maxTokens, minValue: 0, maxValue: 2_048, defaultValue: 512), - topP: Parameter(.topP, minValue: 0, maxValue: 1, defaultValue: 0.9), - topK: Parameter.notSupported(.topK), - stopSequences: StopSequenceParams.notSupported(), - maxPromptSize: nil - ) - ) - ) -} -``` - -### Image - -To add an image generation model from a model family that is not supported at all by the library, the steps are much alike to the text completion models. - -#### Step 1: Create family-specific request and response struct - -Make sure to create a struct that reflects exactly how the body of the request for an invokeModel call to this family should look. Take a look at the documentation to apply best practices or specific formatting. - -```swift -public struct AmazonImageRequestBody: BedrockBodyCodable { - let taskType: TaskType - private let textToImageParams: TextToImageParams? - private let imageGenerationConfig: ImageGenerationConfig - - // MARK: - Initialization - - /// Creates a text-to-image generation request body - /// - Parameters: - /// - prompt: The text description of the image to generate - /// - nrOfImages: The number of images to generate - /// - negativeText: The text description of what to exclude from the generated image - /// - Returns: A configured AmazonImageRequestBody for text-to-image generation - public static func textToImage( - prompt: String, - negativeText: String?, - nrOfImages: Int?, - cfgScale: Double?, - seed: Int?, - quality: ImageQuality?, - resolution: ImageResolution? - ) -> Self { - AmazonImageRequestBody( - prompt: prompt, - negativeText: negativeText, - nrOfImages: nrOfImages, - cfgScale: cfgScale, - seed: seed, - quality: quality, - resolution: resolution - ) - } - - private init( - prompt: String, - negativeText: String?, - nrOfImages: Int?, - cfgScale: Double?, - seed: Int?, - quality: ImageQuality?, - resolution: ImageResolution? - ) { - self.taskType = .textToImage - self.textToImageParams = TextToImageParams.textToImage(prompt: prompt, negativeText: negativeText) - self.imageGenerationConfig = ImageGenerationConfig( - nrOfImages: nrOfImages, - cfgScale: cfgScale, - seed: seed, - quality: quality, - resolution: resolution - ) - } -} -``` - -Do the same for the response and ensure to add the `getGeneratedImage` method to extract the image from the response body and to comply to the `ContainsImageGeneration` protocol. - -```swift -public struct AmazonImageResponseBody: ContainsImageGeneration { - let images: [Data] - - public func getGeneratedImage() -> ImageGenerationOutput { - ImageGenerationOutput(images: images) - } -} -``` - -#### Step 2: Create the Modality - -Determine the exact functionality and make sure to comply to the correct modality protocol. In this case we will use `TextToImageModality`. -Create a struct conforming to `ImageModality` and the specific functionality protocol. Use the request body and response body you created in [the previous step](#step-1-create-family-specific-request-and-response-struct). Make sure to check for model(family) specific rules or parameters that are not supported here. - -```swift -struct AmazonImage: ImageModality, TextToImageModality { - func getName() -> String { "Amazon Image Generation" } - - let parameters: ImageGenerationParameters - let resolutionValidator: any ImageResolutionValidator - let textToImageParameters: TextToImageParameters - - init( - parameters: ImageGenerationParameters, - resolutionValidator: any ImageResolutionValidator, - textToImageParameters: TextToImageParameters - ) { - self.parameters = parameters - self.textToImageParameters = textToImageParameters - self.conditionedTextToImageParameters = conditionedTextToImageParameters - self.imageVariationParameters = imageVariationParameters - self.resolutionValidator = resolutionValidator - } - - func getParameters() -> ImageGenerationParameters { parameters } - func getTextToImageParameters() -> TextToImageParameters { textToImageParameters } - - func validateResolution(_ resolution: ImageResolution) throws { - try resolutionValidator.validateResolution(resolution) - } - - func getImageResponseBody(from data: Data) throws -> ContainsImageGeneration { - let decoder = JSONDecoder() - return try decoder.decode(AmazonImageResponseBody.self, from: data) - } - - func getTextToImageRequestBody( - prompt: String, - negativeText: String?, - nrOfImages: Int?, - cfgScale: Double?, - seed: Int?, - quality: ImageQuality?, - resolution: ImageResolution? - ) throws -> BedrockBodyCodable { - AmazonImageRequestBody.textToImage( - prompt: prompt, - negativeText: negativeText, - nrOfImages: nrOfImages, - cfgScale: cfgScale, - seed: seed, - quality: quality, - resolution: resolution - ) - } -} -``` - -#### Step 3: Create BedrockModel instance - -You can now create instances for any of the models that follow the request and response structure you defined. Make sure to check the allowed and default values for the inference parameters, especially if some parameters are not supported by the model. Know that these parameters may differ significantly for models from the same family. - -```swift -extension BedrockModel { - public static let nova_canvas: BedrockModel = BedrockModel( - id: "amazon.nova-canvas-v1:0", - name: "Nova Canvas", - modality: AmazonImage( - parameters: ImageGenerationParameters( - nrOfImages: Parameter(.nrOfImages, minValue: 1, maxValue: 5, defaultValue: 1), - cfgScale: Parameter(.cfgScale, minValue: 1.1, maxValue: 10, defaultValue: 6.5), - seed: Parameter(.seed, minValue: 0, maxValue: 858_993_459, defaultValue: 12) - ), - resolutionValidator: NovaImageResolutionValidator(), - textToImageParameters: TextToImageParameters(maxPromptSize: 1024, maxNegativePromptSize: 1024), - ) - ) -} -``` \ No newline at end of file