Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(custom code): update decorator to ignore missing arguments #564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading