diff --git a/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py b/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py index fa4407afa..145cab313 100644 --- a/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py +++ b/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py @@ -23,4 +23,4 @@ def on_llm_end(self, response: LLMResult, **kwargs) -> None: if not (len(response.generations) and len(response.generations[0])): return - self.jai_metadata = response.generations[0][0].generation_info + self.jai_metadata = response.generations[0][0].generation_info or {}