-
Notifications
You must be signed in to change notification settings - Fork 322
Open
Description
I think this:
async-openai/examples/tool-call-stream/src/main.rs
Lines 82 to 86 in b26346d
arguments: tool_call_data | |
.function | |
.as_ref() | |
.and_then(|f| f.arguments.clone()) | |
.unwrap_or_default(), |
and this:
async-openai/examples/tool-call-stream/src/main.rs
Lines 90 to 96 in b26346d
if let Some(arguments) = tool_call_chunk | |
.function | |
.as_ref() | |
.and_then(|f| f.arguments.as_ref()) | |
{ | |
state.function.arguments.push_str(arguments); | |
} |
store the arguments to a tool call twice. The later call to parse
let function_args: serde_json::Value = args.parse().unwrap(); |
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.
Metadata
Metadata
Assignees
Labels
No labels