active_harness 0.2.5 → 0.2.7
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eaa18bf8f82b46ce0066c77d60b142948ecf00c1a682c880aeadd7bd4f4d2952
|
|
4
|
+
data.tar.gz: b1cdf2d3a20c6effdbf88f8eb0ee5df2ce627cc0ff6ba0790b7d841a77fa6444
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '091e1439cb133d99588573c0543779edd64cee3154f73e9b682a9b1da9c6c85a223b27f94ac9980ea9db1dc6478f9d964416295c665e2a5151c41160dd9b07c4'
|
|
7
|
+
data.tar.gz: 9af3ad6a8c3b5645a7da0f6f86baed21c5a36c99d905ae3595b39e2a79c068802aa561d6d6e723e38401df9d970ae1b2b487d69dc0f4e3414cd46fd42e098f5d
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
module ActiveHarness
|
|
2
2
|
class Agent
|
|
3
|
-
# Errors that allow retrying the next model in the chain
|
|
3
|
+
# Errors that allow retrying the next model in the chain.
|
|
4
|
+
# InvalidRequestError is included here so that a bad model name (or any
|
|
5
|
+
# per-model request failure) does not abort the entire chain — the next
|
|
6
|
+
# fallback model will be attempted instead.
|
|
4
7
|
RETRYABLE_ERRORS = [
|
|
5
8
|
Errors::TimeoutError,
|
|
6
9
|
Errors::RateLimitError,
|
|
7
10
|
Errors::ServerError,
|
|
8
|
-
Errors::ProviderUnavailableError
|
|
11
|
+
Errors::ProviderUnavailableError,
|
|
12
|
+
Errors::InvalidRequestError
|
|
9
13
|
].freeze
|
|
10
14
|
|
|
11
|
-
# Errors that abort the entire chain immediately
|
|
15
|
+
# Errors that abort the entire chain immediately.
|
|
16
|
+
# InvalidApiKeyError — the key is wrong for every model, retrying is pointless.
|
|
17
|
+
# SafetyBlockedError — the input itself is blocked; a different model won't help.
|
|
12
18
|
STOP_ERRORS = [
|
|
13
|
-
Errors::InvalidRequestError,
|
|
14
19
|
Errors::InvalidApiKeyError,
|
|
15
20
|
Errors::SafetyBlockedError
|
|
16
21
|
].freeze
|
|
@@ -2,7 +2,7 @@ module ActiveHarness
|
|
|
2
2
|
class Railtie < Rails::Railtie
|
|
3
3
|
APP_AI_DIRS = %w[agents prompts tribunals pipelines memory].freeze
|
|
4
4
|
|
|
5
|
-
initializer "active_harness.autoload_paths" do |app|
|
|
5
|
+
initializer "active_harness.autoload_paths", before: :set_autoload_paths do |app|
|
|
6
6
|
APP_AI_DIRS.each do |dir|
|
|
7
7
|
path = Rails.root.join("app", "ai", dir)
|
|
8
8
|
app.config.autoload_paths << path.to_s if path.exist?
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
class AiSupportController < ApplicationController
|
|
2
2
|
include ActionController::Live
|
|
3
3
|
|
|
4
|
+
skip_before_action :verify_authenticity_token
|
|
5
|
+
|
|
4
6
|
# ---------------------------------------------------------------------------
|
|
5
7
|
# POST /ai/agent
|
|
6
8
|
# body: { input: "What is your return policy?" }
|