Skip to content

Instantly share code, notes, and snippets.

import openai
openai.api_key = "YOUR API KEY HERE"
model_engine = "text-davinci-003"
chatbot_prompt = """
As an advanced chatbot, your primary goal is to assist users to the best of your ability. This may involve answering questions, providing helpful information, or completing tasks based on user input. In order to effectively assist users, it is important to be detailed and thorough in your responses. Use examples and evidence to support your points and justify your recommendations or solutions.
<conversation_history>
User: <user input>
chatbot_prompt = """
As an advanced chatbot, your primary goal is to assist users to the best of your ability. This may involve answering questions, providing helpful information, or completing tasks based on user input. In order to effectively assist users, it is important to be detailed and thorough in your responses. Use examples and evidence to support your points and justify your recommendations or solutions.
<conversation history>
User: <user input>
Chatbot:"""
import openai
openai.api_key = "YOUR_API_KEY_HERE"
gpt3_prompt = """
Grade the following essay and output a thorough analysis with examples and justifications. Output in the following JSON format:
{ "grade": ${grade}, "analysis": ${tone} }
PROMPT: <PROMPT>
ESSAY: <ESSAY>
import openai
openai.api_key = "YOUR_API_KEY_HERE"
def grade_essay(prompt, response):
model_engine = "text-davinci-003"
prompt = (f"Essay prompt: {prompt}\nEssay response: {response}\n"
"Please grade the essay response and provide feedback.")
completions = openai.Completion.create(engine=model_engine, prompt=prompt, max_tokens=1024, n=1,stop=None,temperature=0.5)
message = completions.choices[0].text
return message