Class: LanguageOperator::Dsl::ChatEndpointDefinition
- Inherits:
-
Object
- Object
- LanguageOperator::Dsl::ChatEndpointDefinition
- Defined in:
- lib/language_operator/dsl/chat_endpoint_definition.rb
Overview
Chat endpoint definition for agents
DEPRECATED: This class is deprecated. All agents now automatically get
identity-aware chat endpoints without configuration. The as_chat_endpoint
DSL method is no longer needed.
Allows agents to expose an OpenAI-compatible chat completion endpoint. Other systems can treat the agent as a language model.
Instance Attribute Summary collapse
-
#context_injection_level ⇒ Object
readonly
Returns the value of attribute context_injection_level.
-
#frequency_penalty(value = nil) ⇒ Float
readonly
Set frequency penalty.
-
#identity_awareness_enabled ⇒ Object
readonly
Returns the value of attribute identity_awareness_enabled.
-
#max_tokens(value = nil) ⇒ Integer
readonly
Set maximum tokens.
-
#model_name ⇒ Object
readonly
Returns the value of attribute model_name.
-
#presence_penalty(value = nil) ⇒ Float
readonly
Set presence penalty.
-
#prompt_template_level ⇒ Object
readonly
Returns the value of attribute prompt_template_level.
-
#stop_sequences ⇒ Object
readonly
Returns the value of attribute stop_sequences.
-
#system_prompt(prompt = nil) ⇒ String
readonly
Set system prompt for chat mode.
-
#temperature(value = nil) ⇒ Float
readonly
Set temperature parameter.
-
#top_p(value = nil) ⇒ Float
readonly
Set top_p parameter.
Instance Method Summary collapse
-
#context_injection(level = nil) ⇒ Symbol
(also: #context)
Set the context injection level for conversations.
-
#enable_identity_awareness(enabled = nil) ⇒ Boolean
(also: #enabled)
Enable or disable identity awareness and context injection.
-
#identity_awareness { ... } ⇒ Object
Configure identity awareness with options block.
-
#initialize(agent_name) ⇒ ChatEndpointDefinition
constructor
A new instance of ChatEndpointDefinition.
-
#model(name = nil) ⇒ String
Set model name exposed in API.
-
#prompt_template(level = nil) ⇒ Symbol
(also: #template)
Set the prompt template level for context injection.
-
#stop(sequences = nil) ⇒ Array<String>
Set stop sequences.
Constructor Details
#initialize(agent_name) ⇒ ChatEndpointDefinition
Returns a new instance of ChatEndpointDefinition.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 43 def initialize(agent_name) @agent_name = agent_name @system_prompt = nil @temperature = 0.7 @max_tokens = 2000 @model_name = agent_name @top_p = 1.0 @frequency_penalty = 0.0 @presence_penalty = 0.0 @stop_sequences = nil # Identity awareness and context injection settings @identity_awareness_enabled = true @prompt_template_level = :standard @context_injection_level = :standard end |
Instance Attribute Details
#context_injection_level ⇒ Object (readonly)
Returns the value of attribute context_injection_level.
39 40 41 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 39 def context_injection_level @context_injection_level end |
#frequency_penalty(value = nil) ⇒ Float (readonly)
Set frequency penalty
114 115 116 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 114 def frequency_penalty @frequency_penalty end |
#identity_awareness_enabled ⇒ Object (readonly)
Returns the value of attribute identity_awareness_enabled.
39 40 41 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 39 def identity_awareness_enabled @identity_awareness_enabled end |
#max_tokens(value = nil) ⇒ Integer (readonly)
Set maximum tokens
84 85 86 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 84 def max_tokens @max_tokens end |
#model_name ⇒ Object (readonly)
Returns the value of attribute model_name.
39 40 41 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 39 def model_name @model_name end |
#presence_penalty(value = nil) ⇒ Float (readonly)
Set presence penalty
124 125 126 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 124 def presence_penalty @presence_penalty end |
#prompt_template_level ⇒ Object (readonly)
Returns the value of attribute prompt_template_level.
39 40 41 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 39 def prompt_template_level @prompt_template_level end |
#stop_sequences ⇒ Object (readonly)
Returns the value of attribute stop_sequences.
39 40 41 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 39 def stop_sequences @stop_sequences end |
#system_prompt(prompt = nil) ⇒ String (readonly)
Set system prompt for chat mode
64 65 66 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 64 def system_prompt @system_prompt end |
#temperature(value = nil) ⇒ Float (readonly)
Set temperature parameter
74 75 76 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 74 def temperature @temperature end |
#top_p(value = nil) ⇒ Float (readonly)
Set top_p parameter
104 105 106 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 104 def top_p @top_p end |
Instance Method Details
#context_injection(level = nil) ⇒ Symbol Also known as: context
Set the context injection level for conversations
Controls how much operational context is injected into ongoing conversations.
Available levels:
- :none - No context injection
- :minimal - Basic status only
- :standard - Standard operational context (default)
- :detailed - Full context with metrics
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 186 def context_injection(level = nil) return @context_injection_level if level.nil? valid_levels = [:none, :minimal, :standard, :detailed] unless valid_levels.include?(level) raise ArgumentError, "Invalid context level: #{level}. Must be one of: #{valid_levels.join(', ')}" end @context_injection_level = level end |
#enable_identity_awareness(enabled = nil) ⇒ Boolean Also known as: enabled
Enable or disable identity awareness and context injection
When enabled, the system prompt will be dynamically enhanced with agent identity, operational context, and environment information.
147 148 149 150 151 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 147 def enable_identity_awareness(enabled = nil) return @identity_awareness_enabled if enabled.nil? @identity_awareness_enabled = enabled end |
#identity_awareness { ... } ⇒ Object
Configure identity awareness with options block
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 207 def identity_awareness(&block) if block_given? instance_eval(&block) else { enabled: @identity_awareness_enabled, prompt_template: @prompt_template_level, context_injection: @context_injection_level } end end |
#model(name = nil) ⇒ String
Set model name exposed in API
94 95 96 97 98 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 94 def model(name = nil) return @model_name if name.nil? @model_name = name end |
#prompt_template(level = nil) ⇒ Symbol Also known as: template
Set the prompt template level for context injection
Available levels:
- :minimal - Basic agent identity only
- :standard - Identity + basic operational context (default)
- :detailed - Full context with capabilities
- :comprehensive - All available context and guidelines
163 164 165 166 167 168 169 170 171 172 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 163 def prompt_template(level = nil) return @prompt_template_level if level.nil? valid_levels = [:minimal, :standard, :detailed, :comprehensive] unless valid_levels.include?(level) raise ArgumentError, "Invalid template level: #{level}. Must be one of: #{valid_levels.join(', ')}" end @prompt_template_level = level end |
#stop(sequences = nil) ⇒ Array<String>
Set stop sequences
134 135 136 137 138 |
# File 'lib/language_operator/dsl/chat_endpoint_definition.rb', line 134 def stop(sequences = nil) return @stop_sequences if sequences.nil? @stop_sequences = sequences end |