|
1 |
| -# File-for-AI |
| 1 | +# File-for-AI |
2 | 2 |
|
3 | 3 | File-for-AI is an open-source tool designed to compile all text files in a directory into a single file. This is particularly useful for preparing data to be added to AI models or chat GPT.
|
4 | 4 |
|
5 | 5 | ## Description
|
6 | 6 |
|
7 | 7 | This tool traverses through a specified directory, reads all the text files (while ignoring non-text files and files specified in .gitignore), and compiles them into a single output file. This output file can then be used for various purposes such as training AI models or chat GPT.
|
8 | 8 |
|
9 |
| - |
10 | 9 | ## Usage
|
11 | 10 |
|
12 |
| -Download the latest binary for the os of your coice from the [releases page](https://github.com/num30/file-for-ai/releases) it's under `Assets` section. |
| 11 | +Download the latest binary for the os of your coice from the [releases page](https://github.com/num30/file-for-ai/releases) under the `Assets` section. |
| 12 | + |
| 13 | +To use this tool, you need to provide at least a directory path or a glob pattern as an argument. If an output file name is not provided, it will default to "file-for-ai.txt." |
13 | 14 |
|
14 |
| -To use this tool, you need to provide at least a directory path as an argument. If an output file name is not provided, it will default to "file-for-ai.txt". |
15 | 15 |
|
16 |
| -```bash |
17 |
| -file-for-ai <directory> |
| 16 | +``` bash |
| 17 | +file-for-ai <directory|pattern> [--output file] |
18 | 18 | ```
|
19 | 19 |
|
20 | 20 | For example:
|
21 | 21 |
|
22 |
| -```bash |
| 22 | +``` bash |
23 | 23 | file-for-ai /path/to/your/directory
|
24 | 24 | ```
|
25 | 25 |
|
26 | 26 | This will create a file named "file-for-ai.txt" in your current directory with the contents of all text files in the specified directory.
|
27 | 27 |
|
| 28 | +You can also use a glob pattern: |
| 29 | + |
| 30 | +``` bash |
| 31 | +file-for-ai *.txt |
| 32 | +``` |
| 33 | + |
| 34 | +This will create a file named "file-for-ai.txt" in your current directory with the contents of all text files matching the pattern. |
| 35 | + |
| 36 | +To specify a custom output file name: |
| 37 | + |
| 38 | +``bash |
| 39 | +file-for-ai /path/to/your/directory --output custom-output.txt |
| 40 | +```` |
| 41 | +
|
| 42 | +This will create a file named "custom-output.txt" in your current directory with the contents of all text files in the specified directory. |
| 43 | +
|
28 | 44 | ## Flags
|
| 45 | +
|
29 | 46 | The tool accepts the following flags:
|
30 | 47 |
|
31 |
| -- `--model` or `-m`: Specifies the model to use for toke counting. It should be one of the available models in [tiktoken-go](https://github.com/pkoukk/tiktoken-go?tab=readme-ov-file#available-encodings). Default is "gpt-4". |
32 |
| -- `--output` or `-o`: Specifies the name of the output file. Default is "file-for-ai.txt". |
| 48 | +- `--model`: Specifies the model to use for token counting. It should be one of the available models in [tiktoken-go](https://github.com/pkoukk/tiktoken-go?tab=readme-ov-file#available-encodings). Default is "gpt-4". |
| 49 | +- `--output`: Specifies the name of the output file. Default is "file-for-ai.txt." |
| 50 | +- `--ignore-gitignore`: If set to true, the tool will ignore the .gitignore file. Default is false. |
| 51 | +- `--process-non-text`: If set to true, the tool will process non-text files. Default is false. |
33 | 52 |
|
34 | 53 | For example:
|
35 | 54 |
|
36 |
| -``` bash |
37 |
| -file-for-ai /path/to/your/directory --model gpt-4o --output my-output.txt |
38 |
| -``` |
39 |
| - |
40 |
| - |
41 |
| -This will create a file named "my-output.txt" in your current directory with the contents of all text files in the specified directory, token counting using the "gpt-4" model. |
| 55 | +``bash |
| 56 | +file-for-ai /path/to/your/directory --model gpt-4 --output my-output.txt |
| 57 | +``` |
0 commit comments