Skip to content

text definition have logic problem in the class GenerationResponse #6218

@anlexN

Description

@anlexN

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: Debian GNU/Linux forky/sid
  • Python version: 3.12.10
  • pip version: 25.0.1
  • google-cloud-aiplatform version: 1.132.0

Steps to reproduce

  1. run https://github.com/GoogleCloudPlatform/applied-ai-engineering-samples/blob/main/genai-on-vertex-ai/gemini/prompting_recipes/pdf_processing/1_extract_pdf_pages_with_gemini.ipynb

Code example

In the 1_extract_pdf_pages_with_gemini.ipynb:

with open(pdf_path, "rb") as f:
    pdf_bytes = f.read()
pages = pdf_pages(question=question, pdf_bytes=pdf_bytes)
print(pages)

Stack trace

Traceback (most recent call last):
  File "/mnt/e/workspace/github.com/anlexN/applied-ai-engineering-samples/genai-on-vertex-ai/gemini/prompting_recipes/pdf_processing/untitled.py", line 162, in <module>
    pages = pdf_pages(question=question, pdf_bytes=pdf_bytes)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/e/workspace/github.com/anlexN/applied-ai-engineering-samples/genai-on-vertex-ai/gemini/prompting_recipes/pdf_processing/untitled.py", line 147, in pdf_pages
    output_json = json.loads(responses.text)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anlexn/.pyenv/versions/3.12.10/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anlexn/.pyenv/versions/3.12.10/lib/python3.12/json/decoder.py", line 338, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/anlexn/.pyenv/versions/3.12.10/lib/python3.12/json/decoder.py", line 356, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have opened pull request, please review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: vertex-aiIssues related to the googleapis/python-aiplatform API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions