Skip to content

Commit

Permalink
Change main.py. everything works yohooo
Browse files Browse the repository at this point in the history
  • Loading branch information
levon-d committed Jan 27, 2024
1 parent 0c4bfec commit f01bc0d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions functions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
chat_gpt_client = OpenAI()


#
#
# generate story from inputs
@https_fn.on_request()
def trythis(req: https_fn.Request) -> https_fn.Response:
def generate_story(req: https_fn.Request) -> https_fn.Response:
text = req.args.get("text")
theme = req.args.get("theme")
age_rating = req.args.get("age_rating")
# story_line = req.args.get("storyLine")
word_count = req.args.get("word_ount")
word_count = req.args.get("word_count")

completion = chat_gpt_client.chat.completions.create(
model="gpt-4",
Expand All @@ -32,7 +31,7 @@ def trythis(req: https_fn.Request) -> https_fn.Response:
},
],
)
response = completion.choices[0].message
response = completion.choices[0].message
print(completion.choices[0].message)

return https_fn.Response(response)
return https_fn.Response(response.content)

0 comments on commit f01bc0d

Please sign in to comment.