Module: OllamaAgent::OllamaChatThinkingStreamPatch
- Defined in:
- lib/ollama_agent/ollama_chat_thinking_stream.rb
Overview
Prepends Ollama::Client::Chat to invoke optional hooks[:on_thinking] with each thinking chunk.
Instance Method Summary collapse
-
#process_chat_stream_chunk(obj, hooks, full_content, full_thinking, full_logprobs, last_data) ⇒ Object
rubocop:disable Metrics/ParameterLists – signature must match ollama-client.
Instance Method Details
#process_chat_stream_chunk(obj, hooks, full_content, full_thinking, full_logprobs, last_data) ⇒ Object
rubocop:disable Metrics/ParameterLists – signature must match ollama-client
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ollama_agent/ollama_chat_thinking_stream.rb', line 16 def process_chat_stream_chunk(obj, hooks, full_content, full_thinking, full_logprobs, last_data) normalize_stream_thinking_payload!(obj) parse_state = GemmaThoughtContentParser.extract_state(last_data) parse_state = extract_gemma_thought_from_stream_content!(obj, hooks, parse_state) emit_streaming_thinking(hooks, obj) ChatStreamCarry.(obj, last_data) carry = ChatStreamCarry.next_last_data(last_data, obj) GemmaThoughtContentParser.attach_state!(carry, parse_state) super(obj, hooks, full_content, full_thinking, full_logprobs, carry) end |