ruby_llm-agents 2.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ruby_llm/agents/base_agent.rb +4 -12
- data/lib/ruby_llm/agents/core/version.rb +1 -1
- data/lib/ruby_llm/agents/dsl/base.rb +17 -19
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a72ac8e976da462e8a77ff8b50641acfab95fa061daacf1f38a70d5ca25dc80a
|
|
4
|
+
data.tar.gz: 61b3595c0ef91fa70dfa776ef6deddce257c96098146a94deb902d0705a483bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c3827e5607ba8376976a84048ae2a9486fe5797720c8842e371ad3793190aaa2a8ec6bea0015b94cbb1c34c8bd516502a6a052dca823e68b5291665d5ae63b8
|
|
7
|
+
data.tar.gz: 6ac84e773905ee65d8ca0f482633247fb7254c64a13b3b25d83698503a9c70f70070a3ceb1127fc8d96271611e4270616030b1f64837c431b4553991b3038209
|
|
@@ -548,22 +548,14 @@ module RubyLLM
|
|
|
548
548
|
end
|
|
549
549
|
end
|
|
550
550
|
|
|
551
|
-
# Resolves a prompt from DSL configuration (template string
|
|
551
|
+
# Resolves a prompt from DSL configuration (template string)
|
|
552
552
|
#
|
|
553
|
-
#
|
|
554
|
-
# For blocks, evaluates in the instance context.
|
|
553
|
+
# Interpolates {placeholder} patterns with parameter values.
|
|
555
554
|
#
|
|
556
|
-
# @param config [String
|
|
555
|
+
# @param config [String] The prompt template
|
|
557
556
|
# @return [String] The resolved prompt
|
|
558
557
|
def resolve_prompt_from_config(config)
|
|
559
|
-
|
|
560
|
-
when String
|
|
561
|
-
interpolate_template(config)
|
|
562
|
-
when Proc
|
|
563
|
-
instance_eval(&config)
|
|
564
|
-
else
|
|
565
|
-
config.to_s
|
|
566
|
-
end
|
|
558
|
+
interpolate_template(config)
|
|
567
559
|
end
|
|
568
560
|
|
|
569
561
|
# Interpolates {placeholder} patterns in a template string
|
|
@@ -96,36 +96,37 @@ module RubyLLM
|
|
|
96
96
|
@user_template = template
|
|
97
97
|
auto_register_params_from_template(template)
|
|
98
98
|
end
|
|
99
|
-
@user_template ||
|
|
99
|
+
@user_template || inherited_or_default(:user_config, nil)
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# Returns the user prompt configuration
|
|
103
103
|
#
|
|
104
|
-
# @return [String,
|
|
104
|
+
# @return [String, nil] The user template, or nil
|
|
105
105
|
def user_config
|
|
106
|
-
@user_template ||
|
|
106
|
+
@user_template || inherited_or_default(:user_config, nil)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
# Backward-compatible alias for `user`
|
|
110
110
|
#
|
|
111
|
-
# @deprecated Use `user` instead
|
|
111
|
+
# @deprecated Use `user` instead.
|
|
112
112
|
# @param template [String, nil] Prompt template with {placeholder} syntax
|
|
113
|
-
# @
|
|
114
|
-
|
|
115
|
-
def prompt(template = nil, &block)
|
|
113
|
+
# @return [String, nil] The current prompt configuration
|
|
114
|
+
def prompt(template = nil)
|
|
116
115
|
if template
|
|
116
|
+
Deprecations.warn(
|
|
117
|
+
"`prompt` is deprecated. Use `user` instead (e.g., `user \"#{template.truncate(40)}\"`).",
|
|
118
|
+
caller
|
|
119
|
+
)
|
|
117
120
|
@user_template = template
|
|
118
121
|
auto_register_params_from_template(template)
|
|
119
|
-
elsif block
|
|
120
|
-
@prompt_block = block
|
|
121
122
|
end
|
|
122
|
-
@user_template ||
|
|
123
|
+
@user_template || inherited_or_default(:user_config, nil)
|
|
123
124
|
end
|
|
124
125
|
|
|
125
126
|
# Returns the prompt configuration (alias for user_config)
|
|
126
127
|
#
|
|
127
128
|
# @deprecated Use `user_config` instead
|
|
128
|
-
# @return [String,
|
|
129
|
+
# @return [String, nil] The prompt template, or nil
|
|
129
130
|
def prompt_config
|
|
130
131
|
user_config
|
|
131
132
|
end
|
|
@@ -136,8 +137,7 @@ module RubyLLM
|
|
|
136
137
|
# parameter interpolation, same as the `user` DSL.
|
|
137
138
|
#
|
|
138
139
|
# @param text [String, nil] System instructions for the LLM
|
|
139
|
-
# @
|
|
140
|
-
# @return [String, Proc, nil] The current system prompt
|
|
140
|
+
# @return [String, nil] The current system prompt
|
|
141
141
|
#
|
|
142
142
|
# @example Static system prompt
|
|
143
143
|
# system "You are a helpful assistant. Be concise and accurate."
|
|
@@ -150,21 +150,19 @@ module RubyLLM
|
|
|
150
150
|
# "You are helping #{user_name}. Today is #{Date.today}."
|
|
151
151
|
# end
|
|
152
152
|
#
|
|
153
|
-
def system(text = nil
|
|
153
|
+
def system(text = nil)
|
|
154
154
|
if text
|
|
155
155
|
@system_template = text
|
|
156
156
|
auto_register_params_from_template(text)
|
|
157
|
-
elsif block
|
|
158
|
-
@system_block = block
|
|
159
157
|
end
|
|
160
|
-
@system_template ||
|
|
158
|
+
@system_template || inherited_or_default(:system_config, nil)
|
|
161
159
|
end
|
|
162
160
|
|
|
163
161
|
# Returns the system prompt configuration
|
|
164
162
|
#
|
|
165
|
-
# @return [String,
|
|
163
|
+
# @return [String, nil] The system template, or nil
|
|
166
164
|
def system_config
|
|
167
|
-
@system_template ||
|
|
165
|
+
@system_template || inherited_or_default(:system_config, nil)
|
|
168
166
|
end
|
|
169
167
|
|
|
170
168
|
# Sets the assistant prefill string
|