Skip to content

Commit 34bdced

Browse files
committed
add web playground README
1 parent 6a20e66 commit 34bdced

File tree

1 file changed

+77
-3
lines changed

1 file changed

+77
-3
lines changed

web-playground/README.md

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,89 @@ Welcome to the Swift Foundation Model (FM) Playground, an example app to explore
66
77
## Overview
88

9-
> 🚧 Under construction 🚧
9+
The Swift FM Playground is a web application that demonstrates how to use Amazon Bedrock foundation models with the AWS SDK for Swift. It consists of:
10+
11+
- A Swift backend that interfaces with Amazon Bedrock
12+
- A React frontend that provides a user-friendly interface for interacting with the models
1013

1114
## Prerequisites
1215

13-
> 🚧 Under construction 🚧
16+
- [Swift 6.0](https://www.swift.org/download/) or later
17+
- [Node.js](https://nodejs.org/) 18 or later
18+
- [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/)
19+
- AWS account with access to Amazon Bedrock
20+
- AWS credentials configured locally
1421

1522
## Running the Application
1623

17-
> 🚧 Under construction 🚧
24+
### Backend Setup
25+
26+
1. Navigate to the backend directory:
27+
```bash
28+
cd backend
29+
```
30+
31+
2. Build and run the Swift backend:
32+
```bash
33+
swift build
34+
swift run
35+
```
36+
37+
The backend server will start on port 8080 by default.
38+
39+
#### Advanced Backend Configuration
40+
41+
You can customize the backend behavior with the following options:
42+
43+
- **Change Log Level**:
44+
```bash
45+
swift run PlaygroundAPI --log-level debug
46+
```
47+
Available log levels: trace, debug, info, notice, warning, error, critical
48+
49+
You can also use the LOG_LEVEL environment variable.
50+
51+
```bash
52+
LOG_LEVEL=trace swift run
53+
```
54+
55+
- **Use AWS SSO Authentication**:
56+
```bash
57+
swift run PlaygroundAPI --sso
58+
```
59+
60+
- **Specify AWS Profile**:
61+
```bash
62+
swift run PlaygroundAPI --profile-name my-profile
63+
```
64+
65+
- **Combined Options**:
66+
```bash
67+
swift run PlaygroundAPI --sso --profile-name my-profile --log-level debug
68+
```
69+
70+
### Frontend Setup
71+
72+
1. Navigate to the frontend directory:
73+
```bash
74+
cd frontend
75+
```
76+
77+
2. Install dependencies:
78+
```bash
79+
npm install
80+
# or if you use yarn
81+
yarn install
82+
```
83+
84+
3. Start the React development server:
85+
```bash
86+
npm run dev
87+
# or if you use yarn
88+
yarn dev
89+
```
90+
91+
The frontend development server will start on port 3000.
1892

1993
## Accessing the Application
2094

0 commit comments

Comments
 (0)