Skip to content

Feat: Perplexity support #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

joaoGabriel55
Copy link

@joaoGabriel55 joaoGabriel55 commented Mar 18, 2025

Issue

#20

Description

This PR consists on add Perplexity API support

@joaoGabriel55
Copy link
Author

Please, let me know if there is something missing on this first implementation

Question: How can I run tests locally?

@adenta
Copy link

adenta commented Mar 18, 2025

How do I test?
You should be able to set API keys locally and run rspec to test the application.

@joaoGabriel55 I started a pull request here. Do you want to either tweak what I have, or incorporate my changes into your branch?

@gquaresma-godaddy
Copy link

@adenta let me know if there is something to improve

@adenta
Copy link

adenta commented Mar 19, 2025

@gquaresma-godaddy we need tests! Want to take a crack at it?

@gquaresma-godaddy
Copy link

Sure! I will work on it.

Copy link
Owner

@crmne crmne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good. It looks like sonar has support for vision, so it would need to be added to the chat_content_spec vision test, and the chat_streaming_spec.

@crmne crmne mentioned this pull request Mar 21, 2025
@crmne crmne added the new provider New provider integration label Mar 21, 2025
@crmne crmne linked an issue Mar 23, 2025 that may be closed by this pull request
@crmne
Copy link
Owner

crmne commented Mar 23, 2025

Two new features to consider in your provider implementation:

  1. Model Aliases: Please add entries for your provider in aliases.json:

    "claude-3-5-sonnet": {
      "anthropic": "claude-3-5-sonnet-20241022",
      "your-provider": "your-provider-specific-id"
    }
  2. Provider Selection: Users will be able to specify your provider:

    chat = RubyLLM.chat(model: 'claude-3-5-sonnet', provider: 'your-provider')

Docs: https://rubyllm.com/guides/models#using-model-aliases

@crmne
Copy link
Owner

crmne commented Mar 25, 2025

Added configuration requirements handling in 75f99a1

Each provider now specifies what configuration is required via a simple configuration_requirements method (you will need to implement this in your main provider file) that returns an array of config keys as symbols. The Provider module uses this to:

  1. Determine if a provider is properly configured
  2. Throw an error if you're trying to use that provider without configuration
  3. Include ready-to-paste configuration code in the error message
  4. Skip unconfigured providers during model refresh while preserving their models

Example of the new error messages:

RubyLLM::ConfigurationError: anthropic provider is not configured. Add this to your initialization:

RubyLLM.configure do |config|
  config.anthropic_api_key = ENV['ANTHROPIC_API_KEY']
end

@crmne
Copy link
Owner

crmne commented Apr 17, 2025

@joaoGabriel55 is this still on your radar? I'd love to merge Perplexity support soon. Whenever you're ready, could you resolve the conflicts and request a review?

@joaoGabriel55 joaoGabriel55 requested a review from crmne April 17, 2025 12:32
Copy link
Owner

@crmne crmne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work!

It looks generally good, I just need some changes and tests. Please pick the cheapest model to test with.

@joaoGabriel55 joaoGabriel55 requested a review from crmne April 23, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new provider New provider integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Perplexity support
4 participants