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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a12fa00f68f2dcc889d91017ac8a009796089b19ab81908cdbd1e33f24f9cea
4
- data.tar.gz: cb1ed8fc426ed31e51b0796e5deb7f570410a562b7d579eb0e486046d3fb4d2c
3
+ metadata.gz: a72ac8e976da462e8a77ff8b50641acfab95fa061daacf1f38a70d5ca25dc80a
4
+ data.tar.gz: 61b3595c0ef91fa70dfa776ef6deddce257c96098146a94deb902d0705a483bd
5
5
  SHA512:
6
- metadata.gz: bf6939777a18aa2a00b213373bb3400cf17be976422bb412ef665405f5b2b2281978e025b88231816d3433c4ac2d52793aafd046372ae608a6ba6e6d70e8f771
7
- data.tar.gz: 274e161fc65dd2e5f36a5c552a0e086576470505011aee2ce9713669a027e81b7e1c964e3638dca835f432b60a6a9282c2eaca72e7b2086bf469e6d6c72b35d2
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 or block)
551
+ # Resolves a prompt from DSL configuration (template string)
552
552
  #
553
- # For string templates, interpolates {placeholder} with parameter values.
554
- # For blocks, evaluates in the instance context.
553
+ # Interpolates {placeholder} patterns with parameter values.
555
554
  #
556
- # @param config [String, Proc] The prompt configuration
555
+ # @param config [String] The prompt template
557
556
  # @return [String] The resolved prompt
558
557
  def resolve_prompt_from_config(config)
559
- case config
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
@@ -4,6 +4,6 @@ module RubyLLM
4
4
  module Agents
5
5
  # Current version of the RubyLLM::Agents gem
6
6
  # @return [String] Semantic version string
7
- VERSION = "2.2.0"
7
+ VERSION = "3.0.0"
8
8
  end
9
9
  end
@@ -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 || @prompt_template || @prompt_block || inherited_or_default(:user_config, nil)
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, Proc, nil] The user template, or nil
104
+ # @return [String, nil] The user template, or nil
105
105
  def user_config
106
- @user_template || @prompt_template || @prompt_block || inherited_or_default(:user_config, nil)
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
- # @yield Block that returns the prompt string (evaluated at execution time)
114
- # @return [String, Proc, nil] The current prompt configuration
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 || @prompt_template || @prompt_block || inherited_or_default(:user_config, nil)
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, Proc, nil] The prompt template, block, or nil
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
- # @yield Block that returns the system prompt (evaluated at execution time)
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, &block)
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 || @system_block || inherited_or_default(:system_config, nil)
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, Proc, nil] The system template, block, or nil
163
+ # @return [String, nil] The system template, or nil
166
164
  def system_config
167
- @system_template || @system_block || inherited_or_default(:system_config, nil)
165
+ @system_template || inherited_or_default(:system_config, nil)
168
166
  end
169
167
 
170
168
  # Sets the assistant prefill string
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm-agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - adham90