Skip to content

Conversation

@plusor
Copy link

@plusor plusor commented Jan 26, 2026

…unction..."

When merging streaming deltas, delta was converted with as_json.deep_symbolize_keys, which left tool_calls[].type as the string "function". hash_merge_delta concatenates when the existing value is a String (hash[key] += value), so each chunk appended "function" and produced "functionfunctionfunction...".

  • Use delta.deep_to_h so the gem returns symbol-keyed hashes with :type => :function. Merges then hit the replace branch and type stays :function.
  • Match when :function in process_function_calls for consistency.

…unction..."

When merging streaming deltas, delta was converted with as_json.deep_symbolize_keys, which left tool_calls[].type as the string "function". hash_merge_delta concatenates when the existing value is a String (hash[key] += value), so each chunk appended "function" and produced "functionfunctionfunction...".

- Use delta.deep_to_h so the gem returns symbol-keyed hashes with :type => :function. Merges then hit the replace branch and type stays :function.
- Match when :function in process_function_calls for consistency.
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.

1 participant