mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
fix(vertex_ai): read message roles by subscript in the prefix check
m.get on the message union reported Unknown member types against the repo-wide type gate; role is required on every AllMessageValues shape, so subscript access is both typed and safe here.
This commit is contained in:
parent
cef76f7c75
commit
b58633fbd1
1 changed files with 1 additions and 3 deletions
|
|
@ -147,9 +147,7 @@ def separate_cached_messages(
|
|||
prefix_messages: Final = messages[:first_cached_idx]
|
||||
suffix_messages: Final = messages[last_cached_idx + 1 :]
|
||||
|
||||
if any(m.get("role") != "system" for m in prefix_messages) or any(
|
||||
m.get("role") == "system" for m in suffix_messages
|
||||
):
|
||||
if any(m["role"] != "system" for m in prefix_messages) or any(m["role"] == "system" for m in suffix_messages):
|
||||
# Not a true prefix: send the conversation uncached so nothing is
|
||||
# reordered and no system message is silently dropped.
|
||||
return [], list(messages)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue