From 66c4d85f51a9fb5ca0afc23cec9b20850e7f6f3e Mon Sep 17 00:00:00 2001 From: Amy Wu Date: Thu, 29 Jan 2026 13:41:38 -0800 Subject: [PATCH] fix: support custom credentials in RAG.upload_file fixes #4986 PiperOrigin-RevId: 862881532 --- vertexai/rag/rag_data.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vertexai/rag/rag_data.py b/vertexai/rag/rag_data.py index a1eaa98120..fd4ca0d7e6 100644 --- a/vertexai/rag/rag_data.py +++ b/vertexai/rag/rag_data.py @@ -428,7 +428,9 @@ def upload_file( "metadata": (None, str(js_rag_file)), "file": open(path, "rb"), } - credentials, _ = auth.default() + credentials = initializer.global_config.credentials + if not credentials: + credentials, _ = auth.default() authorized_session = google_auth_requests.AuthorizedSession(credentials=credentials) try: response = authorized_session.post(