Class: PromptEngine::Setting
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PromptEngine::Setting
- Defined in:
- app/models/prompt_engine/setting.rb
Class Method Summary collapse
-
.instance ⇒ Object
Singleton pattern - only one settings record should exist.
Instance Method Summary collapse
- #anthropic_configured? ⇒ Boolean
- #masked_anthropic_api_key ⇒ Object
-
#masked_openai_api_key ⇒ Object
Get masked API key for display (show only first and last 3 characters).
-
#openai_configured? ⇒ Boolean
Check if API keys are configured.
Class Method Details
.instance ⇒ Object
Singleton pattern - only one settings record should exist
10 11 12 |
# File 'app/models/prompt_engine/setting.rb', line 10 def self.instance first_or_create! end |
Instance Method Details
#anthropic_configured? ⇒ Boolean
19 20 21 |
# File 'app/models/prompt_engine/setting.rb', line 19 def anthropic_configured? anthropic_api_key.present? end |
#masked_anthropic_api_key ⇒ Object
28 29 30 |
# File 'app/models/prompt_engine/setting.rb', line 28 def masked_anthropic_api_key mask_api_key(anthropic_api_key) end |
#masked_openai_api_key ⇒ Object
Get masked API key for display (show only first and last 3 characters)
24 25 26 |
# File 'app/models/prompt_engine/setting.rb', line 24 def masked_openai_api_key mask_api_key(openai_api_key) end |
#openai_configured? ⇒ Boolean
Check if API keys are configured
15 16 17 |
# File 'app/models/prompt_engine/setting.rb', line 15 def openai_configured? openai_api_key.present? end |