This project provides an API for generating content using OpenAI's completion models. It includes a ContentGenerator class, utility functions, and a simple Flask app to generate content based on prompts, templates, and other configurations.
- Expand the API to handle HTTP requests, allowing users to interact with the content generation features using tools like Postman, Thunder Client, etc.
- Implement various API endpoints for different content generation operations, such as creating, updating, and deleting content.
- Develop CLI commands to create content locally while the Flask app is running, providing a more convenient way to interact with the content generation features.
- Implement robust error handling throughout the application to provide helpful feedback to users and ensure the stability of the system.
- Add advanced file editing capabilities, such as inserting, replacing, and removing content from existing files and directories.
- Design better prompts for content generation to enhance the quality and relevance of the generated content.
- Create more sophisticated templates for various content types and use cases, providing users with greater flexibility in customizing their generated content.
- Integrate Unsplash functionality into the templates, allowing users to include relevant images in their generated content.
- Integrate more of OpenAI's services into the tool, such as DALL-E, Whisper, Fine-Tuning, etc., to create even more advanced tooling and markdown content.
- Develop a unique RSS bridge to collect and process climate data, which will be used for fine-tuning the AI model and enhancing the quality and relevance of the generated content.
- Use the resource database and RSS bridge, along with fine-tuning, to create the "Climate Tech Chatbot," a tool designed to provide users with valuable insights and information on climate technologies and trends.
- Clone this repository to your local machine.
- Create a virtual environment and activate it.
- Install the required packages using
pip install -r requirements.txt.
To use the generator, you will need an OpenAI API key. Follow these steps to set and use the OPENAI_SECRET_KEY:
- Obtain your OpenAI API key from the OpenAI Dashboard.
- Create a
.envfile in the root directory of your project (if it doesn't already exist). - Add your OpenAI API key to the
.envfile in the following format:
OPENAI_SECRET_KEY=your_api_key_here
Replace your_api_key_here with the actual key you obtained from OpenAI.
For Unsplash photos
Add this to your .env as well:
UNSPLASH_ACCESS_KEY=your_api_key_here
- In your Python code, you can use the
dotenvlibrary to load the API key from the.envfile:
from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("OPENAI_SECRET_KEY")- Run the Flask app by executing
flask runor trypython app.pyif struggling, but you should make sure flask is installed. - The app will create a file for a specific topic using the prompts, templates, and configurations provided in the
datafolder.- At this moment in the app it's being forced with a
@before_requestdecorator, this will be improved upon in the future.
- At this moment in the app it's being forced with a
- The generated file will be saved in the
output_testfolder.
- 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.
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)Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
This project is licensed under the MIT License. See the LICENSE file for more details.
This README provides an overview of the project, installation instructions, usage examples, and contribution guidelines. You can customize the content as needed to better suit your project.
This project is in active development and is currently in an MVP stage, stay tuned to see how it grows!