Class: OmniAI::Chat::Message::Builder
- Inherits:
-
Object
- Object
- OmniAI::Chat::Message::Builder
- Defined in:
- lib/omniai/chat/message/builder.rb
Overview
Used to build a message.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Message
- #file(io, type) ⇒ File
-
#initialize(role: Role::USER) ⇒ Builder
constructor
A new instance of Builder.
- #text(value) ⇒ Text
- #url(uri, type) ⇒ URL
Constructor Details
Class Method Details
.build(role:) {|builder| ... } ⇒ Message
10 11 12 13 14 |
# File 'lib/omniai/chat/message/builder.rb', line 10 def self.build(role:) builder = new(role:) yield(builder) builder.build end |
Instance Method Details
#build ⇒ Message
23 24 25 |
# File 'lib/omniai/chat/message/builder.rb', line 23 def build Message.new(content: @content, role: @role) end |
#file(io, type) ⇒ File
59 60 61 62 63 |
# File 'lib/omniai/chat/message/builder.rb', line 59 def file(io, type) File.new(io, type).tap do |file| @content << file end end |