Skip to content

Instantly share code, notes, and snippets.

@renaud
Created May 25, 2024 20:28
Show Gist options
  • Save renaud/eb9566a0eb44d0f66958c9ed2a882982 to your computer and use it in GitHub Desktop.
Save renaud/eb9566a0eb44d0f66958c9ed2a882982 to your computer and use it in GitHub Desktop.
OpenAI Playground
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-3.5-turbo-16k",
messages=[
{
"role": "system",
"content": [
{
"type": "text",
"text": "You will be provided with a piece of code, and your task is to explain it in a concise way."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "def f(i):\n if i <= 1:\n return i\n else:\n return (f(i - 1) + f(i - 2))"
}
]
}
],
temperature=0,
max_tokens=256,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment