Skip to main content

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:

  1. 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.

  2. 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.

  3. Reusability: With catprompt, you can reuse prompts or code snippets across different parts of the project, avoiding duplication and improving consistency.

  4. 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.

  5. 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

  1. Install catprompt
  2. Create your prompt files
  3. Run catprompt with the main prompt file as a command-line argument:

catprompt path/to/prompt.txt

  1. Use the processed content from the clipboard

Installation

pip install catprompt

or

  1. Visit the homepage at https://github.com/juanre/catprompt
  2. Download the package as a ZIP file or clone the repository using git
  3. Navigate to the downloaded folder in your command-line interface
  4. 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 +# 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

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.
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 && python3.9 -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

catprompt-0.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

catprompt-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file catprompt-0.0.2.tar.gz.

File metadata

  • Download URL: catprompt-0.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for catprompt-0.0.2.tar.gz
Algorithm Hash digest
SHA256 52bcd81d40bfe1fb00f2f3e8549465bd276d46347ae13899cfe721554b7c4dde
MD5 bb93d845e57b4ed693a0d58865cbef31
BLAKE2b-256 41cd01185f95e82a0a42d272abd5205685c1bb17f31c5eaa343a72b7a088ff5b

See more details on using hashes here.

File details

Details for the file catprompt-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: catprompt-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for catprompt-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3effa7af4bf5fd48dcdd41a77a7803bc291b235c5347354f330e5b5d51059206
MD5 944ca9a60535ad7fb585341fd43503a5
BLAKE2b-256 386db27419e51f9e30ab07ee595f4bd31d876cb3cf673b11de8e8ac097590672

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page