Skip to content

[BUG] Multiple simultaneous tool calls behaves unexpectedly and causes error #236

@finbarr

Description

@finbarr

Basic checks

  • I searched existing issues - this hasn't been reported
  • I can reproduce this consistently
  • This is a RubyLLM bug, not my application code

What's broken?

I created a super simple demo here: https://github.com/finbarr/multi-tool-demo

If the LLM returns multiple tool calls with a single message, RubyLLM tries to execute each sequentially but makes intermediate calls back to the LLM after each one, rather than running them all and then making a callback to the LLM. Somewhere along the way it breaks with

'RubyLLM::ErrorMiddleware.parse_error': messages: text content blocks must be non-empty (RubyLLM::BadRequestError)

How to reproduce

Expected behavior

  • RubyLLM should call each tool, aggregate the results, then make a callback to the LLM with all of the tool results.
  • It shouldn't break.

What actually happened

  • RubyLLM calls the tools one at a time and tries to return the results individually to the LLM.
  • It breaks.

Environment

  • ruby 3.4.3
  • rails 8.0.2
  • ruby_llm 1.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions