fix: RagManagedDb() takes no arguments in SDK 1.153.1
This commit is contained in:
parent
582967a994
commit
46b3c52607
|
|
@ -3,12 +3,12 @@
|
||||||
setup_corpus.py — Create a Vertex AI RAG Engine corpus and import documents.
|
setup_corpus.py — Create a Vertex AI RAG Engine corpus and import documents.
|
||||||
Project: propane-will-491900-m5
|
Project: propane-will-491900-m5
|
||||||
|
|
||||||
Explicitly uses Serverless (RagManagedDb basic tier) to avoid
|
Explicitly uses Serverless (RagManagedDb) to avoid Spanner allowlist
|
||||||
Spanner allowlist restrictions on new projects in us-central1.
|
restrictions on new projects in us-central1.
|
||||||
|
|
||||||
Tested against vertexai SDK 1.153.1:
|
Tested against vertexai SDK 1.153.1:
|
||||||
RagVectorDbConfig(vector_db=RagManagedDb(tier=1))
|
RagVectorDbConfig(vector_db=RagManagedDb())
|
||||||
tier=1 == BASIC (serverless), tier=2 == ENTERPRISE
|
RagManagedDb is a no-arg marker class — selecting it is sufficient for serverless.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
@ -27,9 +27,6 @@ GCS_SOURCE = os.environ.get(
|
||||||
f"gs://{PROJECT_ID}-agent-staging/rag-docs/",
|
f"gs://{PROJECT_ID}-agent-staging/rag-docs/",
|
||||||
)
|
)
|
||||||
|
|
||||||
# tier=1 == BASIC (serverless), tier=2 == ENTERPRISE
|
|
||||||
_TIER_BASIC = 1
|
|
||||||
|
|
||||||
|
|
||||||
def ensure_serverless_engine_config() -> None:
|
def ensure_serverless_engine_config() -> None:
|
||||||
"""
|
"""
|
||||||
|
|
@ -83,10 +80,10 @@ def get_or_create_corpus() -> RagCorpus:
|
||||||
print(f"Creating corpus '{CORPUS_DISPLAY_NAME}' in {LOCATION} (serverless)...")
|
print(f"Creating corpus '{CORPUS_DISPLAY_NAME}' in {LOCATION} (serverless)...")
|
||||||
corpus = rag.create_corpus(
|
corpus = rag.create_corpus(
|
||||||
display_name=CORPUS_DISPLAY_NAME,
|
display_name=CORPUS_DISPLAY_NAME,
|
||||||
|
# RagManagedDb() is a no-arg marker class in SDK 1.153.1
|
||||||
|
# Selecting it routes to serverless managed DB (basic tier)
|
||||||
backend_config=rag.RagVectorDbConfig(
|
backend_config=rag.RagVectorDbConfig(
|
||||||
vector_db=rag.RagManagedDb(
|
vector_db=rag.RagManagedDb()
|
||||||
tier=_TIER_BASIC, # 1 = BASIC (serverless)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
print(f"✓ Corpus created: {corpus.name}")
|
print(f"✓ Corpus created: {corpus.name}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user