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, #from, #id, #replies_to, #role, #timestamp, #tokens

Instance Method Summary collapse

Methods inherited from Message

#as_json, #for_logs, #to_s

Constructor Details

#initializeBotMessage

Returns a new instance of BotMessage.



65
66
67
68
# File 'lib/open_ai/message.rb', line 65

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

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/open_ai/message.rb', line 70

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