Class: AgentHarness::Api::ChatTransport::Execution
- Inherits:
-
Object
- Object
- AgentHarness::Api::ChatTransport::Execution
- Defined in:
- lib/agent_harness/api/chat_transport.rb
Overview
Holds mutable state for exactly one request, keeping the transport reusable.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(request, adapter:, id_generator:, sleeper:, observer:) ⇒ Execution
constructor
A new instance of Execution.
Constructor Details
#initialize(request, adapter:, id_generator:, sleeper:, observer:) ⇒ Execution
Returns a new instance of Execution.
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/agent_harness/api/chat_transport.rb', line 43 def initialize(request, adapter:, id_generator:, sleeper:, observer:) @request = symbolize(request) @adapter = adapter @id_generator = id_generator @sleeper = sleeper @observer = observer @attempts = [] @sequence = 0 @partial_content = +"" @stream_tool_calls = {} @tool_ids = {} validate! end |
Instance Method Details
#call ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/agent_harness/api/chat_transport.rb', line 57 def call return unsupported_schema_result unless schema_mode_supported? return cancelled_result unless active? candidates.each_with_index do |candidate, candidate_index| result = attempt_candidate(candidate, candidate_index) return result if terminal?(result) end failed_result(@last_error, @last_candidate) end |