From bf5f79534241b8a587522ca29e02801c2ef49e5b Mon Sep 17 00:00:00 2001 From: Michael Chi Date: Tue, 25 Jul 2023 07:37:48 +0000 Subject: [PATCH 1/3] add pdf qa --- LAB002-0-PDF/3-VectorstoreIndexCreator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LAB002-0-PDF/3-VectorstoreIndexCreator.py b/LAB002-0-PDF/3-VectorstoreIndexCreator.py index 8a863c1..2cfac92 100644 --- a/LAB002-0-PDF/3-VectorstoreIndexCreator.py +++ b/LAB002-0-PDF/3-VectorstoreIndexCreator.py @@ -36,8 +36,8 @@ index_name = "state_of_union" -PDF_FILE = f"../dataset/unstructured/{index_name}.txt" -loader = TextLoader(f"../dataset/unstructured/{index_name}.txt") +TXT_FILE = f"../dataset/unstructured/{index_name}.txt" +loader = TextLoader(TXT_FILE) documents = loader.load() From 732ef2ba324ab4820312651de8d479c91c55057f Mon Sep 17 00:00:00 2001 From: Michael Chi Date: Wed, 11 Oct 2023 23:27:15 +0000 Subject: [PATCH 2/3] update --- readme.md | 50 ++++++++++++++++------- terraform/qwiklab/gce.tf | 78 ------------------------------------ terraform/qwiklab/project.tf | 3 +- 3 files changed, 37 insertions(+), 94 deletions(-) delete mode 100644 terraform/qwiklab/gce.tf diff --git a/readme.md b/readme.md index 584bd43..a3feefc 100644 --- a/readme.md +++ b/readme.md @@ -5,32 +5,52 @@ This is part of the JAPAC Generative AI Technical Workshop qwiklabs. The worksho * Google Generative AI Language offerings * Langchain integration -## Environment Setup +## Provision Cloud Resources 1. Configure Google Cloud Environment -If you are running the lab in Qwiklabs environment, you do not have to manually configure the Google Project. + If you are running the lab in Qwiklabs environment, you can skip step 2. To manually configure the Google Cloud project: 2. Use Terraform to create and configure required resources. -```shell -cd terraform/qwiklabs +- Goto `terraform/qwiklabs` folder. -terraform init -terraform plan -terraform apply -``` + ```shell + cd terraform/qwiklabs + ``` + +- create `terraform.tfvars` file with the following content + + ```ini + gcp_project_id = + gcp_region = + gcp_zone = + ``` + +- Apply terraform to privision Google Cloud Resources. + + ```shell + terraform init + terraform plan -var-file=terraform.tfvars + terraform apply -var-file=terraform.tfvars + ``` + + This will create the following resources: + 1. A VPC with firewall rules which allows 80, 8080, 23 TCP inbound traffics. + 2. Service Network peering with the VPC. + +At this point, you have provisioned required cloud resources. + +## Create Vertex AI Workbench as the lab environment. + +In this lab, we use Vertex AI Workbench as the lab environment. + +1. Follow the [instruction](https://cloud.google.com/vertex-ai/docs/workbench/instances/create-console-quickstart) to provision Vertex AI Workbench Instance. -This will create the following resources: - 1. A VPC with firewall rules which allows 80, 8080, 23 TCP inbound traffics. - 2. Service Network peering with the VPC. - 3. A GCE VM that runs in the VPC created previously. +2. Once the Workbench instance is created. Open the notebook and -3. ssh to the newly created GVE VM instance and clone the repository. -4. Switch to llm-workshop folder and open `1-setup-vm.sh` -5. Update the following line, replace the project id with your own project id. ```shell export GOOGLE_PROJECT_ID= ``` diff --git a/terraform/qwiklab/gce.tf b/terraform/qwiklab/gce.tf deleted file mode 100644 index e9e22ab..0000000 --- a/terraform/qwiklab/gce.tf +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -resource "google_compute_address" "llm-vpc-static-internal-ip" { - project = var.gcp_project_id - address_type = "INTERNAL" - subnetwork = google_compute_network.llm-vpc.id - name = "llm-vpc-internal-ip" - region = var.gcp_region - depends_on = [ - google_project_service.google-cloud-apis - ] -} - -resource "google_compute_address" "llm-vpc-static-external-ip" { - project = var.gcp_project_id - address_type = "EXTERNAL" - name = "llm-vpc-external-ip" - region = var.gcp_region - depends_on = [ - google_project_service.google-cloud-apis - ] -} - -resource "google_compute_instance" "llm-workshop" { - #ts:skip=AC_GCP_0041 https://github.com/tenable/terrascan/issues/1084 - project = var.gcp_project_id - name = "llm-workshop" - machine_type = "e2-standard-4" - zone = var.gcp_zone - - boot_disk { - initialize_params { - image = "projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018" - size = 500 - } - } - - network_interface { - network = google_compute_network.llm-vpc.name - network_ip = google_compute_address.llm-vpc-static-internal-ip.address - access_config { - nat_ip = google_compute_address.llm-vpc-static-external-ip.address - } - } - - service_account { - email = data.google_compute_default_service_account.default.email - scopes = ["cloud-platform"] - } - - metadata_startup_script = < Date: Wed, 11 Oct 2023 23:28:10 +0000 Subject: [PATCH 3/3] update google-cloud-aiplatform version --- requirements.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.in b/requirements.in index 760a39c..4209a68 100644 --- a/requirements.in +++ b/requirements.in @@ -27,7 +27,7 @@ tabulate db-dtypes # Workshop Lab022 -google-cloud-aiplatform==1.26.0 +google-cloud-aiplatform==1.28.1 shapely<2.0. protobuf tensorflow_hub