mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-02 07:13:02 +00:00
fix(cohere): strongly type mapping parameters and drop unused helper branch
This commit is contained in:
parent
fd0723c0da
commit
a0a4300f0e
2 changed files with 8 additions and 13 deletions
|
|
@ -261,11 +261,6 @@ def remove_index_from_tool_calls(
|
|||
for tool_call in _tool_calls:
|
||||
if isinstance(tool_call, dict) and "index" in tool_call: # Type guard to ensure it's a dict
|
||||
tool_call.pop("index", None)
|
||||
elif hasattr(tool_call, "index"):
|
||||
try:
|
||||
delattr(tool_call, "index")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def remove_items_at_indices(items: list[Any] | None, indices: Iterable[int]) -> None:
|
||||
|
|
|
|||
|
|
@ -170,10 +170,10 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
|
|||
self,
|
||||
model: str,
|
||||
messages: list[AllMessageValues],
|
||||
optional_params: dict,
|
||||
litellm_params: dict,
|
||||
headers: dict,
|
||||
) -> dict:
|
||||
optional_params: dict[str, object],
|
||||
litellm_params: dict[str, object],
|
||||
headers: dict[str, object],
|
||||
) -> dict[str, object]:
|
||||
data: Final = super().transform_request(model, messages, optional_params, litellm_params, headers)
|
||||
messages_to_send: Final = data.get("messages")
|
||||
if messages_to_send is not None:
|
||||
|
|
@ -185,10 +185,10 @@ class CohereV2ChatConfig(OpenAIGPTConfig):
|
|||
self,
|
||||
model: str,
|
||||
messages: list[AllMessageValues],
|
||||
optional_params: dict,
|
||||
litellm_params: dict,
|
||||
headers: dict,
|
||||
) -> dict:
|
||||
optional_params: dict[str, object],
|
||||
litellm_params: dict[str, object],
|
||||
headers: dict[str, object],
|
||||
) -> dict[str, object]:
|
||||
data: Final = await super().async_transform_request(model, messages, optional_params, litellm_params, headers)
|
||||
messages_to_send: Final = data.get("messages")
|
||||
if messages_to_send is not None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue