LibreChat icon indicating copy to clipboard operation
LibreChat copied to clipboard

Enhancement: Auto generate suggested follow-up questions

Open Manouchehri opened this issue 1 year ago • 0 comments

What features would you like to see added?

Similar to how the title generation is done, it'd be cool if LibreChat could also suggest follow-up replies.

image

Suggested API Request

This is a perfect use of n too, so we get multiple replies at the cost of a single input prompt.

curl -v "${OPENAI_API_BASE}/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o-mini-2024-07-18",
    "temperature": 1.2,
    "stop": ["\n"],
    "max_tokens": 100,
    "n": 3,
    "messages": [
      {
        "role": "user",
        "content": "Do you know about LibreChat'\''s programming language?"
      },
      {
        "role": "assistant",
        "content": "Yes, LibreChat is developed using TypeScript."
      },
      {
        "role": "user",
        "content": "Write a short one-sentence question that the user can ask that naturally follows from the previous few questions and answers. It should not ask a question which is already answered in the conversation. It should be a question that you are capable of answering. Reply with only the text of the question and nothing else."
      }
    ]
  }'

Outputs:

What features does LibreChat offer to enhance user experience?
What are some key features of LibreChat?
What features make TypeScript a good choice for developing applications like LibreChat?

Config

LibreChat should add the following configs:

followUpN: 3
followUpModel: gpt-4o-mini-2024-07-18
followUpTemperature: 1.2

Setting followUpN: 0 should disable generating follow-up questions completely.

More details

Here's the user prompt that GitHub Copilot Chat uses for this:

Write a short one-sentence question that the user can ask that naturally follows from the previous few questions and answers. It should not ask a question which is already answered in the conversation. It should be a question that you are capable of answering. Reply with only the text of the question and nothing else.

Which components are impacted by your request?

UI

Pictures

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Manouchehri avatar Sep 19 '24 21:09 Manouchehri