active_harness 0.2.17 → 0.2.19

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: e67acd826c0203c211c8a94266120d46981b587936b4ea6a29695b608ad76fa5
4
- data.tar.gz: f21dded079561c202df392deb3199aa99df499a26fcd690c2bfc559290c17c09
3
+ metadata.gz: 9562f506c8c0b6a219b085fc33a123a39538f368d5fa0255400cc5632b3395f2
4
+ data.tar.gz: c23b9fddc6356c71b37495fce0654d1777314d96ca43001b41c1e97f3b59c8d8
5
5
  SHA512:
6
- metadata.gz: a248a63543848edc58386f8b5a025f247c624dc5b02696ca1c23eb56ecf3d2505edf838fc7c4400fd141013eccd5b35d4a70d812520556445f368cdcb7a3c9b2
7
- data.tar.gz: 9dd1c65dba72bc37d87b1afc81835a169e1de43eddffbc33900a2e88fdc8eb561ddbab5b6d7e68129389cd10818927a011d9c7d4f9405ab161ae80d8b74d5649
6
+ metadata.gz: 6def9d9a139113f948c7da6acd1ed0f99e88257c273b3434d236829b700d156e6feeda60ac7fbadef183840ca76e9e12b08b70f40b9d2bdb634f14a4cee19ce7
7
+ data.tar.gz: 76e1a91a7cbd321e56900562b9c471d7313a0553d2a72764000768e7e7c4fcdd0ecc09d321ebb95f3cc43335f66ad81d11d7d354fdc8204bab48d404a969710c
@@ -1,14 +1,14 @@
1
1
  module ActiveHarness
2
2
  class Agent
3
3
  # -------------------------------------------------------------------------
4
- # RubyLLM backend DSL
4
+ # Custom LLM backend DSL
5
5
  #
6
- # Allows an agent to delegate HTTP calls to the `ruby_llm` gem instead of
7
- # ActiveHarness's built-in Net::HTTP providers.
6
+ # Allows an agent to delegate HTTP calls to any LLM client (e.g. `ruby_llm`)
7
+ # instead of ActiveHarness's built-in Net::HTTP providers.
8
8
  #
9
9
  # Usage:
10
10
  #
11
- # ruby_llm_backend do |params|
11
+ # custom_llm_backend do |params|
12
12
  # RubyLLM.chat(
13
13
  # model: params.model,
14
14
  # provider: params.provider,
@@ -27,23 +27,23 @@ module ActiveHarness
27
27
  # - streaming via stream: lambda
28
28
  # -------------------------------------------------------------------------
29
29
 
30
- # Passed to the ruby_llm_backend block for each model attempt.
30
+ # Passed to the custom_llm_backend block for each model attempt.
31
31
  BackendParams = Struct.new(:model, :provider, :temperature, keyword_init: true)
32
32
 
33
33
  class << self
34
- # Define the RubyLLM backend block for this agent class.
35
- def ruby_llm_backend(&block)
36
- agent_config[:ruby_llm_backend] = block
34
+ # Define the custom LLM backend block for this agent class.
35
+ def custom_llm_backend(&block)
36
+ agent_config[:custom_llm_backend] = block
37
37
  end
38
38
  end
39
39
 
40
40
  private
41
41
 
42
- # Called from attempt_model when ruby_llm_backend is configured.
43
- def attempt_via_ruby_llm(entry, system_prompt)
42
+ # Called from attempt_model when custom_llm_backend is configured.
43
+ def attempt_via_custom_llm(entry, system_prompt)
44
44
  require "ruby_llm"
45
45
 
46
- backend = @config[:ruby_llm_backend]
46
+ backend = @config[:custom_llm_backend]
47
47
 
48
48
  params = BackendParams.new(
49
49
  model: entry[:model],
@@ -60,7 +60,7 @@ module ActiveHarness
60
60
  response = chat.ask(@input)
61
61
  end
62
62
 
63
- { content: response.content, usage: ruby_llm_usage(response) }
63
+ { content: response.content, usage: custom_llm_usage(response) }
64
64
  rescue ::RubyLLM::UnauthorizedError => e
65
65
  raise Errors::InvalidApiKeyError, e.message
66
66
  rescue ::RubyLLM::RateLimitError, ::RubyLLM::OverloadedError => e
@@ -76,7 +76,7 @@ module ActiveHarness
76
76
  "The `ruby_llm` gem is required. Add `gem \"ruby_llm\"` to your Gemfile."
77
77
  end
78
78
 
79
- def ruby_llm_usage(response)
79
+ def custom_llm_usage(response)
80
80
  t = response.tokens
81
81
  return nil unless t
82
82
 
@@ -41,7 +41,7 @@ module ActiveHarness
41
41
  private
42
42
 
43
43
  def attempt_model(entry, system_prompt)
44
- return attempt_via_ruby_llm(entry, system_prompt) if @config[:ruby_llm_backend]
44
+ return attempt_via_custom_llm(entry, system_prompt) if @config[:custom_llm_backend]
45
45
 
46
46
  provider = resolve_provider(entry[:provider])
47
47
  messages = build_messages(system_prompt, @input)
@@ -170,6 +170,6 @@ require_relative "agent/hooks"
170
170
  require_relative "agent/models"
171
171
  require_relative "agent/providers"
172
172
  require_relative "agent/output_parser"
173
- require_relative "agent/ruby_llm_backend"
173
+ require_relative "agent/custom_llm_backend"
174
174
  require_relative "agent/cost"
175
175
 
@@ -29,7 +29,7 @@ require_relative "active_harness/pipeline"
29
29
  require_relative "active_harness/railtie" if defined?(Rails::Railtie)
30
30
 
31
31
  module ActiveHarness
32
- VERSION = "0.2.0"
32
+ VERSION = "0.2.19"
33
33
 
34
34
  class << self
35
35
  # Configure ActiveHarness.
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.17
4
+ version: 0.2.19
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-05-25 00:00:00.000000000 Z
11
+ date: 2026-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -34,12 +34,12 @@ files:
34
34
  - lib/active_harness.rb
35
35
  - lib/active_harness/agent.rb
36
36
  - lib/active_harness/agent/cost.rb
37
+ - lib/active_harness/agent/custom_llm_backend.rb
37
38
  - lib/active_harness/agent/hooks.rb
38
39
  - lib/active_harness/agent/models.rb
39
40
  - lib/active_harness/agent/output_parser.rb
40
41
  - lib/active_harness/agent/prompt.rb
41
42
  - lib/active_harness/agent/providers.rb
42
- - lib/active_harness/agent/ruby_llm_backend.rb
43
43
  - lib/active_harness/configuration.rb
44
44
  - lib/active_harness/core/errors.rb
45
45
  - lib/active_harness/costs.rb