We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I attempted to pass list[litellm.DeploymentTypedDict] to the litellm.Router as a parameter. That doesn't really work, unfortunately, as shown below.
list[litellm.DeploymentTypedDict]
I would perhaps rather type it as
list[DeploymentTypedDict] | list[dict[Any, Any]] | None
...: error: Argument "model_list" to "Router" has incompatible type "list[DeploymentTypedDict]"; expected "list[DeploymentTypedDict | dict[Any, Any]] | None" [arg-type]
### Twitter / LinkedIn details _No response_
The text was updated successfully, but these errors were encountered:
hey @fingon can you share your sample code for repro'ing the typing error?
Sorry, something went wrong.
Given this ,litellm.py:
,litellm.py
import litellm model_list: list[litellm.DeploymentTypedDict] = [ { "model_name": "gpt-3.5-turbo", "litellm_params": { "model": "azure/gpt-35-turbo", "api_key": "x", "api_version": "y", "api_base": "z", }, }, ] router = litellm.Router(model_list=model_list)
Shell action:
mstenber@koneko ~>python3 --version Python 3.11.9 mstenber@koneko ~>mypy --version mypy 1.10.0 (compiled: yes) mstenber@koneko ~>mypy ,litellm.py ,litellm.py:30: error: Argument "model_list" to "Router" has incompatible type "list[DeploymentTypedDict]"; expected "list[DeploymentTypedDict | dict[Any, Any]] | None" [arg-type] ,litellm.py:30: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance ,litellm.py:30: note: Consider using "Sequence" instead, which is covariant Found 1 error in 1 file (checked 1 source file)
Note that your typing should really use Sequence instead of list too, as it is covariant.
Sequence
list
No branches or pull requests
What happened?
I attempted to pass
list[litellm.DeploymentTypedDict]
to the litellm.Router as a parameter. That doesn't really work, unfortunately, as shown below.I would perhaps rather type it as
Relevant log output
The text was updated successfully, but these errors were encountered: