I don't have enough time to debug, so I am not sure where exactly the problems is.
when using the very same prompt(a bit long) and code, ruby 3.1.3 works like a charm, and 3.2.x return a buggy result.
The buggy result means when I use client.stream_generate_content, it will have lots of duplicated chunk in the result.
I maybe found a workaround myself to downgrade faraday-net_http to (3.1.0) instead of default version in ruby 3.2.x is (3.4.0)