Skip to main content

Feed the contents of a folder into your ChatGPT/LLM queries faster

Project description

treefeeder

treefeeder logo

About

treefeeder is a command-line interface (CLI) tool designed to transform a folder of files, such as code files, into a structured string. This string includes both the folder structure (in a Unix tree structure format) and the contents of the files. It's an ideal tool for feeding data into ChatGPT or other large language model (LLM) AI assistants for fine-tuning or query answering.

Installation

To install treefeeder, simply run:

pip install treefeeder

Usage

CLI

You can use treefeeder from the command line by passing the directory path along with optional arguments for customization:

treefeeder <directory_path> [-I ignore_patterns] [-P match_patterns] [-S separator_token]
  • <directory_path>: The path to the directory you want to process.
  • -I ignore_patterns: Patterns to ignore files or directories.
  • -P match_patterns: Patterns to match specific files.
  • -S separator_token: The separator token used in output (default is [SEP]).

Python API

treefeeder can also be used within Python. To get a string output of your folder structure and file contents, use:

from treefeeder import get_output

output = get_output(directory_path, ignore_patterns=None, match_patterns=None, separator_token='[SEP]')

Example

treefeeder /path/to/my_project -I *.log -P *.py -S "[SEP]"

This command will process the 'my_project' directory, ignore .log files, match .py files, and use [SEP] as the separator token.

Contributing

Contributions are welcome! Please feel free to submit pull requests, suggest features, or report bugs.

License

treefeeder is open-source and available under MIT License.

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

treefeeder-0.0.7.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

treefeeder-0.0.7-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

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