active_harness 0.2.28 → 0.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce3118f24bd7e48d024a4b5c14d0e01531e453be2f56479918759dc425bc932d
4
- data.tar.gz: 561d4d3f46b98a224d53ed964c319fbb1a73bffc5c6a3dd189d01e24d1af2427
3
+ metadata.gz: 7146a492cd9454703ab47eb1c6222962587b4fe5585aaef2a5390349da394a1a
4
+ data.tar.gz: 476ee4d22259b10fa7d58cd25208ea5c900e6523991b1f17e288f7c3104cfd92
5
5
  SHA512:
6
- metadata.gz: 29f2a581e10290eb176a80e142a120ba5e9c9f0bc9e5decfacb7237fd11f35621bd35a64ebca2999399edd5f5865aec343edb8a11c8040e539329857b51c6d23
7
- data.tar.gz: 86ef4129befa8b92af78f5666a4f6346f9d9eba46f39e880cf9968d03b7339f6de9620a0b558d67571bd4650425da0ea3455b8251c356e366717c87233dc3516
6
+ metadata.gz: d211c987a80244262c35fbc83202491b61807ee98f092808ca801cfcc57eb1ad58e4f48ccf8e364078b99a267e14816e8551b55c5b2a3de2fe8e6828321bc2b6
7
+ data.tar.gz: 71244082f0e0c81d9fe7d0271e05dd53ebf0e5a727ced5554d637e84aed8a58b6a014e8b0537ff2dcc10cc501385905b78c5aae8f328c1d774a874fc30d3c7b3
@@ -64,13 +64,31 @@ module ActiveHarness
64
64
  :cache_write_input_per_million,
65
65
  :context_window,
66
66
  :max_output_tokens,
67
+ :input_modalities,
68
+ :output_modalities,
67
69
  keyword_init: true
68
70
  ) do
71
+ # Returns capability tags derived from modality data and model id/name.
72
+ # Possible values: "vision", "pdf", "audio", "video", "imggen", "embed"
73
+ def categories
74
+ inp = input_modalities || []
75
+ out = output_modalities || []
76
+ cats = []
77
+ cats << "vision" if inp.include?("image")
78
+ cats << "pdf" if inp.include?("pdf")
79
+ cats << "audio" if inp.include?("audio") || out.include?("audio")
80
+ cats << "video" if inp.include?("video") || out.include?("video")
81
+ cats << "imggen" if out.include?("image")
82
+ cats << "embed" if id.to_s.match?(/embed/i) || name.to_s.match?(/embed/i)
83
+ cats
84
+ end
85
+
69
86
  def inspect
70
87
  parts = ["id=#{id.inspect}", "provider=#{provider.inspect}"]
71
88
  parts << "input=$#{input_per_million}/M" if input_per_million
72
89
  parts << "output=$#{output_per_million}/M" if output_per_million
73
90
  parts << "ctx=#{context_window}" if context_window
91
+ parts << "cats=#{categories.join(',')}" if categories.any?
74
92
  "#<ModelCost #{parts.join(' ')}>"
75
93
  end
76
94
  end
@@ -232,12 +250,15 @@ module ActiveHarness
232
250
  cache_write_input_per_million: cost[:cache_write]
233
251
  }.compact
234
252
 
253
+ mods = m[:modalities] || {}
235
254
  {
236
255
  id: m[:id],
237
256
  name: m[:name] || m[:id],
238
257
  provider: ah_provider,
239
258
  context_window: m[:context_window] || m.dig(:limit, :context),
240
259
  max_output_tokens: m[:max_output_tokens] || m.dig(:limit, :output),
260
+ input_modalities: Array(mods[:input]),
261
+ output_modalities: Array(mods[:output]),
241
262
  pricing: standard.any? ? { text_tokens: { standard: standard } } : {}
242
263
  }
243
264
  end
@@ -255,7 +276,9 @@ module ActiveHarness
255
276
  cache_read_input_per_million: standard[:cache_read_input_per_million],
256
277
  cache_write_input_per_million: standard[:cache_write_input_per_million],
257
278
  context_window: raw[:context_window],
258
- max_output_tokens: raw[:max_output_tokens]
279
+ max_output_tokens: raw[:max_output_tokens],
280
+ input_modalities: Array(raw[:input_modalities]),
281
+ output_modalities: Array(raw[:output_modalities])
259
282
  )
260
283
  end
261
284
 
@@ -84,6 +84,12 @@ module ActiveHarness
84
84
  async: false,
85
85
  **adapter_opts
86
86
  )
87
+ if self.class == Memory
88
+ raise NotImplementedError,
89
+ "Memory cannot be instantiated directly. " \
90
+ "Use Memory::JsonFile, Memory::Postgresql, or Memory::Sqlite."
91
+ end
92
+
87
93
  @session_id = session_id
88
94
  @depth = depth
89
95
  @enabled = enabled
@@ -16,7 +16,7 @@ class SupportPipeline < ActiveHarness::Pipeline
16
16
 
17
17
  step :safety_tribunal do
18
18
  use SafetyTribunal
19
- stop_if ->(result) { result.verdict == false }
19
+ stop_if ->(result) { result.processed["verdict"] == false }
20
20
  end
21
21
  end
22
22
 
@@ -14,7 +14,7 @@ module ActiveHarness
14
14
  #
15
15
  # step :safety_tribunal do
16
16
  # use SafetyTribunal
17
- # stop_if ->(result) { result.verdict == false }
17
+ # stop_if ->(result) { result.processed["verdict"] == false }
18
18
  # end
19
19
  #
20
20
  # on :before_step do |step_name, payload| ... end
@@ -30,7 +30,7 @@ require_relative "active_harness/pipeline"
30
30
  require_relative "active_harness/railtie" if defined?(Rails::Railtie)
31
31
 
32
32
  module ActiveHarness
33
- VERSION = "0.2.28"
33
+ VERSION = "0.2.29"
34
34
 
35
35
  class << self
36
36
  # Configure ActiveHarness.
@@ -43,11 +43,12 @@ class AiSupportController < ApplicationController
43
43
  # Returns verdict: true (safe) or false (rejected).
44
44
  # ---------------------------------------------------------------------------
45
45
  def tribunal
46
- result = SupportGuardTribunal.call(input: params.require(:input))
46
+ tribunal = SupportGuardTribunal.new(input: params.require(:input))
47
+ tribunal.call
47
48
 
48
49
  render json: {
49
- verdict: result.verdict,
50
- time: result.execution_time
50
+ verdict: tribunal.verdict,
51
+ time: tribunal.execution_time
51
52
  }
52
53
  end
53
54
 
@@ -7,7 +7,7 @@ class SupportPipeline < ActiveHarness::Pipeline
7
7
  # Step 1 — GUARD: reject spam before spending tokens on an answer
8
8
  step :spam_guard do
9
9
  use SupportGuardTribunal
10
- stop_if ->(result) { result.verdict == false }
10
+ stop_if ->(result) { result.processed["verdict"] == false }
11
11
  end
12
12
 
13
13
  # Step 2 — RESPOND: generate the actual answer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.28
4
+ version: 0.2.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - the-teacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-09 00:00:00.000000000 Z
11
+ date: 2026-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby