Skip to content

Commit

Permalink
fix(compass-generative-ai): Increase the character size restriction f…
Browse files Browse the repository at this point in the history
…or query and aggregation genai COMPASS-8369 (#6370)

* limit increased and message improved for PROMPT_TOO_LONG

* updating prompt_too_long error msg

* updating test
  • Loading branch information
ruchitharajaghatta authored Oct 16, 2024
1 parent 181ab92 commit 5f45217
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/compass-generative-ai/src/atlas-ai-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-generative-ai/src/atlas-ai-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 request is too large. Please use a smaller prompt or try using this feature on a collection with smaller documents.',
],
[
'TOO_MANY_REQUESTS',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</>
);
Expand Down

0 comments on commit 5f45217

Please sign in to comment.