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

Getting TypeError when accessing language/use-cases/document-qa/question_answering_documentai_vector_store_palm.ipynb #313

Open
SampathkumarSubramaniam opened this issue Dec 20, 2023 · 2 comments
Assignees

Comments

@SampathkumarSubramaniam
Copy link

SampathkumarSubramaniam commented Dec 20, 2023

Hello,
Getting below error when accessing https://github.com/GoogleCloudPlatform/generative-ai/blob/main/language/use-cases/document-qa/question_answering_documentai_vector_store_palm.ipynb

Exact code:

@retry(wait=wait_random_exponential(min=10, max=120), stop=stop_after_attempt(5))
def embedding_model_with_backoff(text=[]):
    **embeddings = embedding_model.get_embeddings(text)**
    return [each.values for each in embeddings][0]

Error log:

 File /lib/python3.11/site-packages/vertexai/language_models/_language_models.py", line 1724, in _prepare_text_embedding_request
    raise TypeError(f"Unsupported text embedding input type: {text}.")
TypeError: Unsupported text embedding input type: nan.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

    pdf_data_sample["embedding"] =["chunks"].apply(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Could you help to fix?

@holtskinner
Copy link
Collaborator

@SampathkumarSubramaniam Can you provide the input document that caused the issue? (With any PII redacted)
This issue seems to be because the text sent to the embeddings model was empty

@holtskinner holtskinner changed the title Getting TypeError when accessing https://github.com/GoogleCloudPlatform/generative-ai/blob/main/language/use-cases/document-qa/question_answering_documentai_vector_store_palm.ipynb Getting TypeError when accessing language/use-cases/document-qa/question_answering_documentai_vector_store_palm.ipynb Jan 10, 2024
@jwchoiKR
Copy link

pdf_data_sample = pdf_data_sample.dropna(subset=['chunks'])

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

No branches or pull requests

3 participants