Class: ComposableAgents::AiAgents::Tools::GetArtifactTool
- Inherits:
-
BaseTool
- Object
- Agents::Tool
- BaseTool
- ComposableAgents::AiAgents::Tools::GetArtifactTool
- Defined in:
- lib/composable_agents/ai_agents/tools/get_artifact_tool.rb
Overview
Tool that is used to read an artifact's content
Internal collapse
-
#initialize(artifacts, logger: ComposableAgents::Logger.instance) ⇒ GetArtifactTool
constructor
Constructor.
-
#perform(_tool_context, name:) ⇒ String
Perform the tool's action.
Constructor Details
#initialize(artifacts, logger: ComposableAgents::Logger.instance) ⇒ GetArtifactTool
Constructor
16 17 18 19 |
# File 'lib/composable_agents/ai_agents/tools/get_artifact_tool.rb', line 16 def initialize(artifacts, logger: ComposableAgents::Logger.instance) super(logger:) @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) @logger.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 |