diff --git a/src/functions/pre_fetch_processing.ts b/src/functions/pre_fetch_processing.ts index 4ad85184..655bf1d6 100644 --- a/src/functions/pre_fetch_processing.ts +++ b/src/functions/pre_fetch_processing.ts @@ -44,21 +44,6 @@ export function formatContentRequest( export function validateGenerateContentRequest( request: GenerateContentRequest ) { - const contents = request.contents; - for (const content of contents) { - for (const part of content.parts) { - if ('fileData' in part) { - // @ts-ignore - const uri = part['fileData']['fileUri']; - if (!uri.startsWith('gs://')) { - throw new URIError( - `Found invalid Google Cloud Storage URI ${uri}, Google Cloud Storage URIs must start with gs://` - ); - } - } - } - } - if (hasVertexAISearch(request) && hasVertexRagStore(request)) { throw new ClientError( 'Found both vertexAiSearch and vertexRagStore field are set in tool. Either set vertexAiSearch or vertexRagStore.' diff --git a/src/functions/test/functions_test.ts b/src/functions/test/functions_test.ts index a50c0593..582d720b 100644 --- a/src/functions/test/functions_test.ts +++ b/src/functions/test/functions_test.ts @@ -437,21 +437,6 @@ describe('generateContent', () => { expect(resp).toEqual(expectedResult); }); - it('raises an error when passed an invalid GCS URI', async () => { - const req: GenerateContentRequest = { - contents: TEST_USER_CHAT_MESSAGE_WITH_INVALID_GCS_FILE, - }; - await expectAsync( - generateContent( - TEST_LOCATION, - TEST_RESOURCE_PATH, - TEST_TOKEN_PROMISE, - req, - TEST_API_ENDPOINT - ) - ).toBeRejectedWithError(URIError); - }); - it('returns a GenerateContentResponse when passed safetySettings and generationConfig', async () => { const req: GenerateContentRequest = { contents: TEST_USER_CHAT_MESSAGE, diff --git a/src/models/test/models_test.ts b/src/models/test/models_test.ts index d9701428..0f07413d 100644 --- a/src/models/test/models_test.ts +++ b/src/models/test/models_test.ts @@ -1018,15 +1018,6 @@ describe('GenerativeModel generateContent', () => { expect(resp).toEqual(expectedResult); }); - it('raises an error when passed an invalid GCS URI', async () => { - const req: GenerateContentRequest = { - contents: TEST_USER_CHAT_MESSAGE_WITH_INVALID_GCS_FILE, - }; - await expectAsync(model.generateContent(req)).toBeRejectedWithError( - URIError - ); - }); - it('returns a GenerateContentResponse when passed safetySettings and generationConfig', async () => { const req: GenerateContentRequest = { contents: TEST_USER_CHAT_MESSAGE, @@ -1496,15 +1487,6 @@ describe('GenerativeModelPreview generateContent', () => { expect(resp).toEqual(expectedResult); }); - it('raises an error when passed an invalid GCS URI', async () => { - const req: GenerateContentRequest = { - contents: TEST_USER_CHAT_MESSAGE_WITH_INVALID_GCS_FILE, - }; - await expectAsync(model.generateContent(req)).toBeRejectedWithError( - URIError - ); - }); - it('returns a GenerateContentResponse when passed safetySettings and generationConfig', async () => { const req: GenerateContentRequest = { contents: TEST_USER_CHAT_MESSAGE,