Giter Site home page Giter Site logo

ai-file-procesor's Introduction

AI File Processor

This script reads files from various file formats such as TXT, PDF, DOC, and DOCX, processes them, and generates responses using OpenAI's GPT-3.5 Turbo model. Each generated response is saved in it's own text file using the name of the original file with the prompt name appended.

Table of Contents

Prerequisites

  • Node.js (developed on v18.12.0 (LTS))
  • OpenAI API key
  • Configuration details (explained in the Configuration section)
  • files in supported formats (PDF, DOC, DOCX, TXT)

Setup

  1. Clone this repository or copy the project to your local machine.

  2. Install dependencies by running the following command in the terminal:

npm install

Usage

  1. Open the config/default.json file and configure the necessary values (explained in the Configuration section).

  2. Place your files in the specified File_Folder path, or update the File_Folder path to the location of your files.

  3. Run the script using the following command:

node index.js

Configuration

Modify the configuration in the config/default.json file to set up the script:

  • ChatGPT_API_Key: Your OpenAI API key.
  • GPTOrgId: Your OpenAI organization ID.
  • File_Folder: Path to the folder containing files.
  • Prompts: Array of prompts with system and name.

The following configuration items should not need changes and may not be in use:

  • Max_GPT_Version: Maximum GPT version to use.
  • Text_Separator: Separator to use when processing text.
  • ChatGPT_Specs: Array of GPT specifications (versions and max tokens).

Supported File Types

The script supports the following file formats:

  • .txt: txt files are parsed with the fs libarary.
  • .pdf: PDF files are parsed using the PdfReader library.
  • .docx: DOCX files are parsed using the Docxtemplater library. **Not Operational Yet
  • .doc: DOC files are parsed using the Mammoth library. **Not Operational Yet

Notes

The script processes files, generates responses, and saves them to files based on the provided prompts. Some file formats might not be fully supported or implemented (as indicated in the code comments). Make sure to stay within the OpenAI API usage limits and adjust the max_tokens value in the generateChatResponse function accordingly.

License

This script is provided under the MIT License. Feel free to use, modify, and distribute it as needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.