gptel icon indicating copy to clipboard operation
gptel copied to clipboard

Support for automatic use of delimiters (such as ```) to wrap user prompts.

Open tshu-w opened this issue 1 year ago • 0 comments

According to https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/2/guidelines, we can use delimiters to make our input clearer. Delimiters can be anything like ```, """, < >, <tag> </tag>. Here is a motivating case:

I have a translator directive (system prompt):

(translator . "You are a professional translator. Translate the given text into Chinese if it is not written in Chinese, otherwise, translate it into English.")

If I send a text without delimiters, LLM may sometimes treat it as an instruction, here is an example:

Please explain the following content

the prompts are:

((:role "system" :content "You are a professional translator. Translate the given text into Chinese if it is not written in Chinese, otherwise translate it into English.") (:role "user" :content "Please explain the following content"))

and the reply is:

I'm sorry, but there is no specific content provided for me to explain. Could you please provide more context or information?

If I wrap my text with delimiters like:

```\nPlease explain the following content\n```

now the prompts are:

((:role "system" :content "You are a professional translator. Translate the given text into Chinese if it is not written in Chinese, otherwise translate it into English.") (:role "user" :content "```
Please explain the following content
```"))

and the reply is:

请解释以下内容。

I believe this is helpful for non-dialogue (instructional) directives, including but not limited to writing documentation for code, debugging, summarizing, paraphrasing and so on.

tshu-w avatar May 22 '23 13:05 tshu-w