mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
chore(mistral): annotate the tool_choice parameter as a read-only mapping
The type-discipline gate counts a `dict[...]` annotation as a mutable collection handed to a caller, and the parameter only ever reads its argument. The runtime check that decides what reaches the mapper stays `isinstance(value, (str, dict))`, so nothing but the annotation moves.
This commit is contained in:
parent
cbc83e3c01
commit
7987a1fae5
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ Why separate file? Make it easy to see how transformation works
|
|||
Docs - https://docs.mistral.ai/api/
|
||||
"""
|
||||
|
||||
from collections.abc import AsyncIterator, Coroutine, Iterator
|
||||
from collections.abc import AsyncIterator, Coroutine, Iterator, Mapping
|
||||
from typing import TYPE_CHECKING, Any, Final, Literal, cast, get_type_hints, overload
|
||||
|
||||
import httpx
|
||||
|
|
@ -112,7 +112,7 @@ class MistralConfig(OpenAIGPTConfig):
|
|||
return supported_params
|
||||
|
||||
@staticmethod
|
||||
def _map_tool_choice(tool_choice: str | dict[str, object]) -> str | ChatCompletionToolChoiceObjectParam | None:
|
||||
def _map_tool_choice(tool_choice: str | Mapping[str, object]) -> str | ChatCompletionToolChoiceObjectParam | None:
|
||||
match tool_choice:
|
||||
case "auto" | "none":
|
||||
return tool_choice
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue