|
1 |
| -# **Python Prompt Generator Tool** |
2 |
| - |
3 |
| -This Python script efficiently generates customized prompts using a template and a CSV file containing key-value pairs. |
4 |
| - |
5 |
| -## **Installation** |
6 |
| - |
7 |
| -**Prerequisites:** |
8 |
| - |
9 |
| -* Python (version 3.x recommended) |
10 |
| - |
11 |
| -**Steps:** |
12 |
| - |
13 |
| -1. **Clone or download the repository.** |
14 |
| -2. **Install dependencies:** |
15 |
| - ```bash |
16 |
| - pip install -r requirements.txt |
17 |
| - ``` |
18 |
| - |
19 |
| -## **Usage** |
20 |
| - |
21 |
| -**1. Understand your files (Not necessary already done.):** |
22 |
| - |
23 |
| - * **key-values.csv:** |
24 |
| - * Create a CSV file with columns representing the keys to be replaced in your template. |
25 |
| - * Each row will define the values for a single prompt. |
26 |
| - |
27 |
| - * **prompt.txt:** |
28 |
| - * Design your prompt template. |
29 |
| - * Enclose keys from 'key-values.csv' within `**/key/**` tags (e.g., `**/city/**`). |
30 |
| - |
31 |
| -**2. Run the script:** |
32 |
| - |
33 |
| - ```bash |
34 |
| - python main.py [-d] |
35 |
| - ``` |
36 |
| - |
37 |
| - * **Optional:** Use `-d` to exclude titles and focus on city names in your prompts. |
38 |
| - |
39 |
| - > This feature is currently not optimized. |
40 |
| - |
41 |
| -## **Explanation** |
42 |
| - |
43 |
| -* **CSV File ('key-values.csv')** |
44 |
| - Each column header represents a key to be replaced. Rows contain corresponding values. See example: |
45 |
| - |
46 |
| - ```csv |
47 |
| - title, city, country |
48 |
| - Explore the Charm of, Paris, France |
49 |
| - A Journey Through, Tokyo, Japan |
50 |
| - ``` |
51 |
| -  |
52 |
| - |
53 |
| - |
54 |
| -* **Prompt Template ('prompt.txt')** |
55 |
| - Use `**/key/**` to mark replacement points. Example: |
56 |
| - |
57 |
| - ``` |
58 |
| - Write a travel blog titled "**/title/**" about the captivating city of **/city/**, **/country/**. |
59 |
| - ``` |
60 |
| -  |
61 |
| - |
62 |
| -   |
63 |
| - |
64 |
| -* **Output** |
65 |
| - Generated prompts are saved as individual .txt files within a specified folder. |
66 |
| - ``` |
67 |
| - Write a travel blog titled "Explore the Charm of" about the captivating city of Paris, France. |
68 |
| - ``` |
69 |
| - |
70 |
| -## **Terminology** |
71 |
| - |
72 |
| -* **key:** A column header in 'key-values.csv', used as an identifier in the template. |
73 |
| -* `**/key/**`: Indicates a placeholder in the template, to be substituted with values from 'key-values.csv'. |
74 |
| - |
75 |
| - |
76 |
| -## **Exceptions and Error:** |
77 |
| - - Template file is empty. Please add some text to it. |
78 |
| - |
79 |
| - `You need to check your prompt.txt. It might be empty.` |
80 |
| - |
81 |
| - - CSV file is empty. Please add some data to it. |
82 |
| - |
83 |
| - `You need to check your key-values.cv. It might be empty.` |
84 |
| - |
85 |
| - |
86 |
| - - Invalid CSV Headers **`OR`** Invalid CSV columns count. Please make sure the CSV file has the correct format.. |
87 |
| - |
88 |
| - `For now the key-value and template is hard coded. The paid file only works for two key-values City and Title. Make sure the current headers are City,Title. Not less or More` |
89 |
| - |
| 1 | +# **Python Prompt Generator Tool** |
| 2 | + |
| 3 | +This Python script efficiently generates customized prompts using a template and a CSV file containing key-value pairs. |
| 4 | + |
| 5 | +## **Installation** |
| 6 | + |
| 7 | +**Prerequisites:** |
| 8 | + |
| 9 | +* Python (version 3.x recommended) |
| 10 | + |
| 11 | +**Steps:** |
| 12 | + |
| 13 | +1. **Clone or download the repository.** |
| 14 | +2. **Install dependencies:** |
| 15 | + ```bash |
| 16 | + pip install -r requirements.txt |
| 17 | + ``` |
| 18 | + |
| 19 | +## **Usage** |
| 20 | + |
| 21 | +**1. Understand your files (Not necessary already done.):** |
| 22 | + |
| 23 | + * **key-values.csv:** |
| 24 | + * Create a CSV file with columns representing the keys to be replaced in your template. |
| 25 | + * Each row will define the values for a single prompt. |
| 26 | + |
| 27 | + * **prompt.txt:** |
| 28 | + * Design your prompt template. |
| 29 | + * Enclose keys from 'key-values.csv' within `**/key/**` tags (e.g., `**/city/**`). |
| 30 | + |
| 31 | +**2. Run the script:** |
| 32 | + |
| 33 | + ```bash |
| 34 | + python main.py [-d] |
| 35 | + ``` |
| 36 | + |
| 37 | + * **Optional:** Use `-d` to exclude titles and focus on city names in your prompts. |
| 38 | + |
| 39 | + > This feature is currently not optimized. |
| 40 | + |
| 41 | +## **Explanation** |
| 42 | + |
| 43 | +* **CSV File ('key-values.csv')** |
| 44 | + Each column header represents a key to be replaced. Rows contain corresponding values. See example: |
| 45 | + |
| 46 | + ```csv |
| 47 | + title, city, country |
| 48 | + Explore the Charm of, Paris, France |
| 49 | + A Journey Through, Tokyo, Japan |
| 50 | + ``` |
| 51 | +  |
| 52 | + |
| 53 | + |
| 54 | +* **Prompt Template ('prompt.txt')** |
| 55 | + Use `**/key/**` to mark replacement points. Example: |
| 56 | + |
| 57 | + ``` |
| 58 | + Write a travel blog titled "**/title/**" about the captivating city of **/city/**, **/country/**. |
| 59 | + ``` |
| 60 | +  |
| 61 | + |
| 62 | +   |
| 63 | + |
| 64 | +* **Output** |
| 65 | + Generated prompts are saved as individual .txt files within a specified folder. |
| 66 | + ``` |
| 67 | + Write a travel blog titled "Explore the Charm of" about the captivating city of Paris, France. |
| 68 | + ``` |
| 69 | + |
| 70 | +## **Terminology** |
| 71 | + |
| 72 | +* **key:** A column header in 'key-values.csv', used as an identifier in the template. |
| 73 | +* `**/key/**`: Indicates a placeholder in the template, to be substituted with values from 'key-values.csv'. |
| 74 | + |
| 75 | + |
| 76 | +## **Exceptions and Error:** |
| 77 | + - Template file is empty. Please add some text to it. |
| 78 | + |
| 79 | + `You need to check your prompt.txt. It might be empty.` |
| 80 | + |
| 81 | + - CSV file is empty. Please add some data to it. |
| 82 | + |
| 83 | + `You need to check your key-values.cv. It might be empty.` |
| 84 | + |
| 85 | + |
| 86 | + - Invalid CSV Headers **`OR`** Invalid CSV columns count. Please make sure the CSV file has the correct format.. |
| 87 | + |
| 88 | + `For now the key-value and template is hard coded. The paid file only works for two key-values City and Title. Make sure the current headers are City,Title. Not less or More` |
| 89 | + |
0 commit comments