New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chat-pdf-node

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chat-pdf-node

chat with any pdf

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by250%
Maintainers
0
Weekly downloads
 
Created
Source

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 });

FAQs

Package last updated on 27 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc