I am using Google VertexAI gemini-2.0-flash
with LangChain. I keep getting InvalidArgument: 400 Request contains an invalid argument
error when making ainvoke
, astream
and with_structured_output
to the APIs:
2025-03-22 15:57:08 WARNING Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.<locals>._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Unable to submit request because at least one contents field is required. Learn more: .
I have tried the following:
await email_parser_chain.ainvoke({"message": message})
await email_parser_chain.ainvoke({"message": [{"role": "user", "content": message}]}
async for event in agent.astream(
{"messages": [{"role": "user", "content": messages}]},
stream_mode="values", # Use this to stream all values in the state after each step.
config=config, # This is needed by Checkpointer
):
event["messages"][-1].pretty_print()
but to no avail!