Introducing the Unofficial Perplexity SDK for Node.js
Rodrigo Gomez Palacio
Posted on February 7, 2024
Overview
In today's ever-evolving tech landscape, innovative tools and frameworks are pivotal in shaping how we interact with technology. One such groundbreaking addition is the Perplexity.
The Unofficial Perplexity SDK for Node.js is a tool designed to bring you access to Perplexity.ai on Node.js.
How it was made
I built this project using OpenAPI. OpenAPI, an open-source format, played a crucial role in easily generating the SDK and will allow for simple updates.
Install
# npm
npm install perplexity-sdk
# yarn
yarn add perplexity-sdk
Usage
import Perplexity from 'perplexity-sdk';
import { ChatCompletionsPostRequestModelEnum } from 'perplexity-sdk';
const config = {
apiKey: process.env.PERPLEXITY_API_KEY || '<YOUR_API_KEY>'
};
const perplexity = new Perplexity(config).client();
const result = await perplexity.chatCompletionsPost({
model: ChatCompletionsPostRequestModelEnum.Mistral7bInstruct,
messages: [{
"role": "user",
"content": "Your prompt here"
}],
});
console.log(result);
Show your support
Please give a ⭐️ if this project helped you! That's all I ask.
💖 💪 🙅 🚩
Rodrigo Gomez Palacio
Posted on February 7, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
webdev Understanding HTTP, Cookies, Email Protocols, and DNS: A Guide to Key Internet Technologies
November 30, 2024