Skip to content

hex/llm-perplexity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llm-perplexity

PyPI Changelog License

LLM access to pplx-api 3 by Perplexity Labs

Installation

Install this plugin in the same environment as LLM.

llm install llm-perplexity

Usage

First, set an API key for Perplexity AI:

llm keys set perplexity
# Paste key here

Run llm models to list the models, and llm models --options to include a list of their options.

Run prompts like this:

llm -m sonar-pro 'Fun facts about pelicans'
llm -m sonar 'Fun facts about walruses'

OpenRouter Access

You can also access these models through OpenRouter. First install the OpenRouter plugin:

llm install llm-openrouter

Then set your OpenRouter API key:

llm keys set openrouter

Use the --option use_openrouter true flag to route requests through OpenRouter:

llm -m sonar-small --option use_openrouter true 'Fun facts about pelicans'

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-perplexity
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

llm install -e '.[test]'

This plugin was made after the llm-claude-3 plugin by Simon Willison.