代码生成:通过在输入中添加 "Generate Python code for sorting an array: " 的 Prompt,引导模型生成相应的 Python 代码。问题回答:通过在输入中添加 "Question: " 的 Prompt,引导模型回答特定问题。内容创作:通过在输入中添加 "Write a short story about: " 的 Prompt,指导模型生成一个关于特定主题的故事。
这个结构上没有啥特别的,先定义了 Prompt 里的 角色,看来根据 OpenAI 的研究,角色是最重要的,也是必须要加的东西,要不然,可能会有问题。它也是防止攻击的一个好方式。 然后介绍了三个工具 Python 、 Dalle、 Browser,分别告诉 LLM 什么时机可以调用 。 最后这一段很有意思,我从来没有在我的 Prompt 里测试过...
You will provide code examples using python programming language. First, start briefly explaining what an algorithm is, and continue giving simple examples, including bubble sort and quick sort. Later, wait for my prompt for additional questions. As soon as you explain and give the code samples,...
所有的prompt都是用英文写的,因为实测发现chatgpt对英文的语义理解的更好,如果需要它回答中文的话,在prompt的最后让它将答案翻译为中文即可。 每个人的需求都是独一无二的,所以掌握如何根据这些需求定制有效的Prompt是提升ChatGPT使用效率的关键。无论你是编程初学者,还是语言学习者,都可以参考我们提供的实用场景及相...
导入poai这个库后,只需要1行代码poai.chatgpt.chat,就可以和ChatGPT进行对话了。注释和参数说明如下,👇 代码语言:python 代码运行次数:1 AI代码解释 # pip install poai# 下载教程:https://www.bilibili.com/video/BV1SM411y7vwimportpoai poai.chatgpt.chat(api_key='your_api_key',prompt='你懂中文...
一、Prompt 使用准则 本小节主要讲述一些原则和策略: 毋庸置疑,你需要先设置你的 openai key 代码语言:javascript 代码运行次数:0 运行 AI代码解释 import openai openai.api_key='sk-xxx' 利用model gpt-3.5-turbo构建一个函数 代码语言:javascript 代码运行次数:0 运行 AI代码解释 def get_completion(prompt, mo...
示例2: 利用chatGPT实现python代码bug自动修复 importosimportopenai openai.api_key=os.getenv("OPENAI_API_KEY") response=openai.Completion.create( model="code-davinci-002", prompt="### Fix bugs in the below function\n\n### Buggy Python\nimport Random\na = random.randint(1,12)\nb = random...
示例2: 利用chatGPT实现python代码bug自动修复 importos importopenai openai.api_key=os.getenv("OPENAI_API_KEY") response=openai.Completion.create( model="code-davinci-002", prompt="### Fix bugs in the below function\n \n### Buggy Python\nimport Random\na = random.randint(1,12)\nb = ra...
Optimize this code to improve database performance: [Input code]. Create a [RESTful] API template that can be used to connect my app with third-party services. Turn this code into [Python]: [Input code]. Explain how [abstraction] works and looks in [C#]. What's the correct syntax...
You will provide code examples using python programming language. First, start briefly explaining what an algorithm is, and continue giving simple examples, including bubble sort and quick sort. Later, wait for my prompt for additional questions. As soon as you explain and give the code samples,...