Giter VIP home page Giter VIP logo

Comments (13)

singhniraj08 avatar singhniraj08 commented on July 29, 2024

@schnee, Thank you reporting this issue. "500 An internal error has occurred" error looks like an intermittent error and should work now.
This repository is for issues related to Gemini Python SDK bugs or improvements. For issues for feature requests related to Gemini API, we would suggest you to use "Send Feedback" option in Gemini docs. Ref: Screenshot below.

image

from generative-ai-python.

schnee avatar schnee commented on July 29, 2024

@singhniraj08 Thank you. For being intermittent, it happens to me every time, including 2 minutes ago. Can you share the MP4 you used to validate that it works for you?

I have ported over to the VertexAI Python SDK and am able to use it to process the same test case video.

from generative-ai-python.

MarkDaoust avatar MarkDaoust commented on July 29, 2024

We only announced video support in the API+SDK today, it's probably wasn't active when you tried it. Try again?

from generative-ai-python.

schnee avatar schnee commented on July 29, 2024

Thank you @MarkDaoust

I updated to google-ai-generativelanguage-0.6.3 google-generativeai-0.5.3 and am getting another error now.

But you answered my base question: did the SDK support video, and the answer was no. This issue can be closed. And I'll research the below stack trace and possibly open another ticket.

Traceback (most recent call last):
  File "/Users//projects//github/bw-impossible/creative_kitchen/mre.py", line 25, in <module>
    response = model.generate_content([prompt_part, asset_part],
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/generativeai/generative_models.py", line 262, in generate_content
    response = self._client.generate_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/client.py", line 812, in generate_content
    response = rpc(
               ^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
           ^^^^^^^^^^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/retry/retry_base.py", line 212, in _retry_error_helper
    raise final_exc from source_exc
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
             ^^^^^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users//Library/Caches/pypoetry/virtualenvs/bw-impossible-_xsmYHYG-py3.11/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 78, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InvalidArgument: 400 * GenerateContentRequest.generation_config.response_schema.type: field predicate failed: $ != TYPE_UNSPECIFIED

from generative-ai-python.

MarkDaoust avatar MarkDaoust commented on July 29, 2024

Video works. Try the cookbook video tutorial: https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Video.ipynb

GenerateContentRequest.generation_config.response_schema.type: field predicate failed: $ != TYPE_UNSPECIFIED

That error is about the generation_config.response_schema parameter. What did you pass it? I can't see in that paste.

from generative-ai-python.

schnee avatar schnee commented on July 29, 2024

@MarkDaoust - I literally updated the packages and reran the code from the top.

I'm good with someone (me?) closing this ticket, and I appreciate the pointers to make the code run.

from generative-ai-python.

Bikatr7 avatar Bikatr7 commented on July 29, 2024

@MarkDaoust - I literally updated the packages and reran the code from the top.

I'm good with someone (me?) closing this ticket, and I appreciate the pointers to make the code run.

You can close it yourself if you resolved the issue.

from generative-ai-python.

joja16 avatar joja16 commented on July 29, 2024

I encountered the error:
ValueError('The response.parts quick accessor only works for a single candidate, but none were returned. Check the response.prompt_feedback to see if the prompt was blocked.')

Has anyone encountered the same?
The video I uploaded was over 5 minutes long, here is my code:

safety_settings=[
    {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_NONE",
    },
    ]
video_file = genai.upload_file(path=filepath)
    
    while video_file.state.name == "PROCESSING":
        print('Waiting for video to be processed.')
        time.sleep(10)
        video_file_infos = genai.get_file(video_file.name)
        if video_file_infos.state.name == "ACTIVE":
            response = model.generate_content(['what is this?', video_file], safety_settings=safety_settings,
                                              request_options={"timeout": 600})
            
            genai.delete_file(video_file_infos.name)
            return response

from generative-ai-python.

MarkDaoust avatar MarkDaoust commented on July 29, 2024

Try printing the response object that you got back.

from generative-ai-python.

joja16 avatar joja16 commented on July 29, 2024

Thanks for your reply.
This is the response object I got back:
image

And I changed to async code:
image

from generative-ai-python.

joja16 avatar joja16 commented on July 29, 2024

I found out the reason. In my video which contains footage of creating a doll character, it started with creating body parts and clothes. So Google has determined that the video violates sexually.
Is there any way to fix it?

from generative-ai-python.

github-actions avatar github-actions commented on July 29, 2024

Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.

from generative-ai-python.

github-actions avatar github-actions commented on July 29, 2024

This issue was closed because it has been inactive for 28 days. Please post a new issue if you need further assistance. Thanks!

from generative-ai-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.