Class: LlmConductor::Eval::Store::InMemory

Inherits:
Base
  • Object
show all
Defined in:
lib/llm_conductor/eval/store/in_memory.rb

Overview

Default store: everything lives in process memory, nothing hits disk. Ideal for tests and ephemeral runs. Manifests are round-tripped through JSON on write so reads return string-keyed hashes, matching FileStore.

Instance Method Summary collapse

Constructor Details

#initializeInMemory

Returns a new instance of InMemory.



13
14
15
16
17
18
19
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 13

def initialize
  super
  @raw = {}
  @parsed = {}
  @inputs = {}
  @manifests = {}
end

Instance Method Details

#completed?(run_id, input_id, model_slug) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
62
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 59

def completed?(run_id, input_id, model_slug)
  key = output_key(run_id, input_id, model_slug)
  @parsed.key?(key) || @raw.key?(key)
end

#read_input_data(run_id, input_id) ⇒ Object



47
48
49
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 47

def read_input_data(run_id, input_id)
  @inputs[input_key(run_id, input_id)]
end

#read_manifest(run_id) ⇒ Object



55
56
57
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 55

def read_manifest(run_id)
  @manifests[run_id.to_s]
end

#read_parsed(run_id, input_id, model_slug) ⇒ Object



37
38
39
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 37

def read_parsed(run_id, input_id, model_slug)
  @parsed[output_key(run_id, input_id, model_slug)]
end

#read_raw(run_id, input_id, model_slug) ⇒ Object



27
28
29
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 27

def read_raw(run_id, input_id, model_slug)
  @raw[output_key(run_id, input_id, model_slug)]
end

#write_input_data(run_id, input_id, hash) ⇒ Object



41
42
43
44
45
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 41

def write_input_data(run_id, input_id, hash)
  # Round-trip through JSON so reads return string-keyed hashes, matching
  # FileStore — keeps judge_only/report_only behavior identical across stores.
  @inputs[input_key(run_id, input_id)] = JSON.parse(JSON.generate(hash))
end

#write_manifest(run_id, manifest_hash) ⇒ Object



51
52
53
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 51

def write_manifest(run_id, manifest_hash)
  @manifests[run_id.to_s] = JSON.parse(JSON.generate(manifest_hash))
end

#write_parsed(run_id, input_id, model_slug, hash) ⇒ Object



31
32
33
34
35
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 31

def write_parsed(run_id, input_id, model_slug, hash)
  key = output_key(run_id, input_id, model_slug)
  @parsed[key] = hash
  "memory://#{key}.json"
end

#write_raw(run_id, input_id, model_slug, text) ⇒ Object



21
22
23
24
25
# File 'lib/llm_conductor/eval/store/in_memory.rb', line 21

def write_raw(run_id, input_id, model_slug, text)
  key = output_key(run_id, input_id, model_slug)
  @raw[key] = text.to_s
  "memory://#{key}.raw"
end