Learning-Prompt
Learning-Prompt copied to clipboard
[new tech] Functional Prompt
During the communication process with GPT, I wish to place the question or topic (i.e., prompt) into a separate area or structure. The purpose of doing so is to conveniently introduce the question or topic to GPT for processing when needed. At the same time, restricting it within a block helps avoid ambiguity in GPT's understanding of the question or topic, thus improving communication efficiency. So I tried using a functional programming approach, and the results seemed quite good. I plan to include this technique in the tutorial. If you find it helpful, I can give a more thorough explanation and submit a pull request. Here's an example: This example can run in GPT3.5, better in 4.
First, we need to add a functional prompt's define.
Hello, ChatGPT! I hope you are doing well. I am reaching out to you for assistance with a specific function. I understand that you have the capability to process information and perform various tasks based on the instructions provided. In order to help you understand my request more easily, I will be using a template to describe the function, input, and instructions on what to do with the input. Please find the details below:
function_name: [Function Name]
input: [Input]
rule: [Instructions on how to process the input]
I kindly request you to provide the output for this function, based on the details I have provided. Your assistance is greatly appreciated. Thank you!
I will replace the text inside the brackets with the relevant information for the function I want you to perform. This detailed introduction should help you understand my request more efficiently and provide the desired output. The format is function_name(input) If you understand, just answer one word with ok.
Second, write a function about translating Chinese into English.
function_name: [trans_word]
input: ["text"]
rule: [I want you to act as an English translator, spelling corrector and improver. I will provide you with input forms including "text" in any language and you will detect the language, translate it and answer in the corrected of my text, in English.]
write a function about expanding the text.
function_name: [expand_word]
input: ["text"]
rule: [Please serve as a Chatterbox, spelling corrector, and language enhancer. I will provide you with input forms including "text" in any language, and output the original language.I want you to Keep the meaning same, but make them more literary.]
write a function about correcting the text.
function_name: [fix_english]
input: ["text"]
rule: [Please serve as an English translator, spelling corrector, and language enhancer. I will provide you with input forms including "text", I want you to improve the text's vocabulary and sentences with more natural and native. Keep the meaning same.]
Finally, run single function or combine together.
trans_word('婆罗摩火山处于享有“千岛之国”美称的印度尼西亚。多岛之国印尼有4500座之多的火山,世界著名的十大活火山有三座在这里。')
fix_english('Act as an English Translator and Improver')
fix_english(expand_word(trans_word('婆罗摩火山处于享有“千岛之国”美称的印度尼西亚。多岛之国印尼有4500座之多的火山,世界著名的十大活火山有三座在这里。')))
Even if multiple params will work fine.
function_name: [pg]
input: ["length", "capitalized", "lowercase", "numbers", "special"]
rule: [I want you to act as a password generator for individuals in need of a secure password. I will provide you with input forms including "length", "capitalized", "lowercase", "numbers", and "special" characters. Your task is to generate a complex password using these input forms and provide it to me. Do not include any explanations or additional information in your response, simply provide the generated password. For example, if the input forms are length = 8, capitalized = 1, lowercase = 5, numbers = 2, special = 1, your response should be a password such as "D5%t9Bgf".]
pg(length = 10, capitalized = 1, lowercase = 5, numbers = 2, special = 1)
pg(10,1,5,2,1)
So looking into the future, these functions can be like normal programming. When initializing the page, the required functions can be automatically imported.