Class: Phronomy::Agent::ContextCandidate
- Inherits:
-
Data
- Object
- Data
- Phronomy::Agent::ContextCandidate
- Defined in:
- lib/phronomy/agent/context_candidate.rb
Instance Attribute Summary collapse
-
#agent_id ⇒ Object
readonly
Returns the value of attribute agent_id.
-
#candidate_id ⇒ Object
readonly
Returns the value of attribute candidate_id.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#content_ref ⇒ Object
readonly
Returns the value of attribute content_ref.
-
#execution_id ⇒ Object
readonly
Returns the value of attribute execution_id.
-
#llm_call_id ⇒ Object
readonly
Returns the value of attribute llm_call_id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#record_id ⇒ Object
readonly
Returns the value of attribute record_id.
-
#requirement ⇒ Object
readonly
Returns the value of attribute requirement.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#sequence ⇒ Object
readonly
Returns the value of attribute sequence.
-
#source_kind ⇒ Object
readonly
Returns the value of attribute source_kind.
-
#tool_call_id ⇒ Object
readonly
Returns the value of attribute tool_call_id.
Instance Method Summary collapse
-
#initialize(**values) ⇒ ContextCandidate
constructor
A new instance of ContextCandidate.
Constructor Details
#initialize(**values) ⇒ ContextCandidate
Returns a new instance of ContextCandidate.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/phronomy/agent/context_candidate.rb', line 21 def initialize(**values) normalized = values.merge( candidate_id: values.fetch(:candidate_id).to_s.freeze, source_kind: values.fetch(:source_kind).to_sym, category: values.fetch(:category).to_sym, role: values[:role]&.to_sym, content_ref: values.fetch(:content_ref).to_s.freeze, record_id: values[:record_id]&.to_s&.freeze, agent_id: values[:agent_id]&.to_s&.freeze, execution_id: values[:execution_id]&.to_s&.freeze, llm_call_id: values[:llm_call_id]&.to_s&.freeze, tool_call_id: values[:tool_call_id]&.to_s&.freeze, sequence: values[:sequence] && Integer(values[:sequence]), requirement: (values[:requirement] || :optional).to_sym, priority: Integer(values[:priority] || 0), metadata: Immutable.copy(values[:metadata] || {}) ) unless %i[protocol_required declared_required optional].include?(normalized[:requirement]) raise ArgumentError, "unknown ContextCandidate requirement: #{normalized[:requirement].inspect}" end super(**normalized) freeze end |
Instance Attribute Details
#agent_id ⇒ Object (readonly)
Returns the value of attribute agent_id
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def agent_id @agent_id end |
#candidate_id ⇒ Object (readonly)
Returns the value of attribute candidate_id
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def candidate_id @candidate_id end |
#category ⇒ Object (readonly)
Returns the value of attribute category
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def category @category end |
#content_ref ⇒ Object (readonly)
Returns the value of attribute content_ref
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def content_ref @content_ref end |
#execution_id ⇒ Object (readonly)
Returns the value of attribute execution_id
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def execution_id @execution_id end |
#llm_call_id ⇒ Object (readonly)
Returns the value of attribute llm_call_id
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def llm_call_id @llm_call_id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def @metadata end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def priority @priority end |
#record_id ⇒ Object (readonly)
Returns the value of attribute record_id
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def record_id @record_id end |
#requirement ⇒ Object (readonly)
Returns the value of attribute requirement
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def requirement @requirement end |
#role ⇒ Object (readonly)
Returns the value of attribute role
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def role @role end |
#sequence ⇒ Object (readonly)
Returns the value of attribute sequence
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def sequence @sequence end |
#source_kind ⇒ Object (readonly)
Returns the value of attribute source_kind
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def source_kind @source_kind end |
#tool_call_id ⇒ Object (readonly)
Returns the value of attribute tool_call_id
5 6 7 |
# File 'lib/phronomy/agent/context_candidate.rb', line 5 def tool_call_id @tool_call_id end |