The Unofficial Perplexity SDK for Node.js
npm install perplexity-sdk> The Perplexity.ai SDK is a powerful tool for integrating advanced AI capabilities into your applications. With a simple and intuitive API, you can leverage the power of Perplexity's AI models for chat completions, instructions, and more.
Typescript supported.
codellama-34b-instruct | 16384 | Chat Completion |codellama-70b-instruct | 16384 | Chat Completion |llama-2-70b-chat | 4096 | Chat Completion |mistral-7b-instruct | 4096 | Chat Completion |mixtral-8x7b-instruct | 4096 | Chat Completion |pplx-7b-chat | 8192 | Chat Completion |pplx-70b-chat | 4096 | Chat Completion |pplx-7b-online | 4096 | Chat Completion |pplx-70b-online | 4096 | Chat Completion |---
``shnpm
npm install perplexity-sdk
Configuration
To use the SDK, you need to configure it with your API key. Here's a simple setup:`ts
import Perplexity from 'perplexity-sdk';const config = {
apiKey: process.env.PERPLEXITY_API_KEY || ''
};
const perplexity = new Perplexity(config).client();
`Usage
Here's how you can use the SDK to send a request to Perplexity's AI models:`ts
import { ChatCompletionsPostRequestModelEnum } from 'perplexity-sdk';const result = await perplexity.chatCompletionsPost({
model: ChatCompletionsPostRequestModelEnum.Mistral7bInstruct,
messages: [{
"role": "user",
"content": "Your prompt here"
}],
});
console.log(result);
``Contributions, issues, and feature requests are welcome! Feel free to check issues page.
Give a ⭐️ if this project helped you!
Bitcoin: bc1qhp9havdzfzqr9mzdc3257txmegrpryhx3kdpyz
Strike: rodrigo
This project is MIT licensed.