From 25abe51817847eb6a8cdf524966b7f58f3ff0ff1 Mon Sep 17 00:00:00 2001 From: Ruchitha Rajaghatta Date: Tue, 15 Oct 2024 15:25:20 -0400 Subject: [PATCH 1/3] limit increased and message improved for PROMPT_TOO_LONG --- packages/compass-generative-ai/src/atlas-ai-service.ts | 2 +- .../src/components/generative-ai-input.spec.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/compass-generative-ai/src/atlas-ai-service.ts b/packages/compass-generative-ai/src/atlas-ai-service.ts index dbfa1fb23e8..49a8ccf2777 100644 --- a/packages/compass-generative-ai/src/atlas-ai-service.ts +++ b/packages/compass-generative-ai/src/atlas-ai-service.ts @@ -24,7 +24,7 @@ type GenerativeAiInput = { // The size/token validation happens on the server, however, we do // want to ensure we're not uploading massive documents (some folks have documents > 1mb). -const AI_MAX_REQUEST_SIZE = 100000; +const AI_MAX_REQUEST_SIZE = 5120000; const AI_MIN_SAMPLE_DOCUMENTS = 1; const USER_AI_URI = (userId: string) => `unauth/ai/api/v1/hello/${userId}`; const AGGREGATION_URI = 'ai/api/v1/mql-aggregation'; diff --git a/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx b/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx index 26c24067eb9..73c70624410 100644 --- a/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx +++ b/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx @@ -112,7 +112,7 @@ describe('GenerativeAIInput Component', function () { ], [ 'PROMPT_TOO_LONG', - 'Sorry, your collections have too many fields to process. Please try using this feature on a collection with smaller documents.', + 'Sorry, your prompt is too long and has exceeded the token limit. Please try using this feature with a shorter prompt.', ], [ 'TOO_MANY_REQUESTS', From 6d015ab06ffb50c8e830946d1b31a3f6139be42d Mon Sep 17 00:00:00 2001 From: Ruchitha Rajaghatta Date: Tue, 15 Oct 2024 15:43:58 -0400 Subject: [PATCH 2/3] updating prompt_too_long error msg --- .../src/components/generative-ai-input.spec.tsx | 2 +- .../src/components/generative-ai-input.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx b/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx index 73c70624410..7e5ff722a01 100644 --- a/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx +++ b/packages/compass-generative-ai/src/components/generative-ai-input.spec.tsx @@ -112,7 +112,7 @@ describe('GenerativeAIInput Component', function () { ], [ 'PROMPT_TOO_LONG', - 'Sorry, your prompt is too long and has exceeded the token limit. Please try using this feature with a shorter prompt.', + 'Sorry, your request is too large. Please use a smaller prompt or try using this feature on a collection with smaller documents.', ], [ 'TOO_MANY_REQUESTS', diff --git a/packages/compass-generative-ai/src/components/generative-ai-input.tsx b/packages/compass-generative-ai/src/components/generative-ai-input.tsx index 36274cd90d4..81670398118 100644 --- a/packages/compass-generative-ai/src/components/generative-ai-input.tsx +++ b/packages/compass-generative-ai/src/components/generative-ai-input.tsx @@ -569,7 +569,7 @@ const AIError = ({ // able to fix the issue on their own it cases where the schema is too big. return ( <> - Sorry, your collections have too many fields to process. Please try + Sorry, your request is too large. Please use a smaller prompt or try using this feature on a collection with smaller documents. ); From e0858410982da15841f5b5355b7bbe80fea063ef Mon Sep 17 00:00:00 2001 From: Ruchitha Rajaghatta Date: Tue, 15 Oct 2024 15:52:05 -0400 Subject: [PATCH 3/3] updating test --- packages/compass-generative-ai/src/atlas-ai-service.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/compass-generative-ai/src/atlas-ai-service.spec.ts b/packages/compass-generative-ai/src/atlas-ai-service.spec.ts index d5c5b2a34cb..14894c420a4 100644 --- a/packages/compass-generative-ai/src/atlas-ai-service.spec.ts +++ b/packages/compass-generative-ai/src/atlas-ai-service.spec.ts @@ -204,7 +204,7 @@ describe('AtlasAiService', function () { userInput: 'test', collectionName: 'test', databaseName: 'peanut', - sampleDocuments: [{ test: '4'.repeat(600000) }], + sampleDocuments: [{ test: '4'.repeat(5120001) }], requestId: 'abc', signal: new AbortController().signal, }); @@ -231,7 +231,7 @@ describe('AtlasAiService', function () { { a: '1' }, { a: '2' }, { a: '3' }, - { a: '4'.repeat(500000) }, + { a: '4'.repeat(5120001) }, ], requestId: 'abc', signal: new AbortController().signal,