Skip to content

Instantly share code, notes, and snippets.

@ajalexander
ajalexander / main.py
Last active May 15, 2023 14:19
Example code for OpenAI API usage
import openai
import os
openai.api_key = os.getenv('OPENAI_API_KEY')
completion_model = 'text-davinci-003'
chat_model = 'gpt-3.5-turbo'
def text_completion_single():
completion = openai.Completion.create(model=completion_model, prompt='What are the three primary colors?')