-
Notifications
You must be signed in to change notification settings - Fork 4
Using the ContentGenerator Class
Aidan Loughney edited this page Jun 11, 2023
·
2 revisions
- Import the
ContentGeneratorclass from themodels.content_generatormodule. - Create an instance of the
ContentGeneratorclass with the necessary parameters, such asapi_key,yml_files,csv_files, andtemplate_mds. - Use the
create_completion()method to generate content based on a specific prompt. - Use the
create_output()method to generate content for a specific topic using the prompts, templates, and configurations provided. - Use the
write_output()method to save the generated content to a file.
When running the ContentGenerator Class you will need to use an OpenAI API key, refer to the readme for how to do this
from models.content_generator import ContentGenerator
yml_files = ["data/prompts/prompts.yml"]
csv_files = ["data/csv/file_info.csv"]
template_mds = ["data/templates/template.md"]
output_dir = "output_test"
generator = ContentGenerator(api_key="your_api_key", yml_files=yml_files, csv_files=csv_files, template_mds=template_mds, output_dir=output_dir)
page = generator.file_info[1]
output = generator.create_output(page)
generator.write_output(page, output)