Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(participant): route generic prompt by intent and update generic prompt VSCODE-572 #830

Merged
merged 9 commits into from
Sep 26, 2024

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 23, 2024

VSCODE-572

This pr adds an intent prompt. This is used when a user adds a message without a command handler. It tries to route the user's message to a command handler if possible, and if it doesn't route it'll go to the default/generic handler.

There are a few accuracy test adds as well, as well as adding links to the test names for quicker reference in the html.
Screenshot 2024-09-25 at 2 17 40 PM

- Default
Rules:
1. Respond only with the intent handler.
2. Use the "Query" intent handler when the user is asking for code that relates to a specific collection.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the user has not specified a namespace? We don't have information about a specific collection, but it still can be a query generation request.

Copy link
Member Author

@Anemy Anemy Sep 24, 2024

Choose a reason for hiding this comment

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

That's a good question, and raises a tradeoff we have to take. Some users may ask a question that would result in code for a database, like how can I create a user with specific database permissions or what's the size of X database. In that case the /query handler would be forcing them to choose a collection which doesn't really make sense. I was aiming to make this prompt fairly intentionally selective so we don't restrict the user capabilities. The generic prompt has a lot of the capabilities of the /query resolver.
Are there ways you think we could word this differently or guide the behavior to the query resolver better?

Rules:
1. Respond only with the intent handler.
2. Use the "Query" intent handler when the user is asking for code that relates to a specific collection.
3. Use the "Docs" intent handler when the user is asking a question that involves MongoDB documentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try this out? I am wondering how the model interprets this instruction. Should users explicitly say find in the documentation? Or they can just ask "How to..." questions?

Copy link
Member Author

Choose a reason for hiding this comment

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

The model did successfully route a fairly docs related question to the docs handler in my manual testing. Haven't been that extensive to give a good answer on when it does and when it doesn't. We'd need more accuracy tests.

@Anemy Anemy marked this pull request as ready for review September 25, 2024 17:20
2. You should suggest code that is performant and correct.
3. Respond with markdown.
4. When relevant, provide code in a Markdown code block that begins with \`\`\`javascript and ends with \`\`\`.
5. Use MongoDB shell syntax for code unless the user requests a specific language.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just a reminder that code blocks should be aligned with codeBlockIdentifier from #835

@@ -34,7 +34,7 @@ type AssertProps = {

type TestCase = {
testCase: string;
type: 'generic' | 'query' | 'namespace';
type: 'intent' | 'generic' | 'query' | 'namespace';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a docs type?

Copy link
Member Author

@Anemy Anemy Sep 26, 2024

Choose a reason for hiding this comment

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

This is for the accuracy tests, we don't have any docs tests yet. Once we do we can add it.

@Anemy Anemy merged commit 118aee0 into VSCODE-528-mongodb-copilot Sep 26, 2024
3 checks passed
@Anemy Anemy deleted the VSCODE-572-generic-command-handler branch September 26, 2024 15:02
nirinchev added a commit that referenced this pull request Sep 26, 2024
* VSCODE-528-mongodb-copilot:
  fix(chat): update response handling to stream and inline code block parsing VSCODE-620 (#835)
  feat(participant): route generic prompt by intent and update generic prompt VSCODE-572 (#830)

# Conflicts:
#	src/participant/participant.ts
#	src/participant/prompts/query.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants