From 037ba3dcdfbabd0bbe307f71e4d96d0b7b6e4209 Mon Sep 17 00:00:00 2001 From: "David L. Qiu" Date: Mon, 23 Sep 2024 15:57:09 -0700 Subject: [PATCH] default to empty dict if no generation_info --- packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 {}