Module: RubyLLM::Providers::Perplexity::Capabilities
- Defined in:
- lib/ruby_llm/providers/perplexity/capabilities.rb
Overview
Provider-level capability checks and narrow registry fallbacks.
Constant Summary collapse
- PRICES =
{ sonar: { input: 1.0, output: 1.0 }, sonar_pro: { input: 3.0, output: 15.0 }, sonar_reasoning: { input: 1.0, output: 5.0 }, sonar_reasoning_pro: { input: 2.0, output: 8.0 }, sonar_deep_research: { input: 2.0, output: 8.0, reasoning_output: 3.0 } }.freeze
Class Method Summary collapse
- .context_window_for(model_id) ⇒ Object
- .critical_capabilities_for(model_id) ⇒ Object
- .max_tokens_for(model_id) ⇒ Object
- .model_family(model_id) ⇒ Object
- .pricing_for(model_id) ⇒ Object
- .supports_tool_choice?(_model_id) ⇒ Boolean
- .supports_tool_parallel_control?(_model_id) ⇒ Boolean
Class Method Details
.context_window_for(model_id) ⇒ Object
30 31 32 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 30 def context_window_for(model_id) model_id.match?(/sonar-pro/) ? 200_000 : 128_000 end |
.critical_capabilities_for(model_id) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 38 def critical_capabilities_for(model_id) capabilities = [] capabilities << 'vision' if model_id.match?(/sonar(?:-pro|-reasoning(?:-pro)?)?$/) capabilities << 'reasoning' if model_id.match?(/reasoning|deep-research/) capabilities end |
.max_tokens_for(model_id) ⇒ Object
34 35 36 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 34 def max_tokens_for(model_id) model_id.match?(/sonar-(?:pro|reasoning-pro)/) ? 8_192 : 4_096 end |
.model_family(model_id) ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 57 def model_family(model_id) case model_id when 'sonar' then :sonar when 'sonar-pro' then :sonar_pro when 'sonar-reasoning' then :sonar_reasoning when 'sonar-reasoning-pro' then :sonar_reasoning_pro when 'sonar-deep-research' then :sonar_deep_research else :unknown end end |
.pricing_for(model_id) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 45 def pricing_for(model_id) prices = PRICES.fetch(model_family(model_id), { input: 1.0, output: 1.0 }) standard = { input_per_million: prices[:input], output_per_million: prices[:output] } standard[:reasoning_output_per_million] = prices[:reasoning_output] if prices[:reasoning_output] { text_tokens: { standard: standard } } end |
.supports_tool_choice?(_model_id) ⇒ Boolean
22 23 24 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 22 def supports_tool_choice?(_model_id) false end |
.supports_tool_parallel_control?(_model_id) ⇒ Boolean
26 27 28 |
# File 'lib/ruby_llm/providers/perplexity/capabilities.rb', line 26 def supports_tool_parallel_control?(_model_id) false end |