when i use the prompt
write 200 exactly 6 word sentences about what the person can be thinking in their brain, the subject is something cool you can do about yourself
i get only 6 lines of text in a text file
Thinking about brain capacity.
Exploring own capabilities.
Seeking knowledge to understand.
Many possibilities to ponder.
Discovering new ideas everyday.
Unlimited potential within me.
this is my python code
import os
from tqdm import tqdm
import openaiSet up your OpenAI API key
openai.api_key = ‘’
def generate_article(prompt, article_length):
response = openai.Completion.create(
engine=‘text-davinci-003’,
prompt=prompt,
max_tokens=article_length,
temperature=0.7,
n=1,
stop=None
)generated_text = response.choices[0].text.strip() return generated_text
def main():
# Path to the text file containing article prompts
text_file = ‘bci.txt’# Length of the generated articles article_length = 3000 with open(text_file, 'r') as file: prompts = file.readlines() # Create a folder named 'generated_articles' if it doesn't exist if not os.path.exists('generated_articles'): os.makedirs('generated_articles') # Iterate over the prompts and generate articles for i, prompt in tqdm(enumerate(prompts, start=1), total=len(prompts), desc="Generating articles"): filename = f"generated_articles/{i}.txt" # Generate the filename based on the prompt's order # Skip generating the article if the output file already exists if os.path.exists(filename): continue article = generate_article(prompt, article_length) with open(filename, 'w') as file: file.write(article)
if name == ‘main’:
main()