class RubyLLM::Providers::Perplexity
Perplexity API integration.
Public Class Methods
Source
# File lib/ruby_llm/providers/perplexity.rb, line 22 def capabilities Perplexity::Capabilities end
Source
# File lib/ruby_llm/providers/perplexity.rb, line 26 def configuration_options %i[perplexity_api_key perplexity_api_base] end
# File lib/ruby_llm/providers/perplexity.rb, line 30 def configuration_requirements %i[perplexity_api_key] end
Public Instance Methods
Source
# File lib/ruby_llm/providers/perplexity.rb, line 10 def api_base @config.perplexity_api_base || 'https://api.perplexity.ai' end
Source
# File lib/ruby_llm/providers/perplexity.rb, line 14 def headers { 'Authorization' => "Bearer #{@config.perplexity_api_key}", 'Content-Type' => 'application/json' } end
Source
# File lib/ruby_llm/providers/perplexity.rb, line 35 def parse_error(response) body = response.body return if body.empty? # If response is HTML (Perplexity returns HTML for auth errors) if body.include?('<html>') && body.include?('<title>') title_match = body.match(%r{<title>(.+?)</title>}) if title_match message = title_match[1] message = message.sub(/^\d+\s+/, '') return message end end super end
Calls superclass method
RubyLLM::Provider#parse_error