Class: ComposableAgents::AiAgents::Tools::GetArtifactTool
- Inherits:
-
Agents::Tool
- Object
- Agents::Tool
- ComposableAgents::AiAgents::Tools::GetArtifactTool
- Includes:
- Mixins::Logger
- Defined in:
- lib/composable_agents/ai_agents/tools/get_artifact_tool.rb
Overview
Tool that is used to read an artifact's content
Instance Method Summary collapse
-
#initialize(artifacts) ⇒ GetArtifactTool
constructor
Constructor.
-
#perform(_tool_context, name:) ⇒ String
Perform the tool's action.
Methods included from Mixins::Logger
Constructor Details
#initialize(artifacts) ⇒ GetArtifactTool
Constructor
16 17 18 19 |
# File 'lib/composable_agents/ai_agents/tools/get_artifact_tool.rb', line 16 def initialize(artifacts) super() @artifacts = artifacts end |
Instance Method Details
#perform(_tool_context, name:) ⇒ String
Perform the tool's action. This is called by ai-agents when the model requires it.
27 28 29 30 31 32 33 34 35 |
# File 'lib/composable_agents/ai_agents/tools/get_artifact_tool.rb', line 27 def perform(_tool_context, name:) name_sym = name.to_sym if @artifacts.key?(name_sym) log_debug "Artifact `#{name}` read successfully." @artifacts[name_sym].to_s.strip else "[ERROR] No artifact named #{name}, don't call this tool with the name #{name} anymore." end end |