Class: PromptEngine::Setting

Inherits:
ApplicationRecord show all
Defined in:
app/models/prompt_engine/setting.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject

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

Returns:

  • (Boolean)


19
20
21
# File 'app/models/prompt_engine/setting.rb', line 19

def anthropic_configured?
  anthropic_api_key.present?
end

#masked_anthropic_api_keyObject



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_keyObject

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

Returns:

  • (Boolean)


15
16
17
# File 'app/models/prompt_engine/setting.rb', line 15

def openai_configured?
  openai_api_key.present?
end