From cb94047b468b7bc2855701abe233ff429a0c246d Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Fri, 23 May 2025 15:22:32 -0700 Subject: [PATCH] Removed obsolete code I accidentally added in #1070 --- llm/cli.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/llm/cli.py b/llm/cli.py index 93e6e1f..3564dcd 100644 --- a/llm/cli.py +++ b/llm/cli.py @@ -3683,28 +3683,3 @@ def _gather_tools(tools, python_tools): ) tool_functions.extend(registered_tools[tool] for tool in tools) return tool_functions - - -def _stream_json(iterator, json_cols=None): - # We have to iterate two-at-a-time so we can know if we - # should output a trailing comma - json_cols = json_cols or () - current_iter, next_iter = itertools.tee(iterator, 2) - next(next_iter, None) - first = True - for row, next_row in itertools.zip_longest(current_iter, next_iter): - is_last = next_row is None - data = row - for col in json_cols: - row[col] = json.loads(row[col]) - line = ( - ("[" if first else " ") - + json.dumps(data, default=repr) - + ("," if not is_last else "") - + ("]" if is_last else "") - ) - yield line - first = False - if first: - # We didn't output any rows, so yield the empty list - yield "[]"