There is a chance that the model returns an AI message with the content being a list, AIMessage(content=[], tool_calls=[...]).
When involving this message in the conversation, the tool calls gets trimmed out. It runs into the if block on line 83 because the content type is list and never gets into the elif block for the tool call on line 141.
There is a chance that the model returns an AI message with the content being a
list
,AIMessage(content=[], tool_calls=[...])
.When involving this message in the conversation, the tool calls gets trimmed out. It runs into the
if
block on line83
because the content type islist
and never gets into theelif
block for the tool call on line141
.https://github.com/langchain-ai/langchain-google/blob/af44de36cb82277bb5e535e6c2ba968c5b52a18d/libs/vertexai/langchain_google_vertexai/_anthropic_utils.py#L83-L141
This will eventually get into a bad request error.