Skip to content

Commit

Permalink
fix(custom code): update decorator to ignore missing arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-bot authored Aug 20, 2024
1 parent 12f543f commit 797f48c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cohere/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def fn(*args, **kwargs):
# `deprecated_kwarg` is the name of the experimental parameter, which can be a dot-separated string for nested parameters
def experimental_kwarg_decorator(func, deprecated_kwarg):
# Recursive utility function to check if a kwarg is present in the kwargs.
def check_kwarg(deprecated_kwarg: str, kwargs: typing.Dict[str, typing.Any]) -> bool:
def check_kwarg(deprecated_kwarg: str, kwargs: typing.Optional[typing.Dict[str, typing.Any]]) -> bool:
if kwargs is None:
return False
if "." in deprecated_kwarg:
key, rest = deprecated_kwarg.split(".", 1)
if key in kwargs:
Expand Down

0 comments on commit 797f48c

Please sign in to comment.