Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and dlqqq committed Dec 5, 2024
1 parent 99301a8 commit 4218196
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/jupyter-ai/jupyter_ai/callback_handlers/metadata.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
)

0 comments on commit 4218196

Please sign in to comment.