Skip to content

AI hint-Prompt needs an improvement #15

@decodingafterlife

Description

@decodingafterlife

📌 Description

The current prompt for hints is:

  try {
      const response = await fetch('https://api.groq.com/openai/v1/chat/completions', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${apiKey}`,
        },
        body: JSON.stringify({
          model,
          messages: [
            {
              role: 'system',
              content: `You are an AI assistant for LeetCode. Provide a ${level} hint for the following problem. Do not solve the entire problem. Just provide a hint.`,
            },
            {
              role: 'user',
              content: context,
            },
          ],
        }),

This is very basic and has lot of flaws:

  • No consistency in the generation of hint (The same type of hint can result into two different responses from the same model).
  • No consistent hierarchy or improvement of hint, sometimes the ordinary hint can be better than advanced even if it costs less.
  • Bad prompt.

✅ Tasks

1. Overall improvement in hint generation:

  • Overall improvement in prompt structure.
  • Create three distinct prompts tailored to the three hint tiers: ordinary, advanced, and expert. Each should build upon the previous level in depth and technicality.

2. Improvement in the consistency of hints:

  • Use temperature parameter to keep the hints more balanced and consistent.

3. LangChain:

  • Use of LangChain to store the 3 different prompts and send them to the model based on the requested hint from the user.
  • Add a word limit so that the hint is not too long or too short.
  • Currently when we use the deepseek model we also see the part of the responce. Langchain can be used to remove this so that only the hint is displayed.

4. Testing:

  • Testing all that is mentioned above.
  • Run tests comparing responses from each hint level for multiple problems to check for hierarchy consistency.

📂 Relevant Files

  • `popup.js'
  • 'prompts.js': Maybe create a new file for storing the prompts and the LangChain workflow.

🔴 Currently a level2 contribution but can be upgraded to level3 on proper resolution.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions