mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-28 17:29:30 +00:00
fix: update generate_humor_dataset.py to use new OpenAI Python client API
This commit is contained in:
parent
aa8a1ed416
commit
7e3f32b296
1 changed files with 3 additions and 3 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import openai
|
from openai import OpenAI
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
openai.api_key = os.getenv("OPENAI_API_KEY")
|
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
||||||
|
|
||||||
comedians = [
|
comedians = [
|
||||||
"Norm Macdonald",
|
"Norm Macdonald",
|
||||||
|
|
@ -31,7 +31,7 @@ def main():
|
||||||
f"What’s the best local LLM model to generate {fmt} jokes "
|
f"What’s the best local LLM model to generate {fmt} jokes "
|
||||||
f"in the style of {comedian}? Please explain your reasoning step by step."
|
f"in the style of {comedian}? Please explain your reasoning step by step."
|
||||||
)
|
)
|
||||||
response = openai.ChatCompletion.create(
|
response = client.chat.completions.create(
|
||||||
model=model_name,
|
model=model_name,
|
||||||
messages=[{"role": "user", "content": question}],
|
messages=[{"role": "user", "content": question}],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue