Skip to content
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

VertexAIEmbeddings error when passing a list with of length greater than 5. #5316

Closed
2 of 14 tasks
agvc opened this issue May 26, 2023 · 2 comments · Fixed by #5325
Closed
2 of 14 tasks

VertexAIEmbeddings error when passing a list with of length greater than 5. #5316

agvc opened this issue May 26, 2023 · 2 comments · Fixed by #5325

Comments

@agvc
Copy link

agvc commented May 26, 2023

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
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • 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

@Jflick58
Copy link
Contributor

This is a limit imposed by the Vertex API. I can implement pagination in the embed_documents call in order to avoid this error.

@Sadaf-Syeda
Copy link

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
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • 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

I am also facing same issue

hwchase17 added a commit that referenced this issue May 29, 2023
Fixes #5316

---------

Co-authored-by: Justin Flick <[email protected]>
Co-authored-by: Harrison Chase <[email protected]>
vowelparrot pushed a commit that referenced this issue May 31, 2023
Fixes #5316

---------

Co-authored-by: Justin Flick <[email protected]>
Co-authored-by: Harrison Chase <[email protected]>
jaclar added a commit to jaclar/langchainjs that referenced this issue Jun 8, 2023
As mentioned here: langchain-ai/langchain#5316
Vertex AI accepts 5 instances max when requesting text embeddings.
Undertone0809 pushed a commit to Undertone0809/langchain that referenced this issue Jun 19, 2023
Fixes langchain-ai#5316

---------

Co-authored-by: Justin Flick <[email protected]>
Co-authored-by: Harrison Chase <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants