ai-agents 0.4.1 → 0.4.3

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: 5790a2b3414db7145124415d82571707270563e6c8e9f5ea15dc744cb861a2ae
4
- data.tar.gz: 30cc3c836bb3df9de4ebc88f6e7c80907646d3998e21d66a114523df538d8835
3
+ metadata.gz: a3f2287a007ce187c91546ee4ef723cadcde40e7102454d4d432c2c2c72e4e45
4
+ data.tar.gz: 4c9b810362d923c0fb821491a63fa8647c926e2666e6902383200ca8f988cf10
5
5
  SHA512:
6
- metadata.gz: 5b464b77e77ba64509dd7a2e4370f1f0e87494ceaa5161fbaa63cef1862e04f78a1b57a5e389e9d297f7272913978719ada9bc4d2831dc04c99eaf7b67ac5d5a
7
- data.tar.gz: 9174870568c28280f4d3a72e06f2bd53243d118f2122ddfd6ba48e88c540b4504527562f44393798566661563e5ee28a12f82b3321745e44bf46b2cbc4b66c58
6
+ metadata.gz: aaa5ba1612a2551b83d3f779a10301c806f9a95eb082b4c6ab6db56fdc90487093b0a5edd0c5edc16c2a4888e1ada2abc66433bab73c569886b3b66f0c41d528
7
+ data.tar.gz: 2669853cd34f497d696fba2ccf02ed384057ea144b7ffdd0c390aa28c1c4bf830929723f181a0bfd130e206707fc80f9c2a0e12259da53099ef8ab92c5f681d8
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.3] - 2025-08-04
9
+
10
+ ### Fixed
11
+ - **Schema Parameter Passing**: Fixed issue where response schema parameters were not being properly passed through in agent conversations
12
+ - Ensured schema configuration flows correctly through the agent execution pipeline
13
+ - Improved parameter handling for structured output validation
14
+
15
+ ## [0.4.2] - 2025-08-04
16
+
17
+ ### Fixed
18
+ - **Structured Output Conversation History**: Fixed crash when restoring conversation history containing Hash content from structured output responses
19
+ - Runner and MessageExtractor now properly handle Hash content without calling `.strip()` method
20
+ - Added `MessageExtractor.content_empty?` utility method to handle both String and Hash content types
21
+
8
22
  ## [0.4.1] - 2025-08-04
9
23
 
10
24
  ### Fixed
data/lib/agents/chat.rb CHANGED
@@ -51,6 +51,8 @@ module Agents
51
51
  temperature: @temperature,
52
52
  model: @model.id,
53
53
  connection: @connection,
54
+ params: @params,
55
+ schema: @schema,
54
56
  &block
55
57
  )
56
58
  @on[:end_message]&.call(response)
@@ -17,6 +17,21 @@ module Agents
17
17
  # { role: :tool, content: "Result", tool_call_id: "call_123" }
18
18
  # ]
19
19
  class MessageExtractor
20
+ # Check if content is considered empty (handles both String and Hash content)
21
+ #
22
+ # @param content [String, Hash, nil] The content to check
23
+ # @return [Boolean] true if content is empty, false otherwise
24
+ def self.content_empty?(content)
25
+ case content
26
+ when String
27
+ content.strip.empty?
28
+ when Hash
29
+ content.empty?
30
+ else
31
+ content.nil?
32
+ end
33
+ end
34
+
20
35
  # Extract messages from a chat object for conversation history persistence
21
36
  #
22
37
  # @param chat [Object] Chat object that responds to :messages
@@ -47,7 +62,7 @@ module Agents
47
62
  private
48
63
 
49
64
  def extract_user_or_assistant_message(msg)
50
- return nil unless msg.content && !msg.content.strip.empty?
65
+ return nil unless msg.content && !self.class.content_empty?(msg.content)
51
66
 
52
67
  message = {
53
68
  role: msg.role,
data/lib/agents/runner.rb CHANGED
@@ -200,7 +200,7 @@ module Agents
200
200
  history.each do |msg|
201
201
  # Only restore user and assistant messages with content
202
202
  next unless %i[user assistant].include?(msg[:role].to_sym)
203
- next unless msg[:content] && !msg[:content].strip.empty?
203
+ next unless msg[:content] && !MessageExtractor.content_empty?(msg[:content])
204
204
 
205
205
  chat.add_message(
206
206
  role: msg[:role].to_sym,
@@ -228,8 +228,6 @@ module Agents
228
228
 
229
229
  # Clean up temporary handoff state
230
230
  context_wrapper.context.delete(:pending_handoff)
231
- rescue StandardError => e
232
- puts "[Agents] Failed to save conversation state: #{e.message}"
233
231
  end
234
232
 
235
233
  def create_chat(agent, context_wrapper)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Agents
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai-agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shivam Mishra