Class: OllamaChat::FollowChat
- Inherits:
-
Object
- Object
- OllamaChat::FollowChat
- Includes:
- Ollama, Ollama::Handlers::Concern, MessageFormat, Term::ANSIColor
- Defined in:
- lib/ollama_chat/follow_chat.rb
Instance Method Summary collapse
- #call(response) ⇒ Object
-
#initialize(chat:, messages:, voice: nil, output: STDOUT) ⇒ FollowChat
constructor
A new instance of FollowChat.
Methods included from MessageFormat
#message_type, #talk_annotate, #think_annotate
Constructor Details
#initialize(chat:, messages:, voice: nil, output: STDOUT) ⇒ FollowChat
Returns a new instance of FollowChat.
7 8 9 10 11 12 13 14 |
# File 'lib/ollama_chat/follow_chat.rb', line 7 def initialize(chat:, messages:, voice: nil, output: STDOUT) super(output:) @chat = chat @output.sync = true @say = voice ? Handlers::Say.new(voice:) : NOP @messages = @user = nil end |
Instance Method Details
#call(response) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ollama_chat/follow_chat.rb', line 16 def call(response) debug_output(response) if response&.&.role == 'assistant' ensure_assistant_response_exists (response) display_formatted_terminal_output @say.call(response) end output_eval_stats(response) self end |