[X] I used the GitHub search to try to find a similar issue and didn't find one.
[X] I searched the Marvin documentation for this issue.
Bug summary
format_step() is missing a branch for tool_call.type == "file_search"
Reproduction
from marvin.beta import Assistant
from marvin.beta.assistants import FileSearch
def main() -> int:
ai = Assistant(
tools=[FileSearch]
)
ai.say(" ")
return 0
Error
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\tmp\marvin-bug\.venv\Scripts\marvin-bug.exe\__main__.py", line 8, in <module>
File "C:\tmp\marvin-bug\src\marvin_bug\__init__.py", line 8, in main
ai.say(" ")
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\utilities\asyncio.py", line 193, in sync_wrapper
return run_sync(coro)
^^^^^^^^^^^^^^
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\utilities\asyncio.py", line 106, in run_sync
return context.run(asyncio.run, coroutine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\philipp.wirtenberger\scoop\persist\rye\py\cpython@3.12.2\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\philipp.wirtenberger\scoop\persist\rye\py\cpython@3.12.2\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\philipp.wirtenberger\scoop\persist\rye\py\cpython@3.12.2\Lib\asyncio\base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\assistants.py", line 131, in say_async
result = await run.run_async()
^^^^^^^^^^^^^^^^^^^^^
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\runs.py", line 225, in run_async
await stream.until_done()
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\openai\lib\streaming\_assistants.py", line 533, in until_done
await consume_async_iterator(self)
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\openai\_utils\_streams.py", line 11, in consume_async_iterator
async for _ in iterator:
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\openai\lib\streaming\_assistants.py", line 500, in __aiter__
async for item in self._iterator:
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\openai\lib\streaming\_assistants.py", line 836, in __stream__
await self._emit_sse_event(event)
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\openai\lib\streaming\_assistants.py", line 804, in _emit_sse_event
await self.on_run_step_delta(
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\handlers.py", line 46, in on_run_step_delta
self.print_run()
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\handlers.py", line 26, in print_run
panels = format_run(
^^^^^^^^^^^
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\formatting.py", line 256, in format_run
objects.extend([(format_step(s), s.created_at) for s in run.steps])
^^^^^^^^^^^^^^
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\formatting.py", line 144, in format_step
return _cached_format_step(step.model_dump_json())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\tmp\marvin-bug\.venv\Lib\site-packages\marvin\beta\assistants\formatting.py", line 136, in _cached_format_step
panels.append(panel)
^^^^^
UnboundLocalError: cannot access local variable 'panel' where it is not associated with a value
First check
Bug summary
format_step()
is missing a branch fortool_call.type == "file_search"
Reproduction
Error
Versions
Additional context
No response