Skip to content

Conversation

@mabaasit
Copy link
Collaborator

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings December 16, 2025 07:58
@mabaasit mabaasit requested a review from a team as a code owner December 16, 2025 07:58
@mabaasit mabaasit requested a review from nbbeeken December 16, 2025 07:58
@github-actions github-actions bot added the feat label Dec 16, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the AI chatbot prompt size handling by adjusting the maximum prompt length limit from 512,000 to 250,000 characters to align with the chatbot slim model's capacity. It also introduces a dedicated error class for handling cases where prompts exceed this limit.

  • Reduced MAX_TOTAL_PROMPT_LENGTH constant to match chatbot slim model capabilities
  • Introduced AiChatbotPromptTooLargeError to replace generic error handling
  • Updated test cases to reflect the new prompt size limits

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/compass-generative-ai/src/utils/gen-ai-prompt.ts Updated max prompt length constant and replaced generic Error with specific AiChatbotPromptTooLargeError
packages/compass-generative-ai/src/utils/gen-ai-prompt.spec.ts Updated test cases to use new prompt length limits and verify the new error type
packages/compass-generative-ai/src/chatbot-errors.ts Added new AiChatbotPromptTooLargeError class extending AtlasServiceError

@mabaasit mabaasit added feature flagged PRs labeled with this label will not be included in the release notes of the next release no release notes Fix or feature not for release notes labels Dec 16, 2025
@mabaasit mabaasit merged commit 8eed30b into main Dec 16, 2025
86 of 88 checks passed
@mabaasit mabaasit deleted the COMPASS-10129-prompt-length branch December 16, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat feature flagged PRs labeled with this label will not be included in the release notes of the next release no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants