最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

py langchain - Google VertexAI InvalidArgument: 400 Request contains an invalid argument - Stack Overflow

programmeradmin2浏览0评论

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!

发布评论

评论列表(0)

  1. 暂无评论