Class: Google::ADK::ToolContext
- Inherits:
-
CallbackContext
- Object
- ReadonlyContext
- CallbackContext
- Google::ADK::ToolContext
- Defined in:
- lib/google/adk/context.rb
Overview
Context for tool execution
Instance Attribute Summary collapse
-
#artifact_service ⇒ Object
readonly
Returns the value of attribute artifact_service.
-
#auth_service ⇒ Object
readonly
Returns the value of attribute auth_service.
-
#memory_service ⇒ Object
readonly
Returns the value of attribute memory_service.
Attributes inherited from CallbackContext
Attributes inherited from ReadonlyContext
#agent_name, #invocation_id, #state
Instance Method Summary collapse
-
#initialize(invocation_id:, agent_name:, session:, auth_service: nil, artifact_service: nil, memory_service: nil) ⇒ ToolContext
constructor
Initialize tool context.
-
#list_artifacts ⇒ Array
List artifacts.
-
#request_auth(auth_type, **options) ⇒ Object
Request authentication.
-
#search_memory(query) ⇒ Array
Search memory.
Methods inherited from CallbackContext
Constructor Details
#initialize(invocation_id:, agent_name:, session:, auth_service: nil, artifact_service: nil, memory_service: nil) ⇒ ToolContext
Initialize tool context
102 103 104 105 106 107 108 |
# File 'lib/google/adk/context.rb', line 102 def initialize(invocation_id:, agent_name:, session:, auth_service: nil, artifact_service: nil, memory_service: nil) super(invocation_id: invocation_id, agent_name: agent_name, session: session) @auth_service = auth_service @artifact_service = artifact_service @memory_service = memory_service end |
Instance Attribute Details
#artifact_service ⇒ Object (readonly)
Returns the value of attribute artifact_service.
92 93 94 |
# File 'lib/google/adk/context.rb', line 92 def artifact_service @artifact_service end |
#auth_service ⇒ Object (readonly)
Returns the value of attribute auth_service.
92 93 94 |
# File 'lib/google/adk/context.rb', line 92 def auth_service @auth_service end |
#memory_service ⇒ Object (readonly)
Returns the value of attribute memory_service.
92 93 94 |
# File 'lib/google/adk/context.rb', line 92 def memory_service @memory_service end |
Instance Method Details
#list_artifacts ⇒ Array
List artifacts
123 124 125 126 127 |
# File 'lib/google/adk/context.rb', line 123 def list_artifacts return [] unless @artifact_service @artifact_service.list_artifacts end |
#request_auth(auth_type, **options) ⇒ Object
Request authentication
114 115 116 117 118 |
# File 'lib/google/adk/context.rb', line 114 def request_auth(auth_type, **) raise AgentError, "Auth service not available" unless @auth_service @auth_service.request_auth(auth_type, ) end |
#search_memory(query) ⇒ Array
Search memory
133 134 135 136 137 |
# File 'lib/google/adk/context.rb', line 133 def search_memory(query) return [] unless @memory_service @memory_service.search(query) end |