From 4218196dfedacc241071be6c6885632e0f3802f0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:17:24 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../jupyter_ai/callback_handlers/metadata.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py b/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py index 783af6362..c409a9633 100644 --- a/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py +++ b/packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py @@ -1,16 +1,17 @@ -import json import inspect +import json from langchain_core.callbacks import BaseCallbackHandler from langchain_core.outputs import LLMResult + def requires_no_arguments(func): sig = inspect.signature(func) for param in sig.parameters.values(): if param.default is param.empty and param.kind in ( - param.POSITIONAL_ONLY, - param.POSITIONAL_OR_KEYWORD, - param.KEYWORD_ONLY + param.POSITIONAL_ONLY, + param.POSITIONAL_OR_KEYWORD, + param.KEYWORD_ONLY, ): return False return True @@ -50,8 +51,5 @@ def on_llm_end(self, response: LLMResult, **kwargs) -> None: # Convert any non-serializable objects in metadata self.jai_metadata = json.loads( - json.dumps( - metadata, - default=convert_to_serializable - ) + json.dumps(metadata, default=convert_to_serializable) )