Last active
December 4, 2023 06:05
-
-
Save bmidgley/58d2dc3741a9e875ce86932d7c9fed58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import OpenAI | |
import os | |
client = OpenAI(api_key=os.getenv('OPENAI_API_KEY')) | |
def get_response(passage): | |
prompt = f'Define each of the words in the following passage in English, Spanish and Chinese:\n\n{passage}' | |
print(prompt) | |
response = client.chat.completions.create(model="gpt-4", messages=[{"role": "user", "content": prompt}]) | |
return response | |
response = get_response('What is the diameter of the unit circle?') | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment