Module: RubyLLM::Providers::DeepSeek::Capabilities

Defined in:
lib/ruby_llm/providers/deepseek/capabilities.rb

Overview

Determines capabilities and pricing for DeepSeek models

Constant Summary collapse

PRICES =
{
  chat: {
    input_hit: 0.07,
    input_miss: 0.27,
    output: 1.10
  },
  reasoner: {
    input_hit: 0.14,
    input_miss: 0.55,
    output: 2.19
  }
}.freeze

Class Method Summary collapse

Class Method Details

.cache_hit_price_for(model_id) ⇒ Object



32
33
34
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 32

def cache_hit_price_for(model_id)
  PRICES.dig(model_family(model_id), :input_hit) || default_cache_hit_price
end

.capabilities_for(model_id) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 102

def capabilities_for(model_id)
  capabilities = ['streaming']

  capabilities << 'function_calling' if model_id.match?(/deepseek-chat/)

  capabilities
end

.context_window_for(model_id) ⇒ Object



10
11
12
13
14
15
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 10

def context_window_for(model_id)
  case model_id
  when /deepseek-(?:chat|reasoner)/ then 64_000
  else 32_768
  end
end

.default_cache_hit_priceObject



91
92
93
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 91

def default_cache_hit_price
  0.07
end

.default_input_priceObject



83
84
85
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 83

def default_input_price
  0.27
end

.default_output_priceObject



87
88
89
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 87

def default_output_price
  1.10
end

.format_display_name(model_id) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 48

def format_display_name(model_id)
  case model_id
  when 'deepseek-chat' then 'DeepSeek V3'
  when 'deepseek-reasoner' then 'DeepSeek R1'
  else
    model_id.split('-')
            .map(&:capitalize)
            .join(' ')
  end
end

.input_price_for(model_id) ⇒ Object



24
25
26
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 24

def input_price_for(model_id)
  PRICES.dig(model_family(model_id), :input_miss) || default_input_price
end

.max_tokens_for(model_id) ⇒ Object



17
18
19
20
21
22
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 17

def max_tokens_for(model_id)
  case model_id
  when /deepseek-(?:chat|reasoner)/ then 8_192
  else 4_096
  end
end

.modalities_for(_model_id) ⇒ Object



95
96
97
98
99
100
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 95

def modalities_for(_model_id)
  {
    input: ['text'],
    output: ['text']
  }
end

.model_family(model_id) ⇒ Object



63
64
65
66
67
68
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 63

def model_family(model_id)
  case model_id
  when /deepseek-reasoner/ then :reasoner
  else :chat
  end
end

.model_type(_model_id) ⇒ Object



59
60
61
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 59

def model_type(_model_id)
  'chat'
end

.output_price_for(model_id) ⇒ Object



28
29
30
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 28

def output_price_for(model_id)
  PRICES.dig(model_family(model_id), :output) || default_output_price
end

.pricing_for(model_id) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 110

def pricing_for(model_id)
  family = model_family(model_id)
  prices = PRICES.fetch(family, { input_miss: default_input_price, output: default_output_price })

  standard_pricing = {
    input_per_million: prices[:input_miss],
    output_per_million: prices[:output]
  }

  standard_pricing[:cached_input_per_million] = prices[:input_hit] if prices[:input_hit]

  {
    text_tokens: {
      standard: standard_pricing
    }
  }
end

.supports_functions?(model_id) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 40

def supports_functions?(model_id)
  model_id.match?(/deepseek-chat/)
end

.supports_json_mode?(_model_id) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 44

def supports_json_mode?(_model_id)
  false
end

.supports_vision?(_model_id) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/ruby_llm/providers/deepseek/capabilities.rb', line 36

def supports_vision?(_model_id)
  false
end