fearflixai / story.py
LittleLirow's picture
Modify story prompt to ensure story length
21cfd1e
import os
import openai
def text2story(text, auth):
openai.api_key = auth
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a psychedelic horror storywriter."},
{"role": "user", "content": f"Write a 250-word narrated story about {text} with a bad ending. It must have {text}."}
],
max_tokens=1000,
temperature=0.7)
return response["choices"][0]["message"]["content"]