1.0.4 • Published 8 months ago

node_perplexityai v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Perplexity.AI Unofficial Node API

An unofficial API for Node.js based off of the Perplexity.AI website and mobile app

Intro

This project is based off of an idea to make unofficial wrappers for AI sites that don't have an official API yet, and this idea is from the node_characterai package.

This project is not affiliated with Perplexity.AI in any way! It is a community project. The purpose of this project is to bring and build projects powered by Perplexity.AI.

If you like this project, please check their website.

Features

  • Fully written in Javascript and CommonJS
  • Asynchronous requests
  • Easy to use
  • Active development
  • Send messages to Perplexity.AI
  • Make the AI forget your message
  • Customize your answers with categories
  • Ask it basically anything

Installation

$ npm install node_perplexityai

And if you want to save it to your env:

$ npm install node_perplexityai --save

Usage

Here is a basic script that asks the AI a question:

const perplexity = require("node_perplexityai");

(async () => {
  // Ask the AI a question
  const answer = await perplexity.send("Can dogs eat chocolate?");
  console.log(answer);
})();

All of the functions are listed here:

const perplexity = require("node_perplexityai");

(async () => {
  // Ask the AI a question
  const answer1 = await perplexity.send("Who was the first person to step foot on The Moon?");

  console.log(answer1); // This logs the answer to your first question

  // List the available categories for asking questions (all, youtube, etc.)
  console.log(perplexity.categories);

  // Change the category of your next message
  await perplexity.category("wikipedia");

  // Ask the AI another question with the category "wikipedia"
  const answer2 = await perplexity.send("How tall is the One World Trade Center?");

  // Forgets your previous messages and resets the API
  await perplexity.forget();
})();

FAQ

QuestionAnswer
Do I need an account?Nope! You can ask unlimited questions to the AI for free. Account login features may be added in the future for better access to Perplexity.
Error: No category found called "..."You haven't selected the right category or have a typo. List the categories via perplexity.categories.
Is this an official API?No, this is a community-based project for building amazing projects using Perplexity.AI.
Are there any limits to using this?No, you can use this package for anything without any limits or signing up. Just make sure you don't violate the Perplexity.AI ToS.
What does this package depend on?The only dependency required is Puppeteer. It uses puppeteer to fetch the answer from the question sent to Perplexity.AI. It is installed automatically when installing this package.
Other issue?Report it in the Issues tab

About Puppeteer

Any errors puppeteer related in this package can be reported in the Issues section, but please make note that if it is a full-on puppeteer related issue, I will close it.

TL;DR if the issue is puppeteer related, please post it in the Issues section but I may close it if it's not related to node_perplexityai

Support and Contribution

This project is updated frequently, always check for the latest version for new features or bug fixes.

If you have an issue or idea, let me know in the Issues tab. If you use this API, you also bound to the terms of usage of the Perplexity.AI website.

License

MIT

© 2021-2023 Parking Master
1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

10 months ago

1.0.1

10 months ago