langchain
langchain copied to clipboard
VertexAIEmbeddings error when passing a list with of length greater than 5.
trafficstars
System Info
google-cloud-aiplatform==1.25.0 langchain==0.0.181 python 3.10
Who can help?
No response
Information
- [ ] The official example notebooks/scripts
- [X] My own modified scripts
Related Components
- [ ] LLMs/Chat Models
- [X] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async
Reproduction
Any list with len > 5 will cause an error.
from langchain.vectorstores import FAISS
from langchain.embeddings import VertexAIEmbeddings
text = ['text_1', 'text_2', 'text_3', 'text_4', 'text_5', 'text_6']
embeddings = VertexAIEmbeddings()
vectorstore = FAISS.from_texts(text, embeddings)
InvalidArgument Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py](https://localhost:8080/#) in error_remapped_callable(*args, **kwargs)
72 return callable_(*args, **kwargs)
73 except grpc.RpcError as exc:
---> 74 raise exceptions.from_grpc_error(exc) from exc
75
76 return error_remapped_callable
InvalidArgument: 400 5 instance(s) is allowed per prediction. Actual: 6
Expected behavior
Excepted to successfully be able to vectorize a larger list of items. Maybe implement a step to
This is a limit imposed by the Vertex API. I can implement pagination in the embed_documents call in order to avoid this error.
System Info
google-cloud-aiplatform==1.25.0 langchain==0.0.181 python 3.10
Who can help?
No response
Information
- [ ] The official example notebooks/scripts
- [x] My own modified scripts
Related Components
- [ ] LLMs/Chat Models
- [x] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async
Reproduction
Any list with len > 5 will cause an error.
from langchain.vectorstores import FAISS from langchain.embeddings import VertexAIEmbeddings text = ['text_1', 'text_2', 'text_3', 'text_4', 'text_5', 'text_6'] embeddings = VertexAIEmbeddings() vectorstore = FAISS.from_texts(text, embeddings)InvalidArgument Traceback (most recent call last) [/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py](https://localhost:8080/#) in error_remapped_callable(*args, **kwargs) 72 return callable_(*args, **kwargs) 73 except grpc.RpcError as exc: ---> 74 raise exceptions.from_grpc_error(exc) from exc 75 76 return error_remapped_callable InvalidArgument: 400 5 instance(s) is allowed per prediction. Actual: 6Expected behavior
Excepted to successfully be able to vectorize a larger list of items. Maybe implement a step to
I am also facing same issue