Advertisement
DenisSergeevitch

Anthropic Prompter / Raw

May 10th, 2024 (edited)
1,208
3
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.03 KB | None | 3 0
  1. # @title Prompt for Removing Floating Variables
  2. remove_floating_variables_prompt = """I will give you a prompt template with one or more usages of variables (capitalized words between curly braces with a dollar sign). Some of these usages are erroneous and should be replaced with the unadorned variable name (possibly with minor cosmetic changes to the sentence). What does it mean for a usage to be "erroneous"? It means that when the variable is replaced by its actual value, the sentence would be ungrammatical, nonsensical, or otherwise inappropriate.
  3.  
  4. For example, take this prompt:
  5.  
  6. <example_prompt>
  7. You are an AI assistant that specializes in helping users grade a resume according to a rubric that I will provide. Your task is to read the {$RESUME} closely and evaluate it according to each of the criteria listed in the {$RUBRIC}.
  8.  
  9. Here is the resume you will be assessing:
  10. <resume>
  11. {$RESUME}
  12. </resume>
  13.  
  14. And here is the rubric you will be using:
  15. <rubric>
  16. {$RUBRIC}
  17. </rubric>
  18.  
  19. First, in a <scratchpad>, go through each of the criteria in the rubric and consider how well the resume meets each one. Then, provide a <score> for that individual criteria. Consider individual elements of the resume and whether or not they meet the criteria.
  20.  
  21. Once you have scored each criteria, provide an overall <score> for the resume and justify your assessment in <justification> tags.
  22. </example_prompt>
  23.  
  24. Here are the variables, their texts and usages, and whether or not the usages are erroneous. A *variable* is a word or phrase that is used as a placeholder for various inputs that will be provided by the user. In the prompt, variables are denoted by surrounding brackets and a dollar sign, like this:
  25.  
  26. {$VARIABLE}
  27.  
  28. The *text* of a usage is the sentence or phrase in which the variable appears. The *apt* tag indicates whether the variable has been aptly and appropriately used. If the usage is actually intended to just be the plain text of the variable name, it's inapt.
  29.  
  30. <variables>
  31. <variable>
  32. <name>
  33. {$RESUME}
  34. </name>
  35. <usages>
  36. <usage>
  37. <text>
  38. Your task is to read the {$RESUME} closely and evaluate it according to each of the criteria listed in the {$RUBRIC}.
  39. <text>
  40. <thinking>
  41. Replacing "{$RESUME}" with an actual resume would not make sense in the context of this sentence.
  42. Replacing "{$MENU}" with the word "resume" would make more sense.
  43. </thinking>
  44. <apt>
  45. No
  46. </apt>
  47. <usage>
  48. <usage>
  49. <text>
  50. Here is the resume you will be assessing:
  51. <resume>
  52. {$RESUME}
  53. </resume>
  54. <text>
  55. <thinking>
  56. Here, the "{$RESUME}" variable is introduced by the phrase "Here is the resume you will be assessing:" and wrapped in XML tags. Substituting the full resume would make total sense. In contrast, replacing it with the mere *word* "resume" would not be correct because there's an expectation that the actual resume should go here.
  57. </thinking>
  58. <apt>
  59. Yes
  60. </apt>
  61. <usage>
  62. </usages>
  63. </variable>
  64. <variable>
  65. <name>
  66. {$RUBRIC}
  67. </name>
  68. <usages>
  69. <usage>
  70. <text>
  71. Your task is to read the {$RESUME} closely and evaluate it according to each of the criteria listed in the {$RUBRIC}.
  72. </text>
  73. <apt>
  74. No
  75. </apt>
  76. </usage>
  77. <usage>
  78. <text>
  79. And here is the rubric you will be using:
  80. <rubric>
  81. {$RUBRIC}
  82. </rubric>
  83. </text>
  84. <apt>
  85. Yes
  86. </apt>
  87. </usage>
  88. </usages>
  89. </variable>
  90. </variables>
  91.  
  92. In general, inline variable usages (not surrounded by XML tags) are only apt when they BOTH 1. refer to a variable that would be expected to be quite short, and also 2. exist within grammatical structures that would make sense after a subsitution.
  93.  
  94. Here are some more example usages along with whether or not they are apt.
  95.  
  96. <example>
  97. <text>
  98. Always keep in mind your ultimate {$GOAL} when completing this task.
  99. </text>
  100. <thinking>
  101. Replacing "{$GOAL}" with an actual goal, a la "Always keep in mind your ultimate Becoming the best basketball player in the world when completing this task" would not make logical/grammaticall sense.
  102. Replacing "{$GOAL}" with "goal", on the other hand, makes total sense.
  103. </thinking>
  104. <apt>
  105. No
  106. </apt>
  107. </example>
  108. <example>
  109. <text>
  110. The email should be addressed to the {$RECIPIENT}.
  111. </text>
  112. <thinking>
  113. Substituting a recipient like bobjones23@gmail.com would lead to "The email should be addressed to the bobjones23@gmail.com." which is almost grammatical but not quite because of the "the".
  114. "The email should be addressed to the recipient" is perfectly coherent English.
  115. </thinking>
  116. <apt>
  117. No
  118. </apt>
  119. </example>
  120. <example>
  121. <text>
  122. Each usage of the word 'apple' should be replaced with one of the {$SUBSTITUTE_FRUITS} options.
  123. </text>
  124. <thinking>
  125. {$SUBSTITUTE_FRUITS} is a list of fruits. Replacing {$SUBSTITUTE_FRUITS} with "apple, banana, cherry" would not quite make sense in this context, but it would be fine to replace it with "substitute fruit", or to write "with one of these options: {$SUBSTITUTE_FRUITS}.".
  126. </thinking>
  127. <apt>
  128. No
  129. </apt>
  130. </example>
  131. <example>
  132. <text>
  133. When completing your task, please consider this goal:
  134. <goal>
  135. {$GOAL}
  136. </goal>
  137. </text>
  138. <thinking>
  139. The use of the colon and the XML tags indicates that the actual goal is expected here.
  140. </thinking>
  141. <apt>
  142. Yes
  143. </apt>
  144. </example>
  145. <example>
  146. <text>
  147. The email should be addressed to this person: {$RECIPIENT}.
  148. </text>
  149. <thinking>
  150. Here replacing "{$RECIPIENT}" with an email address would make sense because of the colon. Replacing it with just the word "recipient" would not make sense.
  151. </thinking>
  152. <apt>
  153. Yes
  154. </apt>
  155. </example>
  156. <example>
  157. <text>
  158. Each usage of the word 'apple' should be replaced with one of the following options:
  159. <substitute_fruits>
  160. {$SUBSTITUTE_FRUITS}
  161. </substitute_fruits>
  162. </text>
  163. <apt>
  164. Yes
  165. </apt>
  166. </example>
  167. <example>
  168. <text>
  169. Each instance of "{$FRUIT}" must be replaced with a vegetable.
  170. </text>
  171. <thinking>
  172. Because of the quotation marks, substituting the actual name of the fruit, a la 'Each instance of "apple" must be replaced with a vegetable', would make sense.
  173. </thinking>
  174. <apt>
  175. Yes
  176. </apt>
  177. </example>
  178.  
  179. Now that you've read and internalized the examples, please consider the following prompt:
  180. <prompt>
  181. {$PROMPT}
  182. </prompt>
  183.  
  184. Create an output like the <variables> block above, in which you list all the variables used in the prompt, their usages, your thinking (in <thinking> tags) about their aptness, and finally whether they are apt or inapt. While thinking, first consider each replacement before reaching a conclusion about aptness. If the usage seems grievously inapt (err on the side of presuming correctness), propose a rewrite.
  185.  
  186. Then, rewrite the prompt. Adapt each inapt variable use according to the remedy you proposed in the corresponding <thinking> tags. Put this rewrite in a <rewritten_prompt> tag. For apt variable usages, don't make any changes to that area of the prompt. If all usages are deemed apt, you may indicate this by simply writing "No changes." within the <rewritten_prompt> tags.
  187.  
  188. Important rule: Your rewritten prompt must always include each variable at least once. If there is a variable for which all usages are inapt, introduce the variable at the beginning in an XML-tagged block, analogous to some of the usages in the examples above."""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement