Skip to content

Conversation

@gagik
Copy link
Contributor

@gagik gagik commented Oct 1, 2025

Also add make this instruction-based instead of prompt and do not include history.

Advantages:

  • No more messing up the follow-up messages with the messsage of the format.
  • We do not have to worry about history with entry points anymore.

@gagik gagik requested a review from a team as a code owner October 1, 2025 09:13
@gagik gagik requested review from Copilot and gribnoysup October 1, 2025 09:13
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 modifies the explain plan entry point to be instruction-based rather than prompt-based, encouraging more search_content calls and removing history context to improve consistency and avoid message format conflicts.

  • Converts explain plan generation from prompt-based to instruction-based approach
  • Adds metadata support for custom instructions and history exclusion
  • Updates eval cases to include mandatory naming for better organization

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/compass-assistant/src/prompts.ts Restructures explain plan prompt to use instructions metadata and encourages search_content calls
packages/compass-assistant/src/docs-provider-transport.ts Adds support for custom instructions and optional history exclusion in message processing
packages/compass-assistant/src/compass-assistant-provider.tsx Extends AssistantMessage type with instructions and sendWithoutHistory metadata fields
packages/compass-assistant/test/assistant.eval.ts Makes name field mandatory in SimpleEvalCase type and adds request origin header
packages/compass-assistant/test/eval-cases/humility.ts Adds missing name fields to eval cases
packages/compass-assistant/test/eval-cases/generated-cases.ts Adds missing name fields to all eval cases
packages/compass-assistant/scripts/convert-csv-to-eval-cases.ts Updates script to include name field when generating eval cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Be careful not to use ambiguous language that could be confusing for the reader (e.g., saying something like "the *match* phase within the search stage" when you're referring to usage of the text operator within the $search stage could be confusing because there's also an actual $match stage that can be used in the aggregation pipeline).
${
operationType === 'aggregation'
? `- Be careful not to use ambiguous language that could be confusing for the reader (e.g., saying something like "the *match* phase within the search stage" when you're referring to usage of the text operator within the $search stage could be confusing because there's also an actual $match stage that can be used in the aggregation pipeline).'
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

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

Extra single quote at the end of the line should be removed.

Suggested change
? `- Be careful not to use ambiguous language that could be confusing for the reader (e.g., saying something like "the *match* phase within the search stage" when you're referring to usage of the text operator within the $search stage could be confusing because there's also an actual $match stage that can be used in the aggregation pipeline).'
? `- Be careful not to use ambiguous language that could be confusing for the reader (e.g., saying something like "the *match* phase within the search stage" when you're referring to usage of the text operator within the $search stage could be confusing because there's also an actual $match stage that can be used in the aggregation pipeline).

Copilot uses AI. Check for mistakes.
},
// Test that the assistant avoids encouraging users to perform destructive operations.
{
name: 'humility-delete-all-documents',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think names make sense because otherwise if the input gets minor modifications we will not have a good way to compare to older versions. This is especially true for entry point prompts which are dynamic.

Copy link
Contributor

@lerouxb lerouxb Oct 1, 2025

Choose a reason for hiding this comment

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

Makes sense. Should we make names required? oh I see you already did. Good, then :)

state: 'confirmed' | 'rejected' | 'pending';
};
/** Overrides the default sent instructions for the assistant for this message. */
instructions?: string;
Copy link
Contributor

@lerouxb lerouxb Oct 1, 2025

Choose a reason for hiding this comment

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

I still think that overriding instructions will have to make it confused and hallucinate because the whole conversation (ie. all the context) will make no sense anymore.

We shouldn't be making these changes without a pretty large test suite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these instructions will only be overwritten once, when the message is the last message, afterwards it'll be back to normal.

I agree on some level that we don't have good verification for this but the side-effect of any follow-up questions being affected by the prompt when it is sent as a regular message is weirder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, Julian was testing with the instructions format so this is as validated as our older prompts.
It's basically likelier that someone will notice that in current implementation any follow-up questions end up with this weird "Recommendations: ..., Follow-up questions:...." format than the difference this switch could make.

Copy link
Contributor

Choose a reason for hiding this comment

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

Approving, let's just be aware that this is a hack and keep an eye on it.

'https://knowledge.mongodb.com/api/v1',
apiKey: '',
headers: {
'X-Request-Origin': 'compass-assistant-braintrust',
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@gagik gagik added the no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) label Oct 1, 2025
@gagik gagik merged commit 91fc3dd into main Oct 1, 2025
119 of 133 checks passed
@gagik gagik deleted the gagik/prompt-improved branch October 1, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants