prompts.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from llama_index import QueryKeywordExtractPrompt
  2. CONVERSATION_TITLE_PROMPT = (
  3. "Human:{query}\n-----\n"
  4. "Help me summarize the intent of what the human said and provide a title, the title should not exceed 20 words.\n"
  5. "If the human said is conducted in Chinese, you should return a Chinese title.\n"
  6. "If the human said is conducted in English, you should return an English title.\n"
  7. "title:"
  8. )
  9. CONVERSATION_SUMMARY_PROMPT = (
  10. "Please generate a short summary of the following conversation.\n"
  11. "If the conversation communicating in Chinese, you should return a Chinese summary.\n"
  12. "If the conversation communicating in English, you should return an English summary.\n"
  13. "[Conversation Start]\n"
  14. "{context}\n"
  15. "[Conversation End]\n\n"
  16. "summary:"
  17. )
  18. INTRODUCTION_GENERATE_PROMPT = (
  19. "I am designing a product for users to interact with an AI through dialogue. "
  20. "The Prompt given to the AI before the conversation is:\n\n"
  21. "```\n{prompt}\n```\n\n"
  22. "Please generate a brief introduction of no more than 50 words that greets the user, based on this Prompt. "
  23. "Do not reveal the developer's motivation or deep logic behind the Prompt, "
  24. "but focus on building a relationship with the user:\n"
  25. )
  26. MORE_LIKE_THIS_GENERATE_PROMPT = (
  27. "-----\n"
  28. "{original_completion}\n"
  29. "-----\n\n"
  30. "Please use the above content as a sample for generating the result, "
  31. "and include key information points related to the original sample in the result. "
  32. "Try to rephrase this information in different ways and predict according to the rules below.\n\n"
  33. "-----\n"
  34. "{prompt}\n"
  35. )
  36. SUGGESTED_QUESTIONS_AFTER_ANSWER_INSTRUCTION_PROMPT = (
  37. "Please help me predict the three most likely questions that human would ask, "
  38. "and keeping each question under 20 characters.\n"
  39. "The output must be in JSON format following the specified schema:\n"
  40. "[\"question1\",\"question2\",\"question3\"]\n"
  41. )
  42. QUERY_KEYWORD_EXTRACT_TEMPLATE_TMPL = (
  43. "A question is provided below. Given the question, extract up to {max_keywords} "
  44. "keywords from the text. Focus on extracting the keywords that we can use "
  45. "to best lookup answers to the question. Avoid stopwords."
  46. "I am not sure which language the following question is in. "
  47. "If the user asked the question in Chinese, please return the keywords in Chinese. "
  48. "If the user asked the question in English, please return the keywords in English.\n"
  49. "---------------------\n"
  50. "{question}\n"
  51. "---------------------\n"
  52. "Provide keywords in the following comma-separated format: 'KEYWORDS: <keywords>'\n"
  53. )
  54. QUERY_KEYWORD_EXTRACT_TEMPLATE = QueryKeywordExtractPrompt(
  55. QUERY_KEYWORD_EXTRACT_TEMPLATE_TMPL
  56. )