Skip to content

Conversation

littlechu
Copy link

OpenAI can report tool_calls: null. Which causes OpenAI assistant to raise exceptions due to the following check:

raise ArgumentError, "Tool calls must be an array of hashes" unless tool_calls.is_a?(Array) && tool_calls.all? { |tool_call| tool_call.is_a?(Hash) }

This fix is to make the check consider nil as an empty array. This change is related to #1011

dependabot bot and others added 4 commits July 8, 2025 15:51
…atterns-ai-core#998)

Updates the requirements on [cohere-ruby](https://github.com/andreibondarev/cohere-ruby) to permit the latest version.
- [Release notes](https://github.com/andreibondarev/cohere-ruby/releases)
- [Changelog](https://github.com/patterns-ai-core/cohere-ruby/blob/main/CHANGELOG.md)
- [Commits](patterns-ai-core/cohere-ruby@0.9.10...1.0.1)

---
updated-dependencies:
- dependency-name: cohere-ruby
  dependency-version: 1.0.1
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Since tool invocation from assistant is expected to be limited to public methods,
`public_send` is used instead of `send` to avoid unintended invocation of private method.

Co-authored-by: Sergio Bayona <bayona.sergio@gmail.com>
@littlechu
Copy link
Author

issue seem to have fix with gem update for some of the require library. But I think the code should deal with the case where tool_calls being pass in as nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants