Skip to content

Commit 0e73d77

Browse files
authored
Add template methods in Agent (#16)
1 parent e97d770 commit 0e73d77

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/mars/agent.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ def initialize(name:, options: {}, tools: [], schema: nil, instructions: nil)
1313
end
1414

1515
def run(input)
16-
chat.ask(input).content
16+
processed_input = before_run(input)
17+
response = chat.ask(processed_input).content
18+
after_run(response)
1719
end
1820

1921
private
@@ -26,5 +28,13 @@ def chat
2628
.with_tools(*tools)
2729
.with_schema(schema)
2830
end
31+
32+
def before_run(input)
33+
input
34+
end
35+
36+
def after_run(response)
37+
response
38+
end
2939
end
3040
end

0 commit comments

Comments
 (0)