Class: Vangrail::Conversation::Turn

Inherits:
Struct
  • Object
show all
Defined in:
lib/vangrail/conversation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultObject

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



29
30
31
# File 'lib/vangrail/conversation.rb', line 29

def result
  @result
end

#roleObject

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



29
30
31
# File 'lib/vangrail/conversation.rb', line 29

def role
  @role
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



29
30
31
# File 'lib/vangrail/conversation.rb', line 29

def text
  @text
end

Instance Method Details

#blocked?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/vangrail/conversation.rb', line 30

def blocked?
  result&.blocked? || false
end

#to_hObject



38
39
40
# File 'lib/vangrail/conversation.rb', line 38

def to_h
  { 'role' => role.to_s, 'text' => text, 'result' => result&.to_h }.compact
end

#user?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/vangrail/conversation.rb', line 34

def user?
  role == :user
end