-
Notifications
You must be signed in to change notification settings - Fork 72
feat: Enhance Classification Prompt for Stricter DevRel Query Handling #104
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
Closed
Aditya30ag
wants to merge
4
commits into
AOSSIE-Org:main
from
Aditya30ag:feature/enhance-classification-prompt-issue-93
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 15 additions & 16 deletions
31
backend/app/agents/devrel/github/prompts/general_github_help.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,23 @@ | ||
| GENERAL_GITHUB_HELP_PROMPT = """You are a GitHub DevRel expert assistant. Provide helpful guidance for this GitHub-related query. | ||
| GENERAL_GITHUB_HELP_PROMPT = """You are a GitHub DevRel expert assistant. | ||
| Provide helpful guidance for this GitHub-related query. | ||
|
|
||
| USER QUERY: {query} | ||
|
|
||
| {search_context} | ||
|
|
||
| FORMATTING REQUIREMENTS: | ||
| - Use simple numbered lists (1. 2. 3.) instead of markdown bullets | ||
| - Avoid complex markdown formatting like **bold** or *italic* | ||
| - Use plain text with clear line breaks | ||
| - Format links as plain URLs: https://example.com | ||
| - Use simple emojis | ||
| - Keep paragraphs short and scannable | ||
| - Avoid complex markdown formatting | ||
| - Simple numbered lists (1. 2. 3.) - no markdown bullets | ||
| - Plain text with clear line breaks - avoid **bold** or *italic* | ||
| - Plain URLs: https://example.com | ||
| - Simple emojis for visual appeal | ||
| - Short, scannable paragraphs | ||
|
|
||
| Provide a comprehensive, helpful response that: | ||
| 1. Directly addresses their question using your GitHub expertise | ||
| 2. Incorporates relevant information from the web search results above | ||
| 3. Offers practical next steps and actionable advice | ||
| 4. Suggests related GitHub features or best practices | ||
| 5. Provides examples or code snippets when relevant | ||
| 6. Format for readability - clean, simple text | ||
| RESPONSE GUIDELINES: | ||
| 1. Directly address their question using your GitHub expertise | ||
| 2. Incorporate relevant information from the web search results above | ||
| 3. Offer practical next steps and actionable advice | ||
| 4. Suggest related GitHub features or best practices | ||
| 5. Provide examples or code snippets when relevant | ||
| 6. Maintain a conversational, helpful tone | ||
|
|
||
| Be conversational and actionable. Focus on being genuinely helpful for their GitHub needs.""" | ||
| Be genuinely helpful and actionable for their GitHub needs.""" |
38 changes: 21 additions & 17 deletions
38
backend/app/agents/devrel/github/prompts/intent_analysis.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,28 @@ | ||
| RESPONSE_PROMPT = """You are a helpful DevRel assistant. Create a comprehensive response based on all available information. | ||
|
|
||
| USER'S REQUEST: | ||
| {latest_message} | ||
|
|
||
| CONVERSATION SUMMARY: | ||
| {conversation_summary} | ||
|
|
||
| RECENT CONVERSATION: | ||
| {conversation_history} | ||
|
|
||
| CURRENT CONTEXT: | ||
| {current_context} | ||
|
|
||
| YOUR REASONING PROCESS: | ||
| {supervisor_thinking} | ||
|
|
||
| TOOL RESULTS: | ||
| {tool_results} | ||
|
|
||
| TASK RESULT: | ||
| {task_result} | ||
|
|
||
| DISCORD FORMATTING REQUIREMENTS: | ||
| - Use simple numbered lists (1. 2. 3.) instead of markdown bullets | ||
| - Avoid complex markdown formatting like **bold** or *italic* | ||
| - Use plain text with clear line breaks | ||
| - Format links as plain URLs: https://example.com | ||
| - Use simple emojis for visual appeal: π π β‘ | ||
| - Keep paragraphs short and scannable | ||
| - Use "β" for arrows instead of markdown arrows | ||
|
|
||
| Instructions: | ||
| 1. Synthesize all information - Use reasoning process, tool results, and task results together | ||
| 2. Address the user's needs - Focus on what they're trying to accomplish | ||
| 3. Be actionable - Provide specific steps, resources, or guidance | ||
| 4. Stay DevRel-focused - Be encouraging, helpful, and community-oriented | ||
| 5. Reference sources - Mention what you researched or considered when relevant | ||
| 6. Format for readability - Clean, simple text that displays well | ||
| RESPONSE_PROMPT = """You are a helpful DevRel assistant. Create a comprehensive response | ||
| based on all available information. | ||
|
|
||
| USER'S REQUEST: {latest_message} | ||
| CONVERSATION SUMMARY: {conversation_summary} | ||
| RECENT CONVERSATION: {conversation_history} | ||
| CURRENT CONTEXT: {current_context} | ||
| YOUR REASONING: {supervisor_thinking} | ||
| TOOL RESULTS: {tool_results} | ||
| TASK RESULT: {task_result} | ||
|
|
||
| FORMATTING FOR DISCORD: | ||
| - Simple numbered lists (1. 2. 3.) - no markdown bullets | ||
| - Plain text with clear line breaks - avoid **bold** or *italic* | ||
| - Plain URLs: https://example.com | ||
| - Simple emojis for visual appeal (use sparingly and appropriately) | ||
| - Short, scannable paragraphs | ||
| - Use "β" instead of markdown arrows | ||
|
|
||
| RESPONSE REQUIREMENTS: | ||
| 1. Synthesize all available information (reasoning, tool results, task results) | ||
| 2. Address the user's specific needs and goals | ||
| 3. Provide actionable steps, resources, or guidance | ||
| 4. Maintain encouraging, community-oriented DevRel tone | ||
| 5. Reference sources when relevant | ||
| 6. Ensure readability and clear formatting | ||
|
|
||
| Create a helpful, comprehensive response:""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,17 @@ | ||
| EXTRACT_SEARCH_QUERY_PROMPT = """Extract the core search query from the following user message. | ||
| EXTRACT_SEARCH_QUERY_PROMPT = """Extract the most effective search query from the user message. | ||
|
|
||
| User Message: "{message}" | ||
| Focus on the main topic or question. Be concise. | ||
| Search Query: """ | ||
|
|
||
| GUIDELINES: | ||
| - Focus on the main topic, key terms, and specific questions | ||
| - Remove conversational filler ("I was wondering", "Can you help me") | ||
| - Include technical terms, tool names, and specific concepts | ||
| - Keep it concise but comprehensive (2-8 key words/phrases) | ||
| - Preserve important context that affects the search | ||
|
|
||
| Examples: | ||
| - "I'm having trouble setting up Docker" β "Docker setup troubleshooting" | ||
| - "Can you help me understand how React hooks work?" β "React hooks tutorial guide" | ||
| - "What's the best way to deploy to AWS?" β "AWS deployment best practices" | ||
|
|
||
| Search Query:""" |
29 changes: 16 additions & 13 deletions
29
backend/app/agents/devrel/prompts/summarization_prompt.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,21 @@ | ||
| CONVERSATION_SUMMARY_PROMPT = """You are a DevRel assistant. Create a concise summary of this conversation. | ||
| CONVERSATION_SUMMARY_PROMPT = """You are a DevRel assistant. Create a concise summary | ||
| of this conversation for future context. | ||
|
|
||
| EXISTING SUMMARY: | ||
| {existing_summary} | ||
| EXISTING SUMMARY: {existing_summary} | ||
| RECENT CONVERSATION: {recent_conversation} | ||
| USER PROFILE: {user_profile} | ||
|
|
||
| RECENT CONVERSATION: | ||
| {recent_conversation} | ||
| SUMMARY FOCUS: | ||
| 1. User's technical background and experience level | ||
| 2. Specific problems or challenges they're facing | ||
| 3. Topics of interest and areas they're exploring | ||
| 4. Key solutions or resources provided | ||
| 5. Follow-up items or ongoing assistance needed | ||
|
|
||
| USER PROFILE: | ||
| {user_profile} | ||
|
|
||
| Instructions: | ||
| 1. Create a NEW summary combining existing and recent conversation | ||
| 2. Focus on user's technical interests, problems, and experience level | ||
| 3. Keep under 300 words | ||
| 4. Include relevant context for future interactions | ||
| REQUIREMENTS: | ||
| - Combine existing and recent conversation into NEW summary | ||
| - Keep under 300 words for efficiency | ||
| - Include relevant context for future interactions | ||
| - Focus on actionable insights about the user's needs | ||
|
|
||
| NEW SUMMARY:""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,73 @@ | ||
| DEVREL_TRIAGE_PROMPT = """Analyze this message to determine if it needs DevRel assistance. | ||
| DEVREL_TRIAGE_PROMPT = """Analyze this message to determine if it needs DevRel assistance. | ||
| Be EXTREMELY STRICT and CONSERVATIVE - the DevRel agent should only be triggered in very specific circumstances. | ||
|
|
||
| Message: {message} | ||
|
|
||
| Context: {context} | ||
|
|
||
| DevRel handles: | ||
| - Technical questions about projects/APIs | ||
| - Developer onboarding and support | ||
| - Bug reports and feature requests | ||
| - Community discussions about development | ||
| - Documentation requests | ||
| - General developer experience questions | ||
| STRICT ACTIVATION RULES - DevRel agent should ONLY be triggered if: | ||
|
|
||
| 1. EXPLICIT BOT MENTION/TAG (highest priority): | ||
| - User explicitly mentions the DevRel AI bot (e.g., "@Devr.AI", "hey bot", | ||
| "can you help", "@assistant") | ||
| - User directly addresses the AI assistant with phrases like "AI", "bot", | ||
| "assistant", "help me" | ||
| - User uses command-like language: "bot, can you...", "assistant, please..." | ||
|
|
||
| 2. DIRECT PROJECT QUESTIONS (only if clearly related to THIS specific repository/project): | ||
| - Setup/installation questions: "How do I set up the development environment?" | ||
| - Build/compilation errors: "I'm getting a build error", "compilation failed" | ||
| - Contribution process: "How do I contribute?", "How do I submit a PR?" | ||
| - Repository-specific technical issues: "This API endpoint isn't working" | ||
| - Documentation requests about THIS project: "Where is the API documentation?" | ||
|
|
||
| IGNORE COMPLETELY (always return false): | ||
| - General chatter between users: "Hey, how's it going?", "What's for lunch?" | ||
| - Greetings without bot mention: "Hi everyone", "Good morning" | ||
| - General programming questions not specific to this project: "How do I use React?" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please check the result on this query in both cases, with tagging the bot and this general one too. I don't think |
||
| - Conversations between other users that don't mention the bot | ||
| - Off-topic discussions: weather, personal conversations, unrelated topics | ||
| - Vague statements without clear questions: "This is cool", "Nice work" | ||
| - General complaints without specific technical issues: "This is frustrating" | ||
| - General questions that could be answered by anyone: "What time is it?", "How's the weather?" | ||
| - Questions about other projects or technologies not related to this repository | ||
| - Social conversations, jokes, or casual banter | ||
| - Questions that don't require technical assistance | ||
|
|
||
| CRITICAL: If the message is general conversation, casual chat, or doesn't explicitly | ||
| involve the bot OR a specific question about THIS project/repository, return needs_devrel: false. | ||
|
|
||
| BE CONSERVATIVE: When in doubt, return false. It's better to miss a few legitimate requests | ||
| than to respond to inappropriate messages. | ||
|
|
||
| Respond ONLY with JSON: | ||
| {{ | ||
| "needs_devrel": true/false, | ||
| "priority": "high|medium|low", | ||
| "reasoning": "brief explanation" | ||
| "reasoning": "brief explanation of decision" | ||
| }} | ||
|
|
||
| Examples: | ||
| - "How do I contribute?" β {{"needs_devrel": true, "priority": "high", "reasoning": "Onboarding question"}} | ||
| - "What's for lunch?" β {{"needs_devrel": false, "priority": "low", "reasoning": "Not development related"}} | ||
| - "API is throwing errors" β {{"needs_devrel": true, "priority": "high", "reasoning": "Technical support needed"}} | ||
| STRICT Examples: | ||
| - "How do I contribute?" β {{"needs_devrel": true, "priority": "high", | ||
| "reasoning": "Direct contribution question"}} | ||
| - "Hey @Devr.AI, can you help me?" β {{"needs_devrel": true, "priority": "high", | ||
| "reasoning": "Explicit bot mention"}} | ||
| - "I'm getting a build error in this project" β {{"needs_devrel": true, "priority": "high", | ||
| "reasoning": "Project-specific technical issue"}} | ||
| - "What's for lunch?" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "General chatter, not project-related"}} | ||
| - "Hi everyone" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "General greeting without bot mention"}} | ||
| - "How do I use React?" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "General programming question, not project-specific"}} | ||
| - "Nice work on this feature" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "General comment, no question or bot mention"}} | ||
| - "That's frustrating" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "Vague complaint without specific issue"}} | ||
| - "What time is it?" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "General question not requiring technical assistance"}} | ||
| - "How's the weather?" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "Off-topic question unrelated to project"}} | ||
| - "This is a great project" β {{"needs_devrel": false, "priority": "low", | ||
| "reasoning": "General compliment, no question or bot mention"}} | ||
| """ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be tested. might respond to user queries not requiring DevRel