Class: AIRecordFinder::Configuration
- Inherits:
-
Object
- Object
- AIRecordFinder::Configuration
- Defined in:
- lib/ai_record_finder/configuration.rb
Overview
Runtime configuration for AIRecordFinder.
Constant Summary collapse
- DEFAULT_PROVIDER =
:openai- DEFAULT_MAX_LIMIT =
100- DEFAULT_TIMEOUT =
15- DEFAULT_MAX_TOKENS =
1024- DEFAULT_ANTHROPIC_VERSION =
"2023-06-01"- PROVIDER_DEFAULTS =
Per-provider defaults for endpoint and model. Used only when the corresponding setting is not explicitly assigned.
{ openai: { api_base_url: "https://api.openai.com/v1", model_name: "gpt-4o-mini" }, anthropic: { api_base_url: "https://api.anthropic.com/v1", model_name: "claude-sonnet-4-6" } }.freeze
- DEFAULT_MODEL_NAME =
Backwards-compatible constants (OpenAI defaults).
PROVIDER_DEFAULTS[:openai][:model_name]
- DEFAULT_API_BASE_URL =
PROVIDER_DEFAULTS[:openai][:api_base_url]
Instance Attribute Summary collapse
-
#allowed_associations ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#allowed_models ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#anthropic_version ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#api_base_url ⇒ Object
Explicit base URL, or the provider default when unset.
-
#api_key ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#max_limit ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#max_tokens ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#model_name ⇒ Object
Explicit model name, or the provider default when unset.
-
#provider ⇒ Object
Normalized provider symbol (e.g. :openai, :anthropic).
-
#request_timeout ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
-
#temperature ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ai_record_finder/configuration.rb', line 36 def initialize @api_key = @model_name = @api_base_url = nil @provider = DEFAULT_PROVIDER @max_limit = DEFAULT_MAX_LIMIT @allowed_models = [] @request_timeout = DEFAULT_TIMEOUT @temperature = 0.0 @allowed_associations = {} @max_tokens = DEFAULT_MAX_TOKENS @anthropic_version = DEFAULT_ANTHROPIC_VERSION end |
Instance Attribute Details
#allowed_associations ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def allowed_associations @allowed_associations end |
#allowed_models ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def allowed_models @allowed_models end |
#anthropic_version ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def anthropic_version @anthropic_version end |
#api_base_url ⇒ Object
Explicit base URL, or the provider default when unset.
59 60 61 |
# File 'lib/ai_record_finder/configuration.rb', line 59 def api_base_url @api_base_url || provider_default(:api_base_url) end |
#api_key ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def api_key @api_key end |
#max_limit ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def max_limit @max_limit end |
#max_tokens ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def max_tokens @max_tokens end |
#model_name ⇒ Object
Explicit model name, or the provider default when unset.
54 55 56 |
# File 'lib/ai_record_finder/configuration.rb', line 54 def model_name @model_name || provider_default(:model_name) end |
#provider ⇒ Object
Normalized provider symbol (e.g. :openai, :anthropic).
49 50 51 |
# File 'lib/ai_record_finder/configuration.rb', line 49 def provider @provider.to_s.strip.downcase.to_sym end |
#request_timeout ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def request_timeout @request_timeout end |
#temperature ⇒ Object
‘max_tokens` and `anthropic_version` are consumed only by the Anthropic adapter; the OpenAI adapter ignores them.
31 32 33 |
# File 'lib/ai_record_finder/configuration.rb', line 31 def temperature @temperature end |