Skip to content

fix(generative_ai): update models, SDK configs, and RAG region across chat_completions, rag, and model_garden - #14681

Open
iennae wants to merge 1 commit into
mainfrom
fix/generative-ai-wave1
Open

iennae wants to merge 1 commit into
mainfrom
fix/generative-ai-wave1

Conversation

@iennae

@iennae iennae commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates samples across generative_ai/chat_completions, generative_ai/rag, and generative_ai/model_garden to use current model versions, valid SDK methods/configs, and an unrestricted RAG Engine region:

  • generative_ai/chat_completions (9 files):

    • Updates OpenAI-compatible Vertex AI samples from retired Gemini 1.5 models to google/gemini-3.8-flash on the global endpoint.
    • Fixes the two-turn function calling conversation history in chat_completions_function_calling_basic.py and chat_completions_function_calling_config.py so the assistant's tool_calls message is included prior to the tool response message.
    • Updates chat_completions_test.py assertions for non-empty responses and tool call outputs.
  • generative_ai/model_garden (4 files):

    • Updates Anthropic Claude samples (claude_3_streaming_example.py, claude_3_tool_example.py, claude_3_unary_example.py) from retired claude-3-5-sonnet-v2@20241022 to claude-sonnet-4-6.
    • Updates anthropic[vertex] in requirements.txt to 2.2.0.
  • generative_ai/rag (20 files):

    • Unifies all RAG Engine samples on the unrestricted GA region us-east5 (see RAG Engine supported regions). Note: an alternative when using restricted regions such as us-central1 is switching RagEngineConfig to Serverless mode.
    • Updates embedding model references from text-embedding-004 to text-embedding-005 and generation model references in generate_content_example.py and quickstart_example.py to gemini-3.8-flash (via the global genai.Client).
    • Fixes agentplatform RAG SDK method calls (client.rag.delete_corpus, client.rag.get_corpus, client.rag.delete_file, client.rag.get_file, client.rag.list_files, client.rag.upload_file) and google.genai.types imports.
    • Updates import_files_example.py and import_files_async_example.py to configure gcs_source in ImportRagFilesConfig (which enforces a mutually exclusive oneof across data sources) and clarifies the function docstrings.
    • Wires api_auth into RagVectorDbConfig in create_corpus_pinecone_example.py and create_corpus_weaviate_example.py, and moves rag_embedding_model_config inside RagVectorDbConfig in create_corpus_weaviate_example.py.
    • Updates generative_ai/rag/requirements.txt to google-cloud-aiplatform==2.6.0 and google-genai==2.29.0.

… chat_completions, rag, and model_garden

Problem:
Several samples in generative_ai/chat_completions, generative_ai/rag, and generative_ai/model_garden were failing due to retired model versions, outdated SDK imports/configurations, and regional tier defaults:
1. generative_ai/chat_completions samples referenced retired Gemini 1.5 models on regional endpoints and constructed single-turn tool-call conversations without appending the assistant tool_calls message.
2. generative_ai/model_garden Anthropic Claude samples referenced retired claude-3-5-sonnet-v2@20241022 and pinned an older anthropic[vertex] dependency.
3. generative_ai/rag samples referenced retired text-embedding-004 and gemini-2.0-flash-001 models, used outdated google.genai imports or non-existent client.files/client.corpora methods, passed both gcs_source and google_drive_source simultaneously in ImportRagFilesConfig (violating the API oneof constraint), omitted api_auth in Pinecone/Weaviate corpus creation configs, and defaulted to us-central1 (where Spanner-backed Basic tier requires allowlisting for new projects).

Solution:
- generative_ai/chat_completions (9 files): Update all OpenAI-compatible Vertex AI samples to use google/gemini-3.8-flash on the global endpoint, fix the two-turn function calling conversation flow in basic and config samples, and update test assertions in chat_completions_test.py.
- generative_ai/model_garden (4 files): Update Claude samples from claude-3-5-sonnet-v2@20241022 to claude-sonnet-4-6 and bump anthropic[vertex] to 2.2.0.
- generative_ai/rag (20 files):
  - Unify all RAG Engine samples on the unrestricted GA region us-east5 with a reference comment to the RAG Engine supported-regions documentation.
  - Update embedding model references from text-embedding-004 to text-embedding-005 and generation model references to gemini-3.8-flash.
  - Fix SDK methods (client.rag.delete_corpus, client.rag.get_corpus, client.rag.delete_file, client.rag.get_file, client.rag.list_files, client.rag.upload_file), genai_types imports, and ImportRagFilesConfig GCS source configuration.
  - Wire ApiAuth into RagVectorDbConfig in Pinecone and Weaviate corpus creation samples, and move rag_embedding_model_config inside RagVectorDbConfig in create_corpus_weaviate_example.py.
  - Update generative_ai/rag/requirements.txt to google-cloud-aiplatform==2.6.0 and google-genai==2.29.0.
@iennae
iennae requested review from a team as code owners October 26, 2026 00:10
@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Oct 26, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates various generative AI examples across chat completions, model garden, and RAG modules to use new locations (such as "global" and "us-east5"), updates model references, and bumps dependency versions in requirements files. The review feedback highlights critical issues where several of the newly specified model names (such as "google/gemini-3.8-flash" and "claude-sonnet-4-6") and package dependency versions (such as "anthropic[vertex]==2.2.0", "google-cloud-aiplatform==2.6.0", and "google-genai==2.29.0") do not actually exist. It is recommended to use valid, existing model names and package versions to prevent runtime and installation failures.

Comment thread generative_ai/model_garden/requirements.txt
Comment thread generative_ai/rag/requirements.txt
Comment thread generative_ai/rag/generate_content_example.py
Comment thread generative_ai/rag/quickstart_example.py
Comment thread generative_ai/rag/quickstart_example.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants