Skip to content

fix(mistral): type check errors in client.py #1977

@jxnl

Description

@jxnl

Description

Type checking is failing in instructor/providers/mistral/client.py with 54 diagnostics related to passing **kwargs to the Mistral client's complete() and stream() methods.

Error Details

The type checker reports invalid-argument-type errors when passing **kwargs to client.chat.complete(*args, **kwargs) and client.chat.stream(*args, **kwargs).

Sample errors:

  • Expected str | list[str] | list[int] | None, found dict[str, Any] for messages parameter
  • Expected str | None, found dict[str, Any] for model parameter
  • Expected int | float | None, found dict[str, Any] for various numeric parameters
  • Expected bool | None, found dict[str, Any] for boolean parameters

Location

instructor/providers/mistral/client.py:77-78

Impact

  • Blocking type checking in CI
  • Not affecting runtime behavior
  • 54 type diagnostics total

Suggested Fix

Need to properly type the wrapper function or use type: ignore comments with appropriate justification. The **kwargs pattern may need to be replaced with explicit parameter passing or proper Protocol/TypedDict definitions.

Related

This is blocking CI on PR #1947 and potentially other PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions