pub fn parse_partial_arguments(text: &str) -> Map<String, Value>Expand description
The best object a tool call’s argument text states so far, for showing a
call while it streams. It never fails: complete JSON parses as is, text
with raw control characters or invalid escapes is repaired first, a
cut-off prefix keeps the longest object it states
([parse_partial_object]), and anything else is an empty object, as is
a top level that is not an object.
It is for display only. A call’s arguments are what its end states, and only those are validated and executed.
use rig_core::streaming::parse_partial_arguments;
let partial = parse_partial_arguments(r#"{"path": "notes.md", "content": "Hel"#);
assert_eq!(partial["path"], "notes.md");
assert_eq!(partial["content"], "Hel");