Class: Google::ADK::FunctionResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/google/adk/events.rb

Overview

Represents a function response in an event

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, response:, is_error: false) ⇒ FunctionResponse

Initialize a function response

Parameters:

  • id (String)

    ID of the function call this responds to

  • name (String)

    Function name

  • response (Hash)

    Function response

  • is_error (Boolean) (defaults to: false)

    Whether this is an error response



46
47
48
49
50
51
# File 'lib/google/adk/events.rb', line 46

def initialize(id:, name:, response:, is_error: false)
  @id = id
  @name = name
  @response = response
  @is_error = is_error
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



38
39
40
# File 'lib/google/adk/events.rb', line 38

def id
  @id
end

#is_errorObject (readonly)

Returns the value of attribute is_error.



38
39
40
# File 'lib/google/adk/events.rb', line 38

def is_error
  @is_error
end

#nameObject (readonly)

Returns the value of attribute name.



38
39
40
# File 'lib/google/adk/events.rb', line 38

def name
  @name
end

#responseObject (readonly)

Returns the value of attribute response.



38
39
40
# File 'lib/google/adk/events.rb', line 38

def response
  @response
end

Instance Method Details

#to_hHash

Convert to hash

Returns:

  • (Hash)

    Hash representation



56
57
58
59
60
61
62
63
# File 'lib/google/adk/events.rb', line 56

def to_h
  {
    id: @id,
    name: @name,
    response: @response,
    is_error: @is_error
  }
end