Add tests for duplicate detection logic
Added 13 tests to verify that duplicate detection only catches IMMEDIATELY SEQUENTIAL duplicates: - test_find_complete_json_object_end_* - Tests for JSON parsing helper - test_same_tool_with_text_between_not_duplicate - Key test ensuring tool calls separated by text are NOT duplicates - test_different_tools_back_to_back_not_duplicate - test_same_tool_different_args_not_duplicate - test_identical_tool_calls_back_to_back_are_duplicates - test_has_text_after_tool_call - Tests text detection logic - test_tool_call_with_newlines_between - test_tool_call_with_whitespace_text_between - test_tool_call_in_middle_of_text - test_multiple_different_tool_calls_with_text Also made find_complete_json_object_end public for testing.
This commit is contained in:
@@ -534,7 +534,8 @@ impl StreamingToolParser {
|
||||
|
||||
/// Find the end position (byte index) of a complete JSON object in the text
|
||||
/// Returns None if no complete JSON object is found
|
||||
fn find_complete_json_object_end(text: &str) -> Option<usize> {
|
||||
/// Find the end position (byte index) of a complete JSON object in the text
|
||||
pub fn find_complete_json_object_end(text: &str) -> Option<usize> {
|
||||
let mut brace_count = 0;
|
||||
let mut in_string = false;
|
||||
let mut escape_next = false;
|
||||
|
||||
Reference in New Issue
Block a user