Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/build_soundness.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Build And Soundness checks
name: Build, tests & soundness checks

on: [push, pull_request]

jobs:
build:
swift-bedrock-library:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run tests
working-directory: backend
working-directory: swift-bedrock-library
run: swift test

playground-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Web playground backend tests
working-directory: web-playground/backend
run: swift build

soundness:
Expand Down
80 changes: 37 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,40 @@ Package.resolved
.env
Makefile

# backend
backend/.DS_Store
backend/.build
backend/.swiftpm
backend/.devContainer
backend/Packages
backend/*.xcodeproj
backend/xcuserdata/
backend/.vscode/*
backend/!/.vscode/hummingbird.code-snippets
backend/.env.*
backend/.env
backend/img/generated_images
backend/.vscode
backend/Makefile

# frontend
frontend/node_modules
frontend/.pnp
frontend/.pnp.js
frontend/.yarn/install-state.gz

frontend/coverage

frontend/.next/
frontend/out/

frontend/build

frontend/.DS_Store
frontend/*.pem

frontend/npm-debug.log*
frontend/yarn-debug.log*
frontend/yarn-error.log*

frontend/.env*.local

frontend/.vercel

frontend/*.tsbuildinfo
frontend/next-env.d.ts
frontend/Makefile
node_modules

# **/backend
**/backend/.DS_Store
**/backend/.build
**/backend/.swiftpm
**/backend/.devContainer
**/backend/Packages
**/backend/*.xcodeproj
**/backend/xcuserdata/
**/backend/.vscode/*
**/backend/!/.vscode/hummingbird.code-snippets
**/backend/.env.*
**/backend/.env
**/backend/img/generated_images
**/backend/.vscode
**/backend/Makefile

# **/frontend
**/frontend/node_modules
**/frontend/.pnp
**/frontend/.pnp.js
**/frontend/.yarn/install-state.gz
**/frontend/coverage
**/frontend/.next/
**/frontend/out/
**/frontend/build
**/frontend/.DS_Store
**/frontend/*.pem
**/frontend/npm-debug.log*
**/frontend/yarn-debug.log*
**/frontend/yarn-error.log*
**/frontend/.env*.local
**/frontend/.vercel
**/frontend/*.tsbuildinfo
**/frontend/next-env.d.ts
**/frontend/Makefile
12 changes: 6 additions & 6 deletions .licenseignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
**/*.md
CONTRIBUTORS.txt
LICENSE.txt
LICENSE
NOTICE.txt
Package.swift
Package@swift-*.swift
Expand All @@ -31,10 +32,9 @@ Package.resolved
*.yaml
*.yml
*.json
*.gif
frontend/*
**/*.gif
**/*.png
**/frontend/*
**/*.code-snippets
.DS_Store
backend/.vscode/hummingbird.code-snippets
backend/img/image.png
LICENSE
.licenseignore
.licenseignore
94 changes: 0 additions & 94 deletions .vscode/launch.json

This file was deleted.

59 changes: 59 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftBedrockLibrary",
platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18)],
products: [
.library(name: "BedrockService", targets: ["BedrockService"]),
.library(name: "BedrockTypes", targets: ["BedrockTypes"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
.package(url: "https://github.com/awslabs/aws-sdk-swift", from: "1.3.3"),
.package(url: "https://github.com/smithy-lang/smithy-swift", from: "0.118.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.0"),
.package(url: "https://github.com/awslabs/aws-crt-swift", from: "0.5.0"),
],
targets: [
.target(
name: "BedrockService",
dependencies: [
.target(name: "BedrockTypes"),
.product(name: "AWSClientRuntime", package: "aws-sdk-swift"),
.product(name: "AWSBedrock", package: "aws-sdk-swift"),
.product(name: "AWSBedrockRuntime", package: "aws-sdk-swift"),
.product(name: "Smithy", package: "smithy-swift"),
.product(name: "Logging", package: "swift-log"),
.product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift"),
],
path: "swift-bedrock-library/Sources/BedrockService"
),
.target(
name: "BedrockTypes",
dependencies: [
.product(name: "AWSBedrockRuntime", package: "aws-sdk-swift"),
.product(name: "AWSBedrock", package: "aws-sdk-swift"),
.product(name: "Smithy", package: "smithy-swift"),
],
path: "swift-bedrock-library/Sources/BedrockTypes"
),
.testTarget(
name: "BedrockServiceTests",
dependencies: [
.target(name: "BedrockService"),
.target(name: "BedrockTypes"),
],
path: "swift-bedrock-library/Tests/BedrockServiceTests"
),
.testTarget(
name: "BedrockTypesTests",
dependencies: [
.target(name: "BedrockTypes")
],
path: "swift-bedrock-library/Tests/BedrockTypesTests"
),
]
)
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
# Swift FM Playground
# Amazon Bedrock Swift Library and web playground

Welcome to the Swift Foundation Model (FM) Playground, an example app to explore how to use **Amazon Bedrock** with the AWS SDK for Swift.
This repository contains projects demonstrating how to use Amazon Bedrock with Swift.

> 🚨 **Important:** This application is for educational purposes and not intended for production use.
## Projects

## Overview
### 1. Swift Bedrock Library

> 🚧 Under construction 🚧
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.

## Prerequisites
[Go to Swift Bedrock Library →](swift-bedrock-library/README.md)

> 🚧 Under construction 🚧
### 2. Swift FM Playground

## Running the Application
An interactive web application that demonstrates the capabilities of Amazon Bedrock foundation models using the Swift Bedrock Library. The playground includes:

> 🚧 Under construction 🚧
- A Swift "backend for frontend" that interfaces with Amazon Bedrock
- A React frontend for interacting with the models through a user-friendly interface

## Accessing the Application
[Go to Swift FM Playground →](swift-fm-playground/web-playground/README.md)

To access the application, open `http://localhost:3000` in your web browser.
## Getting Started

## Stopping the Application
Each project has its own README with specific setup instructions:

To halt the application, you will need to stop both the backend and frontend processes.
- 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)

### Stopping the Frontend
## Prerequisites

In the terminal where the frontend is running, press `Ctrl + C` to terminate the process.
- 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

### Stopping the Backend
## License

Similarly, in the backend terminal, use the `Ctrl + C` shortcut to stop the server.
These projects are licensed under the Apache License 2.0. See the LICENSE files in each project for details.
File renamed without changes.
9 changes: 9 additions & 0 deletions swift-bedrock-library/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Makefile for library

format:
swift format format --recursive --in-place Sources Tests

format-commit:
make format
git add .
git commit -m "applying swift format"
Loading
Loading