( userDescription: string | undefined, orgInfo: Pick<Organization, "name" | "description" | "chatbot_instructions">, includeIdUrlLine: boolean, language: string | null, )
| 217 | } |
| 218 | |
| 219 | export function chatToDocsPrompt( |
| 220 | userDescription: string | undefined, |
| 221 | orgInfo: Pick<Organization, "name" | "description" | "chatbot_instructions">, |
| 222 | includeIdUrlLine: boolean, |
| 223 | language: string | null, |
| 224 | ): ChatGPTMessage { |
| 225 | const userDescriptionSection = userDescription |
| 226 | ? `\nThe following is a description of the user - it's important that you take notice of this. ${userDescription}\n` |
| 227 | : ""; |
| 228 | return { |
| 229 | role: "system", |
| 230 | content: `${getIntroText(orgInfo)} Your purpose is to assist users ${ |
| 231 | orgInfo.name ? `in ${orgInfo.name} ` : "" |
| 232 | }using information from ${ |
| 233 | orgInfo.name ? orgInfo.name + "'s" : "their" |
| 234 | } documentation |
| 235 | ${ |
| 236 | orgInfo.chatbot_instructions ? `\n${orgInfo.chatbot_instructions}\n` : "" |
| 237 | }${userDescriptionSection} |
| 238 | You will be shown potentially relevant documentation. If a user's request is unclear, or the documentation doesn't answer it, ask them to clarify. |
| 239 | |
| 240 | RULES: |
| 241 | 1. Be very cautious about answering if the docs aren't clear. Do not invent things. I cannot express how disappointed I will be if you do. THIS IS VERY IMPORTANT |
| 242 | 2. Never tell the user to find the answer in the documentation. |
| 243 | 3. Reply in ${ |
| 244 | language ?? "the same language as the user" |
| 245 | }. You may have to translate the documentation to do this. THIS IS VERY IMPORTANT. DO NOT FORGET THIS. |
| 246 | 4. ${ |
| 247 | orgInfo.name |
| 248 | ? `You have expert knowledge in ${orgInfo.name}'s domain. Use this to help the user. However, i` |
| 249 | : "I" |
| 250 | }f there's nothing relevant in the docs for answering a question, tell the user that this isn't mentioned in the docs. |
| 251 | 5. Be extremely concise in your response${ |
| 252 | includeIdUrlLine |
| 253 | ? "\n6. URLs have been replaced by variables URLX (where X is a number). These variables are filled in with the real values before being shown to the user, so use URLX as you would use the URL it represents" |
| 254 | : "" |
| 255 | }`, |
| 256 | }; |
| 257 | } |
| 258 | |
| 259 | export function simpleChatPrompt( |
| 260 | userDescriptionSection: string, |
no test coverage detected