Class: RailsAiBridge::Config::ContextProviders
- Inherits:
-
Object
- Object
- RailsAiBridge::Config::ContextProviders
- Defined in:
- lib/rails_ai_bridge/config/context_providers.rb
Overview
Holds outbound context-provider settings: enable switch, host allowlist, loopback ports, private-network override, timeouts, response limits, provider and tool count caps, aggregation budget, and downstream auth resolver.
Instance Attribute Summary collapse
-
#aggregation_budget_seconds ⇒ Numeric
Total budget across all providers in one tool call, in seconds.
-
#allow_private_networks ⇒ Boolean
Whether private/link-local network destinations are allowed.
-
#allowed_hosts ⇒ Array<String>
Exact allowed hostnames; no wildcards or suffixes.
-
#allowed_loopback_ports ⇒ Array<Integer>
Allowed loopback ports for HTTP development endpoints.
-
#auth_resolver ⇒ Proc?
Lambda returning auth headers for a configured provider identity.
-
#enabled ⇒ Boolean
Whether outbound provider traffic is allowed.
-
#max_providers ⇒ Integer
Maximum providers to call in one tool invocation.
-
#max_resolved_addresses ⇒ Integer
Maximum DNS addresses to resolve per endpoint.
-
#max_response_bytes ⇒ Integer
Maximum provider response body size in bytes before normalization.
-
#max_tools_per_provider ⇒ Integer
Maximum tools to call per provider.
-
#timeout_seconds ⇒ Numeric
Per-tool connect/read timeout in seconds.
Instance Method Summary collapse
- #initialize ⇒ ContextProviders constructor
Constructor Details
#initialize ⇒ ContextProviders
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 43 def initialize @enabled = false @allowed_hosts = [] @allowed_loopback_ports = [3000, 9292] @timeout_seconds = 10 @aggregation_budget_seconds = 30 @max_response_bytes = 1_048_576 @max_providers = 8 @max_tools_per_provider = 16 @max_resolved_addresses = 8 @allow_private_networks = false @auth_resolver = nil end |
Instance Attribute Details
#aggregation_budget_seconds ⇒ Numeric
Returns total budget across all providers in one tool call, in seconds.
28 29 30 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 28 def aggregation_budget_seconds @aggregation_budget_seconds end |
#allow_private_networks ⇒ Boolean
Returns whether private/link-local network destinations are allowed.
19 20 21 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 19 def allow_private_networks @allow_private_networks end |
#allowed_hosts ⇒ Array<String>
Returns exact allowed hostnames; no wildcards or suffixes.
13 14 15 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 13 def allowed_hosts @allowed_hosts end |
#allowed_loopback_ports ⇒ Array<Integer>
Returns allowed loopback ports for HTTP development endpoints.
16 17 18 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 16 def allowed_loopback_ports @allowed_loopback_ports end |
#auth_resolver ⇒ Proc?
Returns lambda returning auth headers for a configured provider identity.
22 23 24 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 22 def auth_resolver @auth_resolver end |
#enabled ⇒ Boolean
Returns whether outbound provider traffic is allowed.
10 11 12 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 10 def enabled @enabled end |
#max_providers ⇒ Integer
Returns maximum providers to call in one tool invocation.
34 35 36 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 34 def max_providers @max_providers end |
#max_resolved_addresses ⇒ Integer
Returns maximum DNS addresses to resolve per endpoint.
40 41 42 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 40 def max_resolved_addresses @max_resolved_addresses end |
#max_response_bytes ⇒ Integer
Returns maximum provider response body size in bytes before normalization.
31 32 33 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 31 def max_response_bytes @max_response_bytes end |
#max_tools_per_provider ⇒ Integer
Returns maximum tools to call per provider.
37 38 39 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 37 def max_tools_per_provider @max_tools_per_provider end |
#timeout_seconds ⇒ Numeric
Returns per-tool connect/read timeout in seconds.
25 26 27 |
# File 'lib/rails_ai_bridge/config/context_providers.rb', line 25 def timeout_seconds @timeout_seconds end |