Skip to content

Commit 05f27b6

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
fix: RAG - Fix the uri used for upload_file
PiperOrigin-RevId: 704443973
1 parent b9fecea commit 05f27b6

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

tests/unit/vertex_rag/test_rag_constants.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,8 @@
163163
TEST_FILE_DISPLAY_NAME = "my-file.txt"
164164
TEST_FILE_DESCRIPTION = "my file."
165165
TEST_HEADERS = {"X-Goog-Upload-Protocol": "multipart"}
166-
TEST_UPLOAD_REQUEST_URI = (
167-
"https://{}/v1/projects/{}/locations/{}/ragCorpora/{}/ragFiles:upload".format(
168-
TEST_API_ENDPOINT, TEST_PROJECT_NUMBER, TEST_REGION, TEST_RAG_CORPUS_ID
169-
)
166+
TEST_UPLOAD_REQUEST_URI = "https://{}/upload/v1/projects/{}/locations/{}/ragCorpora/{}/ragFiles:upload".format(
167+
TEST_API_ENDPOINT, TEST_PROJECT_NUMBER, TEST_REGION, TEST_RAG_CORPUS_ID
170168
)
171169
TEST_RAG_FILE_ID = "generate-456"
172170
TEST_RAG_FILE_RESOURCE_NAME = (

tests/unit/vertex_rag/test_rag_constants_preview.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,8 @@
308308
TEST_FILE_DISPLAY_NAME = "my-file.txt"
309309
TEST_FILE_DESCRIPTION = "my file."
310310
TEST_HEADERS = {"X-Goog-Upload-Protocol": "multipart"}
311-
TEST_UPLOAD_REQUEST_URI = (
312-
"https://{}/v1beta1/projects/{}/locations/{}/ragCorpora/{}/ragFiles:upload".format(
313-
TEST_API_ENDPOINT, TEST_PROJECT_NUMBER, TEST_REGION, TEST_RAG_CORPUS_ID
314-
)
311+
TEST_UPLOAD_REQUEST_URI = "https://{}/upload/v1beta1/projects/{}/locations/{}/ragCorpora/{}/ragFiles:upload".format(
312+
TEST_API_ENDPOINT, TEST_PROJECT_NUMBER, TEST_REGION, TEST_RAG_CORPUS_ID
315313
)
316314
TEST_RAG_FILE_ID = "generate-456"
317315
TEST_RAG_FILE_RESOURCE_NAME = (

vertexai/preview/rag/rag_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def upload_file(
415415
)
416416
else:
417417
request_endpoint = initializer.global_config.api_endpoint
418-
upload_request_uri = "https://{}/v1beta1/{}/ragFiles:upload".format(
418+
upload_request_uri = "https://{}/upload/v1beta1/{}/ragFiles:upload".format(
419419
request_endpoint,
420420
corpus_name,
421421
)

vertexai/rag/rag_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def upload_file(
338338
)
339339
else:
340340
request_endpoint = initializer.global_config.api_endpoint
341-
upload_request_uri = "https://{}/v1/{}/ragFiles:upload".format(
341+
upload_request_uri = "https://{}/upload/v1/{}/ragFiles:upload".format(
342342
request_endpoint,
343343
corpus_name,
344344
)

0 commit comments

Comments
 (0)