I mean its the biggest commit I ever did (did git add * cause I didn't want to explain all of this It's already so complicated)

This commit is contained in:
Paillat
2023-06-25 16:12:23 +02:00
parent 09c98a460b
commit e676d5851e
14 changed files with 568 additions and 123 deletions

View File

@@ -1,10 +1,6 @@
import openai
import os
import json
from dotenv import load_dotenv
load_dotenv()
from utils.openaicaller import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
with open('prompts/ideas.txt') as f:
prompt = f.read()
f.close()
@@ -25,13 +21,13 @@ async def generate_ideas(path, subject):
exuisting_ideas += f"{idea['title']}\n"
prmpt = prmpt.replace('[existing ideas]', exuisting_ideas)
print(prmpt)
response = await openai.ChatCompletion.acreate(
response = await openai.generate_response(
model="gpt-3.5-turbo",
messages=[
{"role":"user","content":prmpt},
],
)
json_in_str= response['choices'][0]['message']['content']
json_in_str= response['choices'][0]['message']['content'] # type: ignore
json_obj = json.loads(json_in_str)
for idea in json_obj:
ides_json.append(idea)