mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-31 06:56:59 +00:00
fix(cohere): type the legacy request transformer boundary
Signed-off-by: Yusuf Efe <120668197+yuefdev@users.noreply.github.com>
This commit is contained in:
parent
b644900a64
commit
78eda98b6c
1 changed files with 6 additions and 6 deletions
|
|
@ -174,12 +174,12 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
|
|||
litellm_params: Mapping[str, object],
|
||||
headers: Mapping[str, object],
|
||||
) -> dict[str, object]:
|
||||
data: Final = super().transform_request(
|
||||
data: Final[dict[str, object]] = super().transform_request( # pyright: ignore[reportUnknownMemberType] # untyped parent dictionary contract
|
||||
model, list(messages), dict(optional_params), dict(litellm_params), dict(headers)
|
||||
)
|
||||
messages_to_send: Final = data.get("messages")
|
||||
messages_to_send: Final[Sequence[AllMessageValues] | None] = data.get("messages") # pyright: ignore[reportAssignmentType] # legacy dict erases the message-list type
|
||||
if messages_to_send is not None:
|
||||
litellm.remove_index_from_tool_calls(messages=messages_to_send)
|
||||
litellm.remove_index_from_tool_calls(messages=list(messages_to_send))
|
||||
|
||||
return data
|
||||
|
||||
|
|
@ -191,12 +191,12 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
|
|||
litellm_params: Mapping[str, object],
|
||||
headers: Mapping[str, object],
|
||||
) -> dict[str, object]:
|
||||
data: Final = await super().async_transform_request(
|
||||
data: Final[dict[str, object]] = await super().async_transform_request( # pyright: ignore[reportUnknownMemberType] # untyped parent dictionaries
|
||||
model, list(messages), dict(optional_params), dict(litellm_params), dict(headers)
|
||||
)
|
||||
messages_to_send: Final = data.get("messages")
|
||||
messages_to_send: Final[Sequence[AllMessageValues] | None] = data.get("messages") # pyright: ignore[reportAssignmentType] # legacy dict erases the message-list type
|
||||
if messages_to_send is not None:
|
||||
litellm.remove_index_from_tool_calls(messages=messages_to_send)
|
||||
litellm.remove_index_from_tool_calls(messages=list(messages_to_send))
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue