OpenAI

List of all model names

duration = 10
topic = "Using Data in IEPs"

prompt = f"""
You are tasked with creating a {duration} minute lecture that covers "{topic}". 
Give a numbered list of short topics(under 8 words) that you would cover in this lecture:
"""

response1 = openai.ChatCompletion.create(
    model="gpt-4",
    messages=[
          {"role": "system", "content": "You are a one of the best teachers for adult students and seek to be educational and interesting."},
          {"role": "user", "content": prompt},
    ]
)
print(response1)

Utils

def parse_numbered_list(raw_list):
    number_regex = r"[0-9]+\. *"
    new_line_seperated_response = re.sub(number_regex, "", raw_list)
    # print(new_line_seperated_response)
    new_line_regex = r"(\n)+"
    l = re.sub(new_line_regex, "\n", new_line_seperated_response).split("\n")
    return l

Errors

Old

Text completion

  • Design quality prompt with instructions and examples

  • Temperature 0 is deterministic for where there is one right answer, 1 is for when many different answers are preferred. Its not "creativity"

Prompt Examples

Conversation, notice we can give the AI assistant an identity

Tips

  • use max_tokens > 256

  • Prefer finish_reason == "stop"

  • Resampling 3-5 times with high temperature then pick samples that use stop as finish reason can be best

  • Provide examples

Last updated