Class: SkillBench::Clients::Providers::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/clients/providers/mock.rb

Overview

Mock LLM client for testing and local validation.

Class Method Summary collapse

Class Method Details

.call(system_prompt:, messages:, **_options) ⇒ Hash

Mock call implementation to simulate LLM responses for test suites.

Parameters:

  • system_prompt (String)

    system prompt instructions.

  • messages (Array<Hash>)

    chat history messages.

  • _options (Hash)

    additional keyword options.

Returns:

  • (Hash)

    mock response hash.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/skill_bench/clients/providers/mock.rb', line 19

def self.call(system_prompt:, messages:, **_options)
  _ = system_prompt
  prompt = messages.first[:content] || messages.first['content'] || ''

  # Parse dimensions from prompt
  dimensions = {}
  prompt.scan(/-\s+([^:]+):\s+max_score=(\d+)/).each do |name, max_score|
    max = max_score.to_i
    # Give baseline slightly lower score than context to simulate improvement
    is_context = prompt.match?(/## Skill Context\s+\S+/)
    score = is_context ? (max * 0.95).round : (max * 0.8).round
    dimensions[name] = {
      'score' => score,
      'max_score' => max,
      'reasoning' => "Mock evaluation for #{name}"
    }
  end

  dimensions['correctness'] = { 'score' => 8, 'max_score' => 10, 'reasoning' => 'Mock correctness' } if dimensions.empty?

  content = {
    'dimensions' => dimensions,
    'overall_reasoning' => 'Mock evaluation overall reasoning'
  }.to_json

  {
    success: true,
    response: {
      message: {
        content: content
      }
    }
  }
end