Class: Ollama::Handlers::Say
- Inherits:
-
Object
- Object
- Ollama::Handlers::Say
- Includes:
- Concern
- Defined in:
- lib/ollama/handlers/say.rb
Instance Attribute Summary collapse
-
#interactive ⇒ Object
readonly
Returns the value of attribute interactive.
-
#voice ⇒ Object
readonly
Returns the value of attribute voice.
Attributes included from Concern
Instance Method Summary collapse
- #call(response) ⇒ Object
-
#initialize(output: nil, voice: 'Samantha', interactive: nil) ⇒ Say
constructor
A new instance of Say.
Methods included from Concern
Constructor Details
#initialize(output: nil, voice: 'Samantha', interactive: nil) ⇒ Say
Returns a new instance of Say.
6 7 8 9 10 11 12 13 14 |
# File 'lib/ollama/handlers/say.rb', line 6 def initialize(output: nil, voice: 'Samantha', interactive: nil) @voice = voice @interactive = interactive super(output:) unless output @output = open_output @output_pid = @output.pid end end |
Instance Attribute Details
#interactive ⇒ Object (readonly)
Returns the value of attribute interactive.
18 19 20 |
# File 'lib/ollama/handlers/say.rb', line 18 def interactive @interactive end |
#voice ⇒ Object (readonly)
Returns the value of attribute voice.
16 17 18 |
# File 'lib/ollama/handlers/say.rb', line 16 def voice @voice end |
Instance Method Details
#call(response) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ollama/handlers/say.rb', line 20 def call(response) if @output.closed? wait_output_pid @output = open_output @output_pid = @output.pid end if content = response.response || response.&.content @output.print content end response.done and @output.close self end |