I'm trying to retrieve extracts from documents stored in a Vertex AI Search data store. I added a tool to achieve this but I cannot get it to work at all. I already implemented similar functionaility with the AmazonKnowledgeBasesRetriever which works just fine. I also have no issues accessing the Gemini LLM.
When I create a bot with GEMINI and select Vertex AI Search as the tool I get the following error:
opengpts-backend | Traceback (most recent call last):
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 85, in __await__
opengpts-backend | response = yield from self._call.__await__()
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/grpc/aio/_call.py", line 318, in __await__
opengpts-backend | raise _create_rpc_error(
opengpts-backend | grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
opengpts-backend | status = StatusCode.INVALID_ARGUMENT
opengpts-backend | details = "Request contains an invalid argument."
opengpts-backend | debug_error_string = "UNKNOWN:Error received from peer ipv4:142.250.179.234:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-02-26T09:54:26.213732631+00:00"}"
opengpts-backend | >
opengpts-backend |
opengpts-backend | The above exception was the direct cause of the following exception:
opengpts-backend |
opengpts-backend | Traceback (most recent call last):
opengpts-backend | File "/backend/app/stream.py", line 101, in to_sse
opengpts-backend | async for chunk in messages_stream:
opengpts-backend | File "/backend/app/stream.py", line 35, in astream_messages
opengpts-backend | async for event in app.astream_events(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4157, in astream_events
opengpts-backend | async for item in self.bound.astream_events(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 889, in astream_events
opengpts-backend | async for log in _astream_log_implementation( # type: ignore[misc]
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/tracers/log_stream.py", line 612, in _astream_log_implementation
opengpts-backend | await task
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/tracers/log_stream.py", line 566, in consume_astream
opengpts-backend | async for chunk in runnable.astream(input, config, **kwargs):
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/configurable.py", line 199, in astream
opengpts-backend | async for chunk in runnable.astream(input, config, **kwargs):
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/configurable.py", line 199, in astream
opengpts-backend | async for chunk in runnable.astream(input, config, **kwargs):
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4144, in astream
opengpts-backend | async for item in self.bound.astream(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4144, in astream
opengpts-backend | async for item in self.bound.astream(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 659, in astream
opengpts-backend | async for chunk in self.atransform(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 677, in atransform
opengpts-backend | async for chunk in self._atransform_stream_with_config(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1595, in _atransform_stream_with_config
opengpts-backend | chunk: Output = await asyncio.create_task( # type: ignore[call-arg]
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/tracers/log_stream.py", line 237, in tap_output_aiter
opengpts-backend | async for chunk in output:
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 525, in _atransform
opengpts-backend | _interrupt_or_proceed(done, inflight, step)
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 700, in _interrupt_or_proceed
opengpts-backend | raise exc
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 838, in _aconsume
opengpts-backend | async for _ in iterator:
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4144, in astream
opengpts-backend | async for item in self.bound.astream(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2449, in astream
opengpts-backend | async for chunk in self.atransform(input_aiter(), config, **kwargs):
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2432, in atransform
opengpts-backend | async for chunk in self._atransform_stream_with_config(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1595, in _atransform_stream_with_config
opengpts-backend | chunk: Output = await asyncio.create_task( # type: ignore[call-arg]
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/tracers/log_stream.py", line 237, in tap_output_aiter
opengpts-backend | async for chunk in output:
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2402, in _atransform
opengpts-backend | async for output in final_pipeline:
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/passthrough.py", line 269, in atransform
opengpts-backend | async for chunk in self._atransform_stream_with_config(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1560, in _atransform_stream_with_config
opengpts-backend | final_input: Optional[Input] = await py_anext(input_for_tracing, None)
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/utils/aiter.py", line 62, in anext_impl
opengpts-backend | return await __anext__(iterator)
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/utils/aiter.py", line 97, in tee_peer
opengpts-backend | item = await iterator.__anext__()
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4180, in atransform
opengpts-backend | async for item in self.bound.atransform(
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1071, in atransform
opengpts-backend | async for output in self.astream(final, config, **kwargs):
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 266, in astream
opengpts-backend | await self.ainvoke(input, config=config, stop=stop, **kwargs),
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 186, in ainvoke
opengpts-backend | llm_result = await self.agenerate_prompt(
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 554, in agenerate_prompt
opengpts-backend | return await self.agenerate(
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 514, in agenerate
opengpts-backend | raise exceptions[0]
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 617, in _agenerate_with_cache
opengpts-backend | return await self._agenerate(
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/langchain_google_vertexai/chat_models.py", line 464, in _agenerate
opengpts-backend | response = await chat.send_message_async(
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/vertexai/generative_models/_generative_models.py", line 870, in _send_message_async
opengpts-backend | response = await self._model._generate_content_async(
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/vertexai/generative_models/_generative_models.py", line 469, in _generate_content_async
opengpts-backend | gapic_response = await self._prediction_async_client.generate_content(
opengpts-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py", line 1658, in generate_content
opengpts-backend | response = await rpc(
opengpts-backend | ^^^^^^^^^^
opengpts-backend | File "/usr/local/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 88, in __await__
opengpts-backend | raise exceptions.from_grpc_error(rpc_error) from rpc_error
opengpts-backend | google.api_core.exceptions.InvalidArgument: 400 Request contains an invalid argument.
I've worked through the stack trace and tried various things. I've updated libraries etc as well, but always get the same error and can't figure it out. Documentation on usage of this module is pretty light right now as well.
I'm trying to retrieve extracts from documents stored in a Vertex AI Search data store. I added a tool to achieve this but I cannot get it to work at all. I already implemented similar functionaility with the AmazonKnowledgeBasesRetriever which works just fine. I also have no issues accessing the Gemini LLM.
tools.py:
When I create a bot with GEMINI and select Vertex AI Search as the tool I get the following error:
I've worked through the stack trace and tried various things. I've updated libraries etc as well, but always get the same error and can't figure it out. Documentation on usage of this module is pretty light right now as well.
Not sure if this is a bug, or me being simple?