From 9947f17c3da1a0ebba28e62eb85b74b9e7dea4a3 Mon Sep 17 00:00:00 2001 From: Aniruddha Adak Date: Fri, 25 Sep 2026 09:24:22 +0530 Subject: [PATCH] fix(rag): pass gcs_path to quickstart entrypoint Fixes #14610 Signed-off-by: Aniruddha Adak --- generative_ai/rag/quickstart_example.py | 3 +- .../rag/test_quickstart_entrypoint.py | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 generative_ai/rag/test_quickstart_entrypoint.py diff --git a/generative_ai/rag/quickstart_example.py b/generative_ai/rag/quickstart_example.py index b57ae049e9..af8dd95a72 100644 --- a/generative_ai/rag/quickstart_example.py +++ b/generative_ai/rag/quickstart_example.py @@ -142,9 +142,8 @@ def quickstart( if __name__ == "__main__": - gdrive_path = "https://drive.google.com/file/1234567890" gcloud_path = "gs://your-bucket-name/file.txt" quickstart( display_name="test_corpus", - paths=[gdrive_path, gcloud_path], + gcs_path=gcloud_path, ) diff --git a/generative_ai/rag/test_quickstart_entrypoint.py b/generative_ai/rag/test_quickstart_entrypoint.py new file mode 100644 index 0000000000..5b78f09138 --- /dev/null +++ b/generative_ai/rag/test_quickstart_entrypoint.py @@ -0,0 +1,47 @@ +# Copyright 2026 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 +# +# https://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. + +import ast +from pathlib import Path + +SOURCE = Path(__file__).with_name("quickstart_example.py") + + +def _entrypoint_call() -> ast.Call: + tree = ast.parse(SOURCE.read_text(encoding="utf-8")) + for node in ast.walk(tree): + if ( + isinstance(node, ast.Call) + and isinstance(node.func, ast.Name) + and node.func.id == "quickstart" + ): + return node + raise AssertionError("quickstart entry point was not found") + + +def test_entrypoint_passes_gcs_path() -> None: + calls = [] + + def quickstart(display_name: str, gcs_path: str) -> None: + calls.append((display_name, gcs_path)) + + namespace = { + "gcloud_path": "gs://your-bucket-name/file.txt", + "quickstart": quickstart, + } + expression = ast.Expression(body=_entrypoint_call()) + ast.fix_missing_locations(expression) + exec(compile(expression, str(SOURCE), "eval"), namespace) + + assert calls == [("test_corpus", "gs://your-bucket-name/file.txt")]