Skip to content

Commit 66c4d85

Browse files
yinghsienwucopybara-github
authored andcommitted
fix: support custom credentials in RAG.upload_file
fixes #4986 PiperOrigin-RevId: 862881532
1 parent d685d81 commit 66c4d85

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vertexai/rag/rag_data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ def upload_file(
428428
"metadata": (None, str(js_rag_file)),
429429
"file": open(path, "rb"),
430430
}
431-
credentials, _ = auth.default()
431+
credentials = initializer.global_config.credentials
432+
if not credentials:
433+
credentials, _ = auth.default()
432434
authorized_session = google_auth_requests.AuthorizedSession(credentials=credentials)
433435
try:
434436
response = authorized_session.post(

0 commit comments

Comments
 (0)