Class: Ollama::Handlers::Say
- Inherits:
-
Object
- Object
- Ollama::Handlers::Say
- Includes:
- Concern
- Defined in:
- lib/ollama/handlers/say.rb
Instance Attribute Summary
Attributes included from Concern
Instance Method Summary collapse
- #call(response) ⇒ Object
-
#initialize(output: nil, voice: 'Samantha') ⇒ Say
constructor
A new instance of Say.
Methods included from Concern
Constructor Details
#initialize(output: nil, voice: 'Samantha') ⇒ Say
Returns a new instance of Say.
6 7 8 9 10 |
# File 'lib/ollama/handlers/say.rb', line 6 def initialize(output: nil, voice: 'Samantha') output ||= IO.popen(Shellwords.join([ 'say', '-v', voice ]), 'w') super(output:) @output.sync = true end |
Instance Method Details
#call(response) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ollama/handlers/say.rb', line 12 def call(response) if content = response.response || response.&.content @output.print content end response.done and @output.close self end |