Class: OpenAI::BotMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/open_ai/message.rb

Instance Attribute Summary

Attributes inherited from Message

#body, #chat_id, #chat_thread, #cost, #from, #id, #image, #replies_to, #role, #timestamp

Instance Method Summary collapse

Methods inherited from Message

#as_json, #for_logs, #to_s

Constructor Details

#initializeBotMessage

Returns a new instance of BotMessage.



77
78
79
80
# File 'lib/open_ai/message.rb', line 77

def initialize(...)
  super(...)
  @role = :assistant
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/open_ai/message.rb', line 82

def valid?
  [body, id, chat_id, chat_thread].all?(&:present?)
end