Class: Observ::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/observ/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/observ/configuration.rb', line 24

def initialize
  @prompt_management_enabled = true
  @prompt_cache_ttl = 300 # 5 minutes
  @prompt_fallback_behavior = :raise # or :return_nil, :use_fallback
  @prompt_cache_store = :redis_cache_store
  @prompt_cache_prefix = "observ:prompt"
  @prompt_cache_namespace = "observ:prompt"
  @prompt_max_versions = 100
  @prompt_default_state = :production
  @prompt_allow_production_deletion = false
  @prompt_cache_warming_enabled = true
  @prompt_cache_critical_prompts = []
  @prompt_cache_monitoring_enabled = true
  @prompt_config_schema = default_prompt_config_schema
  @prompt_config_schema_strict = false
  @back_to_app_path = -> { "/" }
  @chat_ui_enabled = -> { defined?(::Chat) && ::Chat.respond_to?(:acts_as_chat) }
  @agent_path = nil # Defaults to Rails.root.join("app", "agents")
  @pagination_per_page = 25
end

Instance Attribute Details

#agent_pathObject

Returns the value of attribute agent_path.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def agent_path
  @agent_path
end

#back_to_app_pathObject

Returns the value of attribute back_to_app_path.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def back_to_app_path
  @back_to_app_path
end

#chat_ui_enabledObject

Returns the value of attribute chat_ui_enabled.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def chat_ui_enabled
  @chat_ui_enabled
end

#pagination_per_pageObject

Returns the value of attribute pagination_per_page.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def pagination_per_page
  @pagination_per_page
end

#prompt_allow_production_deletionObject

Returns the value of attribute prompt_allow_production_deletion.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_allow_production_deletion
  @prompt_allow_production_deletion
end

#prompt_cache_critical_promptsObject

Returns the value of attribute prompt_cache_critical_prompts.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_critical_prompts
  @prompt_cache_critical_prompts
end

#prompt_cache_monitoring_enabledObject

Returns the value of attribute prompt_cache_monitoring_enabled.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_monitoring_enabled
  @prompt_cache_monitoring_enabled
end

#prompt_cache_namespaceObject

Returns the value of attribute prompt_cache_namespace.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_namespace
  @prompt_cache_namespace
end

#prompt_cache_prefixObject

Returns the value of attribute prompt_cache_prefix.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_prefix
  @prompt_cache_prefix
end

#prompt_cache_storeObject

Returns the value of attribute prompt_cache_store.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_store
  @prompt_cache_store
end

#prompt_cache_ttlObject

Returns the value of attribute prompt_cache_ttl.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_ttl
  @prompt_cache_ttl
end

#prompt_cache_warming_enabledObject

Returns the value of attribute prompt_cache_warming_enabled.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_cache_warming_enabled
  @prompt_cache_warming_enabled
end

#prompt_config_schemaObject

Returns the value of attribute prompt_config_schema.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_config_schema
  @prompt_config_schema
end

#prompt_config_schema_strictObject

Returns the value of attribute prompt_config_schema_strict.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_config_schema_strict
  @prompt_config_schema_strict
end

#prompt_default_stateObject

Returns the value of attribute prompt_default_state.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_default_state
  @prompt_default_state
end

#prompt_fallback_behaviorObject

Returns the value of attribute prompt_fallback_behavior.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_fallback_behavior
  @prompt_fallback_behavior
end

#prompt_management_enabledObject

Returns the value of attribute prompt_management_enabled.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_management_enabled
  @prompt_management_enabled
end

#prompt_max_versionsObject

Returns the value of attribute prompt_max_versions.



5
6
7
# File 'lib/observ/configuration.rb', line 5

def prompt_max_versions
  @prompt_max_versions
end

Instance Method Details

#chat_ui_enabled?Boolean

Check if chat UI is enabled

Returns:

  • (Boolean)


47
48
49
50
# File 'lib/observ/configuration.rb', line 47

def chat_ui_enabled?
  return @chat_ui_enabled.call if @chat_ui_enabled.respond_to?(:call)
  @chat_ui_enabled
end

#default_prompt_config_schemaHash

Default schema for prompt configuration validation

Returns:

  • (Hash)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/observ/configuration.rb', line 54

def default_prompt_config_schema
  {
    temperature: {
      type: :float,
      required: false,
      range: 0.0..2.0,
      default: 0.7
    },
    max_tokens: {
      type: :integer,
      required: false,
      range: 1..100000
    },
    top_p: {
      type: :float,
      required: false,
      range: 0.0..1.0
    },
    frequency_penalty: {
      type: :float,
      required: false,
      range: -2.0..2.0
    },
    presence_penalty: {
      type: :float,
      required: false,
      range: -2.0..2.0
    },
    stop_sequences: {
      type: :array,
      required: false,
      item_type: :string
    },
    model: {
      type: :string,
      required: false
    },
    response_format: {
      type: :hash,
      required: false
    },
    seed: {
      type: :integer,
      required: false
    },
    stream: {
      type: :boolean,
      required: false
    }
  }
end