From be91141dbbb12c9de7543cd94af2f9247fc6d16d Mon Sep 17 00:00:00 2001 From: For <1597006376@qq.com> Date: Tue, 16 May 2023 12:03:55 +0800 Subject: [PATCH] update --- HowToPlayByMain.md | 29 +++++++++++++++++++++++++++++ main.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 HowToPlayByMain.md create mode 100644 main.py diff --git a/HowToPlayByMain.md b/HowToPlayByMain.md new file mode 100644 index 0000000..8a56b7a --- /dev/null +++ b/HowToPlayByMain.md @@ -0,0 +1,29 @@ + + +# What and Why + +This is a [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) implement code for beginner to play!!! +This is a ChatGPT Prompt for Beginner!!! +Enjoy yourself,bro + +# Usage + +1. Change Prompt + + According to your act,put the prompt from prompts.csv into the prompt variable + +2. Run code,give the input,ChatGPT will output depend on your task + +3. If you get it,you can DIY the code + + I give extra code that has been commented,u can use it. + + Enjoy it , Bro , have fun! + +# Try it for more + +[ChatGPT Official Document](https://platform.openai.com/docs/introduction/overview) + +[Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) + +[Make money by prompt](https://promptbase.com/) diff --git a/main.py b/main.py new file mode 100644 index 0000000..ba47ee3 --- /dev/null +++ b/main.py @@ -0,0 +1,32 @@ +import openai +def generate_prompt(prompt): + #You can DIY by these function + return prompt +def openai_reply(content, apikey): + openai.api_key = apikey + response = openai.ChatCompletion.create( + # You can change gpt-3.5-turbo-0301 into other model like gpt-4 + model="gpt-3.5-turbo-0301", # gpt-3.5-turbo-0301 + messages=[ + # {"role": "system", "content": ""}, you can DIY by the content + {"role": "user", "content": generate_prompt(content)} + ], + #The temperature and top_p is more low,the random is more low + #If you should keep your answer accuracy,such as you need translate, + # you can set temperature=0.2 and top_p=0.2 + temperature=0.5, + max_tokens=1000, + top_p=0.5, + frequency_penalty=0, + presence_penalty=0, + ) + # print(response) + return response.choices[0].message.content + +#Run the code,to test,to show these +# Just change the prompt by prompts.csv +#Such as these code,you can change pwd to ls,and you can change the code using while True and input to interactive with the AI +prompt="I want you to act as a linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. do not write explanations. do not type commands unless I instruct you to do so. when i need to tell you something in english, i will do so by putting text inside curly brackets {like this}. my first command is pwd" +#Get the api key from https://beta.openai.com/account/api-keys,it's free,just sign up +response=openai_reply(prompt,"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") +print(response) \ No newline at end of file