A package to generate step-by-step reasoning prompts for language models
Project description
Meta Prompt Generator
Meta Prompt Generator is a Python package that generates detailed system prompts for language models based on task descriptions or existing prompts. It leverages OpenAI's GPT models to create well-structured, task-specific prompts that can be used to guide AI models in completing various tasks effectively. You can also use it in cli.
Features
- Generate detailed system prompts from task descriptions
- Flexible API key management (via argument or environment variable)
- Option to output prompts with or without markdown formatting
- Robust error handling and logging
Installation
To install the Meta Prompt Generator, follow these steps:
-
Clone the repository:
git clone https://github.com/Zakk-Yang/meta-prompt-generator.git cd meta-prompt-generator
-
Install the package in editable mode with development dependencies:
pip install meta-prompt-generator
Usage
Here's a basic example of how to use the Meta Prompt Generator:
from meta_prompt_generator import generate_prompt
# Generate a prompt
task = "Create a prompt for generating creative short stories"
prompt = generate_prompt(task)
print(prompt)
The generated prompt is wrapped in markdown code blocks.
Use in cli:
meta-prompt "Create a prompt for generating creative short stories"
API Key
The package requires an OpenAI API key. You can provide it in two ways:
-
As an argument to the
generate_prompt
function:prompt = generate_prompt(task, api_key="your-api-key-here")
-
As an environment variable named
OPENAI_API_KEY
:export OPENAI_API_KEY="your-api-key-here"
-
Create .env in the root to include
OPENAI_API_KEY = 'sk-xxx'
Note: Make sure to add .env to your .gitignore file to avoid accidentally committing your API key.
Contributing
Contributions to the Meta Prompt Generator are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- This project uses the OpenAI API to generate prompts.
- Thanks to all contributors who have helped shape this project.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for meta_prompt_generator-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8575aeb96c3303e527843ab4dcae449a552ba13e744b5fffea2f893face42787 |
|
MD5 | 4998d6b8127885ab0d47060228a44c36 |
|
BLAKE2b-256 | e41a5df33e25960445ac637129cd620500ae9938469f695d210fb57fc7efdb73 |
Hashes for meta_prompt_generator-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e135135cc296c519a5d8805aad68f0cf867e04bcb8c5eb495ade3a2f3b99774 |
|
MD5 | 60e866bc35d264a85bc81c35b3d6372f |
|
BLAKE2b-256 | b673a30a14e3abd9420cc2ef3873b6f5bc00f64f85d9f62f32293edba6212a1b |