activeagent 0.5.0rc3 → 0.5.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: 0f3087fa32e11e33dd1f48e093a8d92b38e11264bf403faa65f4a57c8e3b2a4b
4
- data.tar.gz: 57ce989b2279b23d56ab3b40eba65877ec336bc056cc375f869b1caf301aad2f
3
+ metadata.gz: a16cb39db946881080e40bdf640106d6e3251cc7a80b8e77a036b7f815b9e9e3
4
+ data.tar.gz: e41d8b9560fc8dabe3caf5c79c67a094fe5d2196a810e30a5ed58c9428b9e158
5
5
  SHA512:
6
- metadata.gz: 25c0437d878f5c2452276614c23c868dfdcec6667906e546b13176916fd12edd30ae4f6c21296ad3a724f5382e82a71a84594b4563165076aa5b50c52b98f7a2
7
- data.tar.gz: 0cef9d5c876bf9d235c0090dfd4d873da3d0508c8c77820c70d408df2595eae7d3e167ffe65644ebcc7faa5b5e361be81c56446ad5c106877a2d651407a6d8a9
6
+ metadata.gz: dc64e5b15aff61f1504a995c9cd79a9e62203b219c833fac56164ee2e127e6688363a3262b20786edf6ef70a34eff11f3fa9c89986e9428452a8a13ed2cbad28
7
+ data.tar.gz: 297263095bf29d165bc298edccf20bccd606bf5c8f64107b9bceca91f82eb53b2c31b3707b844830e8aea004402210f903707d106443b4e49b4222eb728a6ffe
@@ -304,9 +304,9 @@ module ActiveAgent
304
304
 
305
305
  def prompt(headers = {}, &block)
306
306
  return context if @_prompt_was_called && headers.blank? && !block
307
+ # Apply option hierarchy: prompt options > agent options > config options
308
+ merged_options = merge_options(headers[:options] || {})
307
309
 
308
- # Apply option hierarchy: prompt options > agent > config options
309
- merged_options = merge_options(headers)
310
310
  raw_instructions = headers.has_key?(:instructions) ? headers[:instructions] : context.options[:instructions]
311
311
 
312
312
  context.instructions = prepare_instructions(raw_instructions)
@@ -403,9 +403,8 @@ module ActiveAgent
403
403
  # Extract runtime options from prompt_options (exclude instructions as it has special template logic)
404
404
  runtime_options = prompt_options.slice(
405
405
  :model, :temperature, :max_tokens, :stream, :top_p, :frequency_penalty,
406
- :presence_penalty, :response_format, :seed, :stop, :tools_choice, :user
406
+ :presence_penalty, :response_format, :seed, :stop, :tools_choice
407
407
  )
408
-
409
408
  # Handle explicit options parameter
410
409
  explicit_options = prompt_options[:options] || {}
411
410
 
@@ -535,7 +534,6 @@ module ActiveAgent
535
534
  end
536
535
 
537
536
  def prepare_instructions(instructions)
538
- binding.irb
539
537
  case instructions
540
538
  when Hash
541
539
  raise ArgumentError, "Expected `:template` key in instructions hash" unless instructions[:template]
@@ -32,7 +32,7 @@ module ActiveAgent
32
32
  def chat_prompt(parameters: prompt_parameters)
33
33
  parameters[:stream] = provider_stream if prompt.options[:stream] || config["stream"]
34
34
 
35
- chat_response(@client.messages(parameters))
35
+ chat_response(@client.messages(parameters: parameters))
36
36
  end
37
37
 
38
38
  private
@@ -51,8 +51,11 @@ module ActiveAgent
51
51
  end
52
52
 
53
53
  def prompt_parameters(model: @prompt.options[:model] || @model_name, messages: @prompt.messages, temperature: @prompt.options[:temperature] || @config["temperature"] || 0.7, tools: @prompt.actions)
54
+ # fix for new Anthropic API that requires messages to be in a specific format without system role
55
+ messages = messages.reject { |m| m.role == :system }
54
56
  params = {
55
57
  model: model,
58
+ system: @prompt.options[:instructions],
56
59
  messages: provider_messages(messages),
57
60
  temperature: temperature,
58
61
  max_tokens: @prompt.options[:max_tokens] || @config["max_tokens"] || 4096
@@ -68,9 +71,9 @@ module ActiveAgent
68
71
  def format_tools(tools)
69
72
  tools.map do |tool|
70
73
  {
71
- name: tool[:name] || tool[:function][:name],
72
- description: tool[:description],
73
- input_schema: tool[:parameters]
74
+ name: tool["name"] || tool["function"]["name"],
75
+ description: tool["description"] || tool["function"]["description"],
76
+ input_schema: tool["parameters"] || tool["function"]["parameters"]
74
77
  }
75
78
  end
76
79
  end
@@ -114,13 +117,13 @@ module ActiveAgent
114
117
  def chat_response(response)
115
118
  return @response if prompt.options[:stream]
116
119
 
117
- content = response.content.first[:text]
120
+ content = response["content"].first["text"]
118
121
 
119
122
  message = ActiveAgent::ActionPrompt::Message.new(
120
123
  content: content,
121
124
  role: "assistant",
122
- action_requested: response.stop_reason == "tool_use",
123
- requested_actions: handle_actions(response.tool_use)
125
+ action_requested: response["stop_reason"] == "tool_use",
126
+ requested_actions: handle_actions(response["tool_use"])
124
127
  )
125
128
 
126
129
  update_context(prompt: prompt, message: message, response: response)
@@ -15,12 +15,12 @@ module ActiveAgent
15
15
  module ClassMethods
16
16
  def with(params = {})
17
17
  # Separate runtime options from regular params
18
- runtime_options = params.extract!(:model, :temperature, :max_tokens, :stream, :top_p,
19
- :frequency_penalty, :presence_penalty, :response_format,
20
- :seed, :stop, :tools_choice, :user)
18
+ # runtime_options = params.extract!(:model, :temperature, :max_tokens, :stream, :top_p,
19
+ # :frequency_penalty, :presence_penalty, :response_format,
20
+ # :seed, :stop, :tools_choice, :user)
21
21
 
22
- # Pass runtime options as :options parameter
23
- params[:options] = runtime_options if runtime_options.any?
22
+ # # Pass runtime options as :options parameter
23
+ # params[:options] = runtime_options if runtime_options.any?
24
24
 
25
25
  ActiveAgent::Parameterized::Agent.new(self, params)
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveAgent
2
- VERSION = "0.5.0rc3"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeagent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0rc3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Bowen