-
Notifications
You must be signed in to change notification settings - Fork 17.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google VertexAI InvalidArgument: 400 Request contains an invalid argument
#30428
Closed
5 tasks done
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
investigate
Flagged for investigation.
Comments
Can you provide a minimal reproducible example? from langchain_google_vertexai import ChatVertexAI
llm = ChatVertexAI(model="gemini-1.5-flash-001")
await llm.ainvoke("hi") |
I think you have to use / go through |
This is the minimum I can put together: import os, vertexai, asyncio, logging
from dotenv import load_dotenv
from datetime import datetime
from langchain.chat_models import init_chat_model
from langgraph.prebuilt import ToolNode, tools_condition, create_react_agent, InjectedStore
from langgraph.checkpoint.memory import MemorySaver
from langgraph.store.memory import InMemoryStore
from langchain_core.runnables import RunnableConfig
load_dotenv()
from src.rag_agent.Tools import TOOLS
async def main():
llm = init_chat_model("gemini-2.0-flash", model_provider="google_vertexai", streaming=True).bind_tools(TOOLS)
agent = create_react_agent(llm, store=InMemoryStore(), tools=TOOLS, checkpointer=MemorySaver(), name="RAG ReAct Agent")
config = RunnableConfig(run_name="RAG ReAct Agent", thread_id=datetime.now())
messages = ["What is the standard method for Task Decomposition?", "Once you get the answer, look up common extensions of that method."]
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()
if __name__ == "__main__":
vertexai.init(project=os.environ.get("GOOGLE_CLOUD_PROJECT"), location=os.environ.get("GOOGLE_CLOUD_LOCATION"))
asyncio.run(main()) Running it:
Full-blown code: https://github.com/khteh/rag-agent/blob/master/src/rag_agent/RAGAgent.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
investigate
Flagged for investigation.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
Any call to Google VertexAI with
ainvoke
,astream
,with_structured_output
hits that error.System Info
The text was updated successfully, but these errors were encountered: