Combine prompts for chatgpt.
Project description
catprompt
catprompt
is a command-line tool that simplifies the process of combining prompts in different files for programming with ChatGPT. It allows users to define a system prompt along with several functionality-specific prompts, which may include files with code, into a single prompt. The prompt files can be part of the project and later be used as the seed for documentation.
Using catprompt
when developing a large program with ChatGPT offers several advantages:
-
System prompt consistency: By having a central system prompt, you can ensure that essential information or context is consistently provided to ChatGPT across different parts of your project. This helps maintain uniformity and coherence in the responses generated by ChatGPT.
-
Modularity:
catprompt
allows you to divide prompts into separate files, enabling better organization of your project and keeping related prompts together. This makes it easier to maintain and update the code, as each functionality-specific prompt can be managed independently. -
Reusability: With
catprompt
, you can reuse prompts or code snippets across different parts of the project, avoiding duplication and improving consistency. -
Collaboration: Separating prompts into different files allows multiple team members to work on different aspects of the project simultaneously, without causing conflicts or requiring constant synchronization.
-
Documentation: The prompt files can serve as a foundation for your project's documentation, making it easier to keep the documentation up-to-date and in sync with the code.
Usage
- Install catprompt
- Create your prompt files
- Run catprompt with the main prompt file as a command-line argument:
catprompt path/to/prompt.txt
- Use the processed content from the clipboard
Installation
pip install catprompt
or
- Visit the homepage at https://github.com/juanre/catprompt
- Download the package as a ZIP file or clone the repository using git
- Navigate to the downloaded folder in your command-line interface
- Run
pip install .
to install the package
Make sure you have pip
installed on your system. If not, you can find instructions on how to install pip here: https://pip.pypa.io/en/stable/installation/
Prompt file format
- Lines starting with
++
are ignored - Lines starting with
+=
should be followed by the name of a file to include. The file will be searched for in the directory of the original file, or in the working directory if not found there. The named file will be read, processed, and its content will replace the current line. - Lines starting with
+-
should be followed by the name of a file to include, and a description. The file will processed as above, and its content prefaced by a line saying "[description] follows delimited by +-----" and another line with just +-----, and followed by a line with +----- - Lines starting with
+#
will cause the current line and all following lines in the file being processed to be ignored
Example
Let's consider the following example with three files:
main_prompt.txt
This is the main prompt.
++ This is a comment and will be ignored.
+= sub_prompt_1.txt
+- code_snippet.py The snippet of code
This is the end of the main prompt.
sub_prompt_1.txt
This is the sub-prompt 1.
+# Ignore the rest of this file
This line will be ignored.
This is useful to record the prompt that you used with this file, which
you probably don't want when the file is included by another file
code_snippet.py
def example_function():
return "This is an example code snippet."
When running catprompt main_prompt.txt
, the processed content will be:
This is the main prompt.
This is the sub-prompt 1.
The snippet of code follows delimited by +-----
+-----
def example_function():
return "This is an example code snippet."
+-----
This is the end of the main prompt.
This processed content will be copied to your clipboard, ready for use with ChatGPT.
Use cases
- Combining a system prompt with functionality-specific prompts;
- Including code snippets in your prompts;
- Organizing prompt files as part of a project;
- Using prompt files as the seed for documentation.
Developing
mkdir ~/venv/catp && python -m venv ~/venv/catp
source ~/venv/catp/bin/activate
pip install --upgrade pip
pip install -e .
pip install ".[dev]"
Author
ChatGPT-4, with prompting and editing help by Juan Reyero.
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
File details
Details for the file catprompt-0.0.4.tar.gz
.
File metadata
- Download URL: catprompt-0.0.4.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c3b9f431ba5f63b756a4f3cd969500cc2c4935fb5d41bfc8d904eaf9c9616d1 |
|
MD5 | 1639339a02993b7b5b65a4acc615b1e5 |
|
BLAKE2b-256 | f0e293155b675777440e4bcbf23847248db0ff33977661e669178d0c6741849c |
File details
Details for the file catprompt-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: catprompt-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d85ad285f67eb18ad650337fdcc1af7419e69d4c0edd98e5c07926ff62259082 |
|
MD5 | 2bcea7724a2ace564362311008c08d53 |
|
BLAKE2b-256 | cb994c354f60fd3e8a45e1e598a969ae20a86d71ee3119365f0a3210db54b921 |