Skip to content

Commit 2dd04e2

Browse files
committed
agent: different approach
1 parent 89a232e commit 2dd04e2

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

mrblib/mruby-llm/agent.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ def self.tools(*tools, &block)
7272
# Returns the current skills when no argument is provided
7373
def self.skills(*skills, &block)
7474
return @skills if skills.empty? && !block
75-
@skills = block || skills.flatten
75+
if skills.size == 1 and skills.grep(Symbol).any?
76+
@skills = skills.first
77+
else
78+
@skills = block || skills.flatten
79+
end
7680
end
7781

7882
##
@@ -160,7 +164,11 @@ def self.tracer(tracer = nil, &block)
160164
# @return [Array<String>, Proc, nil]
161165
def self.confirm(*tool_names, &block)
162166
return @confirm if tool_names.empty? && !block
163-
@confirm = block || tool_names.flatten
167+
if tool_names.size == 1 and tool_names.grep(Symbol).any?
168+
@confirm = tool_names.first
169+
else
170+
@confirm = block || tool_names.flatten
171+
end
164172
end
165173

166174
##

mrblib/mruby-llm/utils.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def resolve_option(obj, option, resolve_symbol: true)
3636
when Proc then obj.instance_exec(&option)
3737
when Symbol then resolve_symbol ? obj.send(option) : option
3838
when Hash then option.dup
39-
when Array then option.map { resolve_option(obj, _1, resolve_symbol:) }
4039
else option
4140
end
4241
end

0 commit comments

Comments
 (0)