Class: RubyLLM::SemanticRouter::Configuration
- Inherits:
-
Object
- Object
- RubyLLM::SemanticRouter::Configuration
- Defined in:
- lib/rubyllm/semantic_router/configuration.rb
Overview
Global configuration for the semantic router
Constant Summary collapse
- VALID_FALLBACKS =
%i[default_agent keep_current ask_clarification].freeze
Instance Attribute Summary collapse
-
#cache_ttl ⇒ Object
Embedding cache TTL in seconds (nil = no caching).
-
#default_embedding_model ⇒ Object
Default embedding model to use when not specified per-router.
-
#default_fallback ⇒ Object
Default fallback behavior (:default_agent, :keep_current, :ask_clarification).
-
#default_k_neighbors ⇒ Object
Default number of neighbors to consider for routing.
-
#default_max_words ⇒ Object
Default max words to use for embedding (nil = unlimited).
-
#default_similarity_threshold ⇒ Object
Default similarity threshold (0.0 - 1.0).
-
#logger ⇒ Object
Logger instance for debug output (nil = no logging).
-
#max_retries ⇒ Object
Maximum retry attempts for embedding API failures.
-
#retry_base_delay ⇒ Object
Base delay in seconds for exponential backoff.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 38 def initialize @default_embedding_model = "text-embedding-3-small" @default_similarity_threshold = 0.3 @default_k_neighbors = 3 @default_fallback = :default_agent @default_max_words = nil @logger = nil @cache_ttl = nil @max_retries = 3 @retry_base_delay = 0.5 end |
Instance Attribute Details
#cache_ttl ⇒ Object
Embedding cache TTL in seconds (nil = no caching)
16 17 18 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 16 def cache_ttl @cache_ttl end |
#default_embedding_model ⇒ Object
Default embedding model to use when not specified per-router
10 11 12 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 10 def @default_embedding_model end |
#default_fallback ⇒ Object
Default fallback behavior (:default_agent, :keep_current, :ask_clarification)
25 26 27 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 25 def default_fallback @default_fallback end |
#default_k_neighbors ⇒ Object
Default number of neighbors to consider for routing
31 32 33 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 31 def default_k_neighbors @default_k_neighbors end |
#default_max_words ⇒ Object
Default max words to use for embedding (nil = unlimited)
34 35 36 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 34 def default_max_words @default_max_words end |
#default_similarity_threshold ⇒ Object
Default similarity threshold (0.0 - 1.0)
28 29 30 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 28 def default_similarity_threshold @default_similarity_threshold end |
#logger ⇒ Object
Logger instance for debug output (nil = no logging)
13 14 15 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 13 def logger @logger end |
#max_retries ⇒ Object
Maximum retry attempts for embedding API failures
19 20 21 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 19 def max_retries @max_retries end |
#retry_base_delay ⇒ Object
Base delay in seconds for exponential backoff
22 23 24 |
# File 'lib/rubyllm/semantic_router/configuration.rb', line 22 def retry_base_delay @retry_base_delay end |