Disclaimer: ChatGPT’s responses might vary in different situations, even if the prompt and files are the same as in this article.
Note from the Author: From a developer’s perspective, it’s beneficial to create a custom ChatGPT when working with files as the basis for information. This way, you can avoid re-uploading files every time the chat window opens.
Introduction
OpenAI, the company behind ChatGPT, developed a feature in May 2024 that allows users to upload files through its web platform when using 4,4o , enabling the analysis of information stored in those files. The supported formats are:
- Text: txt, rtf, pdf
- Sheets: csv, xls, xlsx, ods
- Presentations: pptx, ppt, odp
- Documents: doc, docx, odt
- Images: jpg, jpeg, png, bmp, gif
- Code: py, js, html, htm, css, java, c, cpp, h, hpp, rb, php, bat, sh, cmd, json, xml, yaml, yml, md
For the full list of supported file types, check here.
How Many Files Can You Upload in a Single Prompt?
You can upload up to 20 files in a single prompt. Reference
What is the Size Limit for Each File?
Each file uploaded to the chat has a size limit of 512 MB, except for images, which have a limit of 20 MB. Reference
How Many Words or Sentences Can Be Uploaded?
Approximately 1,750,000 words. When it comes to code, factors such as variable names, the number of comments, and the overall syntactic complexity can increase token usage.
Problem Description
If you have a code project with a file system containing more (or less) files than the chat allows you to upload, how can you efficiently bypass this limit? Follow these steps:
- Find an Extension to Combine Files: Look for an IDE extension that allows combining multiple code files into a single text file. For example, in VSCode, you can use extensions like “Combine Files” or “Combine Code in Folder.”
- Create a Combined Text File: In the project’s root directory, create a text file as described in step 1. The structure should be:
Path to file 1
Content of file 1
Path to file 2
Content of file 2
...
3. Add a Prompt File: Create another text file, named prompt.txt
. This file will explain to ChatGPT how to read the files and how to present the information it learns from the text files you created.
Content of prompt.txt
:
**Instructions:**
The knowledge base consists of multiple text files, each representing a different project directory. The files are structured with directory paths followed by the corresponding file content. Follow these instructions to understand and summarize the code:
0. **Knowledge Base Files:**
- The knowledge base files are: TheGuyD-project.txt.
- Each text file represents a directory and contains the route to the file, followed by the file content.
1. **File Structure and Content:**
- Each text file in the knowledge base contains directory paths and their corresponding file content in sequence.
2. **Project Directory Analysis:**
- For each project directory represented by a text file (e.g., TheGuyD-project.txt), locate and read the corresponding text file.
3. **Summarization Requirements:**
- Write a summary detailing the overall purpose of the code in each project directory.
- Provide a purpose description for **each** code file listed within the text files, including all subdirectories and utility files. Ensure **every single file** is listed.
**Instructions for Execution:**
1. **Initial Reading and Listing:**
- Read the entire content of each text file thoroughly.
- Make an initial list of all files and their paths.
2. **Verification:**
- Verify the completeness of the initial list by cross-referencing it with the directory structure provided in the text file.
- Ensure that no files or subdirectories are missed.
3. **Summarization:**
- Write concise purpose summaries for each file listed.
- Double-check that every file mentioned in the directory structure is included in the summaries.
4. **Final Check:**
- Perform a final check to ensure all files and their purposes are documented.
- If necessary, re-read the text file to confirm no files are overlooked.
5. **Completion Confirmation:**
- After completing the summarization for a project directory, ask the user if you should continue with the next project.
**Example Format:**
- **Project Summary:**
- Brief description of the project's overall purpose.
- **File Summaries:**
- `path/to/file1`: Purpose of file1.
- `path/to/subdir/file2`: Purpose of file2.
- `path/to/utility/file3`: Purpose of file3.
- Ensure every single file is listed and described.
4. Create a Personal ChatGPT
4.1 prompt for creating the new ChatGPT
You are a software engineer designed to assist with a software engineering project by providing guidance on a codebase.
You will be informative, avoid rushing implementations, and ensure that all advice is based on best practices and industry standards.
4.2 prompt for desired output
**Step-by-Step Guide:**
1. **Code Review and Analysis:**
- Provide a detailed review of the uploaded codebase.
- Highlight key components, structure, and any potential issues or areas for improvement.
2. **Best Practices and Standards:**
- Offer advice and suggestions based on best practices and industry standards.
- Provide examples and explanations for why these practices are important.
3. **Implementation Guidance:**
- Guide the user step-by-step through any required implementations or changes.
- Ensure that explanations are clear and informative, avoiding rushing through the process.
4. **Continuous Learning:**
- Offer resources for further learning and development related to the codebase and technologies used.
- Suggest relevant documentation, tutorials, and best practice guides.
**Additional Features:**
1. **Code Documentation Review:**
- Provide feedback on existing code documentation and suggest improvements.
2. **Automated Testing Guidance:**
- Assist in setting up and understanding automated tests for the codebase.
3. **Refactoring Suggestions:**
- Offer specific suggestions for code refactoring to improve readability and maintainability.
4. **Performance Optimization:**
- Provide tips and strategies for optimizing the performance of the codebase.
5. **Security Best Practices:**
- Highlight potential security issues and suggest best practices to mitigate them.
6. **Integration with Version Control:**
- Assist with integrating and managing the codebase using version control systems like Git.
4.3 Upload the text files and refer to prompt.txt
4.4 Try The new ChatGPT in the Preview Section
4.4 Create The New ChatGPT
5. Using Your New ChatGPT: Now you have a new chatGPT for your project. To start a dialogue with it, you can write:
Refer to prompt.txt
Bonus: Simply write this whenever you want to load the data into the chat:
Refer to prompt.txt
and begin applying its knowledge to your work. Have fun! 😊