1.1.5 • Published 6 months ago

chat-pdf-node v1.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

chat-pdf-node

Chat with any PDF in Nodejs.

Installation

npm install chat-pdf-node

Prerequisites

It requires an OpenAI developer account and API key. You can create an Api Key here.

Usage

Initialize the ChatWithPDF class with the URL to the PDF file and the OpenAI API key. Send a question regarding the information provided in the PDF file.

import { ChatWithPDF } from "chat-pdf-node";

async function talkWithPDF(pdfPath: string, userQuestion: string) {
  const API_KEY = 'XXXX';
  const chatPDF = await ChatWithPdf.initialize(API_KEY, { pdfURL: pdfPath });
  const response = await chatPDF.askQuestion(userQuestion);

  console.log(response);
}

talkWithPDF('http://some.repository/my-business.pdf', '¿What are your products?');

Also is possible to provide the PDF file as a Buffer.

const chatPDF = await ChatWithPdf.initialize(API_KEY, { pdfBuffer: myPDFAsBufferHere });
1.1.1

6 months ago

1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.0

7 months ago

1.0.0

7 months ago