async-openai
async-openai copied to clipboard
examples/tool-call-stream: Duplicates tool arguments
I think this:
https://github.com/64bit/async-openai/blob/b26346d3efaeb9861259cd0f2e9c8b8f87793148/examples/tool-call-stream/src/main.rs#L82-L86
and this:
https://github.com/64bit/async-openai/blob/b26346d3efaeb9861259cd0f2e9c8b8f87793148/examples/tool-call-stream/src/main.rs#L90-L96
store the arguments to a tool call twice. The later call to parse
https://github.com/64bit/async-openai/blob/b26346d3efaeb9861259cd0f2e9c8b8f87793148/examples/tool-call-stream/src/main.rs#L225
fails:
thread 'tokio-runtime-worker' panicked at src/bin/tool-call-stream.rs:243:57:
called `Result::unwrap()` on an `Err` value: Error("trailing characters", line: 1, column: 23)
and printing out args at that point shows
args={"location":"Boston, MA"}{"location":"Boston, MA"}
args={"location":"Atlanta, GA"}{"location":"Atlanta, GA"}
Commenting out the second args storing with push_str fixes the problem.