mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-29 06:33:28 +00:00
fix(utils): explicitly type new_messages list to clear reportUnknownArgumentType
The Final=[] annotation let basedpyright infer the list type from appended values, which introduced one new reportUnknownArgumentType error past the project ceiling. Using an explicit list[AllMessageValues] annotation and casting the cleanup return value makes the type explicit and removes the ambiguity.
This commit is contained in:
parent
71eb804d76
commit
c91106b258
1 changed files with 2 additions and 2 deletions
|
|
@ -8425,7 +8425,7 @@ def validate_and_fix_openai_messages(messages: list[Any]):
|
|||
|
||||
Handles missing role for assistant messages.
|
||||
"""
|
||||
new_messages: Final = []
|
||||
new_messages: list[AllMessageValues] = []
|
||||
for message in messages:
|
||||
# Copy before mutating: assigning dicts into a pydantic Message's
|
||||
# tool_calls triggers PydanticSerializationUnexpectedValue warnings on
|
||||
|
|
@ -8446,7 +8446,7 @@ def validate_and_fix_openai_messages(messages: list[Any]):
|
|||
),
|
||||
)
|
||||
cleaned_message = cleanup_none_field_in_message(message=convert_msg_to_dict)
|
||||
new_messages.append(cleaned_message)
|
||||
new_messages.append(cast(AllMessageValues, cleaned_message))
|
||||
return validate_chat_completion_user_messages(messages=new_messages)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue