Skip to content

Commit

Permalink
fix: (docs): updated getting started guide (#137)
Browse files Browse the repository at this point in the history
[fix]: docs - updated getting started guide
  • Loading branch information
swap-aws authored Jun 13, 2024
1 parent ff20eaa commit 42f61ee
Show file tree
Hide file tree
Showing 14 changed files with 345 additions and 118 deletions.
4 changes: 3 additions & 1 deletion docs/content/developer-guide/models/bedrock-models.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Amazon Bedrock users need to request access to models before they are available for use. You need to request access to models in Amazon Bedrock. To request access to additional models, select the Model access link in the left side navigation panel in the Amazon Bedrock console. See the [Bedrock Model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) user guide for more details.
Before using the models, you will need to request access to specific models via Amazon Bedrock.

To request access to additional models, select the **Model access** link from the left side navigation panel in the Amazon Bedrock console. For detailed instructions, refer to the [Bedrock Model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html) user guide.
7 changes: 7 additions & 0 deletions docs/content/getting-started/.pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
nav:
- Getting started: index.md
- Prerequisites: prerequisites.md
- Deploy Galileo: deploying-galileo.md
- Validate and review the deployment: validate-deployment.md
- Set up Cloud9 as Galileo development environment: cloud9-ide.md
28 changes: 28 additions & 0 deletions docs/content/getting-started/cloud9-ide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Setting up Cloud9 as your development environment

In your Galileo development account, select:

- Cloud9 → Create Environment
- New EC2 Instance → m5.large + Ubuntu 22.04 + 4h Timeout + AWS Systems Manager
- Open Cloud 9 IDE for the new environment
- Follow the [resize instructions](https://ec2spotworkshops.com/ecs-spot-capacity-providers/workshopsetup/resize_ebs.html), giving your instance EBS volume 300GB
- Reboot the instance before using Cloud9.

Using the Cloud9 instance, install these prerequisites:

```bash
sudo apt update && sudo apt upgrade -y
nvm install lts/iron
nvm use lts/iron
npm i -g pnpm
wget -O- https://apt.corretto.aws/corretto.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.corretto.aws stable main'
sudo apt-get update; sudo apt-get install -y java-18-amazon-corretto-jdk

sudo apt install -y python3.11
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 110
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
# NOTE: select python3.11 from the list
sudo update-alternatives --config python3
curl -sSL https://install.python-poetry.org | python3 -
```
179 changes: 179 additions & 0 deletions docs/content/getting-started/deploying-galileo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
## Deploying Galileo

Before you start the deployment, make sure:

- Docker is running, with sufficient virtual disk space.
- Your AWS credentials are set up and available in the shell.
- You have reviewed the EULA before requesting access to Bedrock models.

### Using the CLI

!!! tip
We recommend using the CLI for individuals, developer account, trials, and demos.

To deploy Galileo:

1. Open a CLI terminal and navigate to the Galileo directory.
2. Run these commands:

```
export AWS_REGION={current aws region you're in}
export AWS_PROFILE=default
pnpm bootstrap-account
pnpm galileo-cli deploy
```

This will display a guided CLI workflow for input.

!!! note

If you get a `(node:12100) [EACCES] Error: spawn galileo-cli EACCES` message, ignore it.

The following options are displayed for selecting a foundation model.

![CLI select prompt](images/cli-select.png)

3. To navigate these prompts:

- The circle filled green is the currently *selected* option. All other options are *unselected*.
- The underlined and blue text option is the currently *highlighted* option.
- Use the keyboard arrows **up** and **down** to move the currently highlighted option.
- Use the **spacebar** to select/deselect the currently highlighted option.
- To submit your final answer, press **Enter**.

4. Select the following options using the CLI:

- AWS Profile: **default**
- AWS Region: **(press Enter, the filled in region should be the correct region. If not, fill in the region code)**
- Administrator email address: **(enter your email address)**
- Administrator username: **admin**
- Deploy main application stack?: **Y**
- Choose the foundation models to suq:qpport: **(unselect all then press enter)**
- Foundation model region?: **us-west-2**
- Enable Bedrock?: **Y**
- Bedrock Region: **us-west-2**
- Bedrock model ids: **Anthropic Claude (anthropic.claude-v2)**
- Bedrock endpoint url (optional): **(press Enter, should be blank)**
- Choose the default foundation model: **bedrock::anthropic.claude-v2**
- Press Enter for the rest of the prompts.

Your terminal displays this information:

```
____ __ _ _ _ _ _
/ __ \ __ _ __ __ ___ / /__ _ __ _ | |(_)| | ___ ___ ___ | |(_)
/ / _` | / _` |\ \ /\ / // __| / // _` | / _` || || || | / _ \ / _ \ _____ / __|| || |
| | (_| || (_| | \ V V / \__ \ / /| (_| || (_| || || || || __/| (_) ||_____|| (__ | || |
\ \__,_| \__,_| \_/\_/ |___//_/ \__, | \__,_||_||_||_| \___| \___/ \___||_||_|
\____/ |___/
✔ Config file name? … config.json
✔ Application Name (stack/resource naming) … Galileo
✔ AWS Profile … default
✔ AWS Region (app) … us-west-2
✔ Administrator email address Enter email address to automatically create Cognito admin user, otherwise leave blank
… someone@somewhere.com
✔ Administrator username … yourusername
✔ Choose the foundation models to support ›
✔ Foundation model region? … us-west-2
✔ Enable Bedrock? … yes
✔ Bedrock region … us-west-2
✔ Loading available Bedrock models
✔ Bedrock model ids › Anthropic Claude (anthropic.claude-v2)
✔ Bedrock endpoint url (optional) …
✔ Choose the default foundation model › bedrock::anthropic.claude-v2
✔ Embedding model
Enter the model id to use for embeddings, supports any AutoML model
Example: sentence-transformers/all-mpnet-base-v2, intfloat/multilingual-e5-large, sentence-transformers/all-MiniLM-L6-v2
… sentence-transformers/all-mpnet-base-v2
✔ Embedding Vector Size
Enter the vector size for the chosen embedding model
… 768
✔ Embedding model instance type
Enable autoscaling the embedding instance capacity based
Recommend "ml.g4dn.xlarge" for smaller datasets, and "ml.g4dn.2xlarge" for larger datasets
… ml.g4dn.xlarge
✔ Embedding model max capacity (autoscaling)
Enable autoscaling the embedding instance capacity based
Ensure adequate Service Quota limit for SageMaker > "ml.g4dn.xlarge for endpoint usage"
… 1
✔ Indexing Pipeline instance type
Instance type used for processing dataset files and indexing to vector store
… ml.t3.large
✔ Indexing Pipeline max containers
Number of containers used for indexing files to vector store
Ensure adequate Service Quota limit for SageMaker > "ml.t3.large for processing job"
… 5
✔ Create vector store "index"?
If enabled, will create a database index for the data to improve search over large datasets
Recommended for very large datasets
… no
✔ Deploy sample dataset? ›
✔ Enable tooling in dev stage (SageMaker Studio, PgAdmin)? ›
Synthesizing project repository...
? [CDK DEPLOY] Execute the following command in 615092085770?
cdk deploy --require-approval never --region us-west-2 --profile default -c "configPath=config.json" Dev/Galileo
… yes
```

!!! info

It takes about 40 minutes to build and deploy everything. While we wait, continue to the next page to have a look at how this project was built and how to extend it.

#### Updating configuration settings

The CLI will generate an application configuration file in demo/infra/config.json, which will persist your configuration. You can modify this file and redeploy to change the configuration, or use the CLI.

`pnpm run galileo-cli --help` for cli help info

For more details on CLI operations, refer to the [CLI page](../../developer-guide/cli).

!!! info "Cross-Region deployments"
Galileo CLI allows you to deploy your LLM stack and application stack into different Regions.

### Using a CI/CD pipeline

!!! tip
We recommend using the CI/CD pipeline deployment method for live services and for shared team accounts.

**Note**: Make sure your AWS credentials in your shell are correct.

1. Create a CodeCommit repository in your target account/Region name "galileo".
2. Push this git repository to the `mainline` branch
3. Run `pnpm run deploy:pipeline`

### Deploying manually

!!! tip
We recommend using a manual deployment method only if you need to have full control and want to modify the application.

```sh
pnpm install
pnpm build

cd demo/infra
pnpm exec cdk deploy --app cdk.out --require-approval never Dev/Galileo
pnpm exec cdk deploy --app cdk.out --require-approval never Dev/Galileo-SampleDataset # (optional)
```

## What is deployed?

As part of the deployment, the following services are deployed in your AWS account:

- A pre-built conversational UI that enables contextual conversation with memory,
- An optimized embeddings vector store based on RDS Postgres and `pgvector`,
- A scalable and elastic data ingestion pipeline,
- A low latency text embeddings inference engine,
- Retrieval augmented generation (RAG) features, and
- A choice of open source large language models.

![Galileo High-level Architecture](../assets/images/galileo-arch.png)

## Next steps

- [Validate the deployment](validate-deployment.md)
- [Set up Cloud9 as your development environment](cloud9-ide.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
132 changes: 16 additions & 116 deletions docs/content/getting-started/index.md
Original file line number Diff line number Diff line change
@@ -1,123 +1,23 @@
# Getting Started
# Quickstart

## Prerequisites
## What's in this guide?

*Development Environment:*
Galileo is a framework to help you rapidly experiment with, deploy, and launch Generative AI powered products and services on the AWS platform. This guide describes how to install and configure the Galileo Generative AI Reference Sample.

| Tool | Version | Recommendation |
| --------------------- | ----------- | ---------------------------- |
| pnpm | >=8 <9 | <https://pnpm.io/installation> |
| NodeJS | >=18 | Use Node Version Manager ([nvm](https://github.com/nvm-sh/nvm)) |
| Python | >=3.10,<4 | Use Python Version Manager ([pyenv](https://github.com/pyenv/pyenv)) |
| Poetry | >=1.5,<2 | <https://python-poetry.org/docs/> |
| AWS CLI | v2 | <https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html> |
| Docker[^1] | v20+ | <https://docs.docker.com/desktop/> |
| JDK | v17+ | [Amazon Corretto 17](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html) |
After deployment, you can access all of these components:

[^1]: Docker virtual disk space should have at least 30GB of free space. If you see `no space left on device` error during build, free up space by running `docker system prune -f` and/or increasing the virtual disk size.
- A pre-built conversational UI that enables contextual conversation with memory,
- An optimized embeddings vector store based on RDS Postgres and `pgvector`,
- A scalable and elastic data ingestion pipeline,
- A low latency text embeddings inference engine,
- Retrieval augmented generation (RAG) features, and
- A choice of open source large language models.

### AWS Service Quotas
(Optional) You can deploy Galileo with a sample dataset of US Supreme Court decision documents, providing content users can interact with immediately.

Ensure the necessary service quota limits are increased *based on your configuration* before deploying. The deployment performs a check and will fail early if limits are not met.
## Next steps

!!! warning "Minimum Service Quota Requirements"
The embedding model usage is required for all deployments at this time, and must be 5 unless configured different in the code.

SageMaker processing job quota [ml.g4dn.2xlarge for processing job usage](https://console.aws.amazon.com/servicequotas/home/services/sagemaker/quotas) must be `>= 5`. This is required for current bulk processing of dataset into vectorstore.

For predefined models, check the instance type from the follow table to determine the quota limits you need to increase.

??? abstract "Predefined Model"
--8<-- "development/models/predefined-models.md"

Example, if you only deploy the *Falcon Lite* predefined model, then you only need to ensure `ml.g5.12xlarge for endpoint usage >= 1`, while the other quotas of *X for endpoint usage* can remain 0. With the exception of below minimum requirements.

!!! tip "Cross-Region Deployments"
Galileo CLI enables you to deploy your LLM stack and application stack into different regions.

---

## Quick Start

!!! tip "Bedrock Model access"
--8<-- "development/models/bedrock-models.md"

Quickly deploy the full solution using the following:

> * Make sure docker is running! And with sufficient virtual disk space.
> * Make sure your AWS credentials are setup and available in the shell.
### CLI

!!! tip "Recommended basic development for individuals, developer account, trials, and demos"

Use the companion cli for deploying the cdk infra

```sh
pnpm install
pnpm run galileo-cli
# Follow the prompt from the cli to build and deploy what you want
```

The cli will generate an application configuration file in demo/infra/config.json, which will persist your configuration. You can modify this file and redeploy to change the configuration, or use the cli again.

> `pnpm run galileo-cli --help` for cli help info
Check out the [CLI page](../../development/cli/) for more details on CLI operations.

### Manually

!!! tip "Recommended for full control and modification"

```sh
pnpm install
pnpm build

cd demo/infra
pnpm exec cdk deploy --app cdk.out --require-approval never Dev/Galileo
pnpm exec cdk deploy --app cdk.out --require-approval never Dev/Galileo-SampleDataset # (optional)
```

### CI/CD pipeline

!!! tip "Recommended for live services and for shared team accounts"

1. Create a CodeCommit repository in your target account/region name "galileo"
1. Push this git repository to the `mainline` branch
1. Run `pnpm run deploy:pipeline`

> Make sure your AWS credentials in your shell are correct
## What is deployed?

![Galileo High-level Architecture](../assets/images/galileo-arch.png)

---

## Using Cloud9 as your Galileo Development Environment

In your Galileo development account:

* Cloud9 → Create Environment
* New EC2 Instance → m5.large + Ubuntu 22.04 + 4h Timeout + AWS Systems Manager
* Open Cloud 9 IDE for this new environment
* Follow the resize instructions at <https://ec2spotworkshops.com/ecs-spot-capacity-providers/workshopsetup/resize_ebs.html>, giving your instance EBS volume 300GB (followed by a reboot)

In the Cloud9 instance shell, install some prerequisites:

```bash
sudo apt update && sudo apt upgrade -y
nvm install lts/iron
nvm use lts/iron
npm i -g pnpm
wget -O- https://apt.corretto.aws/corretto.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.corretto.aws stable main'
sudo apt-get update; sudo apt-get install -y java-18-amazon-corretto-jdk

sudo apt install -y python3.11
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 110
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100
# NOTE: select python3.11 from the list
sudo update-alternatives --config python3
curl -sSL https://install.python-poetry.org | python3 -
```
- [Review the prerequisites before deploying Galileo](prerequisites.md)
- [Deploy the Galileo Generative AI Reference Sample](deploying-galileo.md)
- [Validate the deployment](validate-deployment.md)
- [Set up Cloud9 as your development environment](cloud9-ide.md)
Loading

0 comments on commit 42f61ee

Please sign in to comment.