Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddobrin committed Dec 30, 2024
2 parents 2725c70 + b56b508 commit 9fc1774
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 32 deletions.
2 changes: 1 addition & 1 deletion ai-patterns/summarization-langchain4j-ollama/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<java.version>21</java.version>
<spring-cloud.version>2023.0.1</spring-cloud.version>
<testcontainers.version>1.20.4</testcontainers.version>
<langchain4j.version>0.36.2</langchain4j.version>
<langchain4j.version>1.0.0-alpha1</langchain4j.version>
</properties>

<dependencies>
Expand Down
8 changes: 8 additions & 0 deletions sessions/fall24/books-genai-vertex-springai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ gcloud projects add-iam-policy-binding ${PROJECT_ID} \
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
--member="serviceAccount:${PROJECT_NUMBER}[email protected]" \
--role="roles/eventarc.eventReceiver"
export ORG_ID=$(gcloud organizations list --format="value(name)")
cat <<EOF > policy.yaml
constraint: constraints/iam.allowedPolicyMemberDomains
listPolicy:
allValues: ALLOW
EOF
gcloud resource-manager org-policies set-policy policy.yaml --organization=${ORG_ID}
```

Create VPC connectors for Cloud Run to connect to alloy
Expand Down
3 changes: 3 additions & 0 deletions sessions/next24/books-genai-vertex/policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
constraint: constraints/iam.allowedPolicyMemberDomains
listPolicy:
allValues: ALLOW
8 changes: 4 additions & 4 deletions sessions/next24/sql/books-ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ create TABLE authors (
author_id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
bio TEXT,
embedding public.vector GENERATED ALWAYS AS (public.embedding('textembedding-gecko@003'::text, bio)) STORED
embedding public.vector GENERATED ALWAYS AS (public.embedding('text-embedding-004'::text, bio)) STORED
);

-- 2. Books Table
Expand All @@ -32,7 +32,7 @@ create TABLE public.pages (
book_id INT NOT NULL,
page_number INT NOT NULL,
content TEXT,
embedding public.vector GENERATED ALWAYS AS (public.embedding('textembedding-gecko@003'::text, content)) STORED,
embedding public.vector GENERATED ALWAYS AS (public.embedding('text-embedding-004'::text, content)) STORED,
CONSTRAINT fk_pages
FOREIGN KEY(book_id)
REFERENCES Books(book_id)
Expand All @@ -43,7 +43,7 @@ create TABLE bookSummaries (
summary_id SERIAL PRIMARY KEY,
book_id INT UNIQUE NOT NULL,
summary TEXT NOT NULL,
embedding public.vector GENERATED ALWAYS AS (public.embedding('textembedding-gecko@003'::text, summary)) STORED,
embedding public.vector GENERATED ALWAYS AS (public.embedding('text-embedding-004'::text, summary)) STORED,
CONSTRAINT fk_book_summary
FOREIGN KEY(book_id)
REFERENCES Books(book_id)
Expand All @@ -54,4 +54,4 @@ CREATE INDEX idx_pages_book_id ON pages (book_id);
CREATE INDEX idx_books_author_id ON books (author_id);
CREATE INDEX idx_books_book_id ON books (book_id);
CREATE INDEX idx_pages_author_id ON authors (author_id);
--CREATE INDEX idx_hnsw_co_pages_embedding ON pages USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64);
--CREATE INDEX idx_hnsw_co_pages_embedding ON pages USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64);
21 changes: 0 additions & 21 deletions sessions/next24/terraform/terraform.tfvars

This file was deleted.

81 changes: 81 additions & 0 deletions sessions/terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Binary file added sessions/terraform/alloydb-auth-proxy
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ resource "google_alloydb_instance" "primary" {
machine_config {
cpu_count = 2
}

depends_on = [google_alloydb_cluster.default]
}

Expand All @@ -220,10 +219,6 @@ locals {
"books-genai-jit" = {
image = "${var.region}-docker.pkg.dev/${var.project_id}/books-genai-jit/books-genai:latest",
env = "jit"
},
"books-genai-native" = {
image = "${var.region}-docker.pkg.dev/${var.project_id}/books-genai-native/books-genai:latest",
env = "native"
}
}
alloydb_ip = google_alloydb_instance.primary.ip_address
Expand Down Expand Up @@ -279,6 +274,10 @@ resource "google_cloud_run_service" "cloud_run" {
name = "DB_URL"
value = "jdbc:postgresql://${local.alloydb_ip}:5432/library"
}
env {
name = "VERTEX_AI_GEMINI_MODEL"
value = var.model_id
}
env {
name = "VERTEX_AI_GEMINI_PROJECT_ID"
value = var.project_id
Expand Down
3 changes: 3 additions & 0 deletions sessions/terraform/policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
constraint: constraints/iam.allowedPolicyMemberDomains
listPolicy:
allValues: ALLOW
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ variable "project_id" {
type = string
description = "The GCP project ID."
}

variable "model_id" {
type = string
description = "ID of large language model in vertexai"
}
variable "project_number" {
type = string
description = "The GCP project ID."
Expand Down

0 comments on commit 9fc1774

Please sign in to comment.