Last active
January 9, 2024 23:23
-
-
Save athmanar/241105836487d0b393f44f9bf6b9e0ee to your computer and use it in GitHub Desktop.
OPENAI
This file contains 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
import openai | |
from openai import OpenAI | |
import os | |
import pandas as pd | |
import time | |
import os | |
def get_completion(prompt): | |
client = OpenAI(api_key='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', ) | |
chat_completion = client.chat.completions.create( messages=[ { "role": "user", "content": prompt, } ], model="gpt-4-1106-preview", ) | |
return response.choices[0].message.content | |
prompt = "give me an example code using numpy to reverse a list. give only the code and no extra text before and after code.wrap any code result in <code></code> block" | |
response = get_completion(prompt) | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment