Does Gemini API Support all file mime types

  Kiến thức lập trình

I am developing a tool that describes what a file is, using Gemini api. However, I had came into this issue of getting an error 400 Unsupported MIME type, when I uploaded a .docx type file. Does the API support all file mime types or just a specific list of file types, since I assumed it would be the same as the gemini website version.

Here’s the full terminal output (error):

Uploaded file 'StudentFinalDraft.docx' as: https://generativelanguage.googleapis.com/v1beta/files/4wu650wcz753
Processing...

Traceback (most recent call last):
  File "/home/haveyoutried/Documents/GeminiSort.py", line 59, in <module>
    keyPair[o] = model.generate_content(
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/generativeai/generative_models.py", line 331, in generate_content
    response = self._client.generate_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/client.py", line 827, in generate_content
    response = rpc(
               ^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
           ^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/home/haveyoutried/.local/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 "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
             ^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/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 Unsupported MIME type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

If there is a list as mentioned before, could anyone link me up with it? else, could you explain why is the above shown error has occurred, if .docx file is acceptable?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

Does Gemini API Support all file mime types

I am developing a tool that describes what a file is, using Gemini api. However, I had came into this issue of getting an error 400 Unsupported MIME type, when I uploaded a .docx type file. Does the API support all file mime types or just a specific list of file types, since I assumed it would be the same as the gemini website version.

Here’s the full terminal output (error):

Uploaded file 'StudentFinalDraft.docx' as: https://generativelanguage.googleapis.com/v1beta/files/4wu650wcz753
Processing...

Traceback (most recent call last):
  File "/home/haveyoutried/Documents/GeminiSort.py", line 59, in <module>
    keyPair[o] = model.generate_content(
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/generativeai/generative_models.py", line 331, in generate_content
    response = self._client.generate_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/client.py", line 827, in generate_content
    response = rpc(
               ^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
           ^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/home/haveyoutried/.local/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 "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
             ^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/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 Unsupported MIME type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

If there is a list as mentioned before, could anyone link me up with it? else, could you explain why is the above shown error has occurred, if .docx file is acceptable?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

Does Gemini API Support all file mime types

I am developing a tool that describes what a file is, using Gemini api. However, I had came into this issue of getting an error 400 Unsupported MIME type, when I uploaded a .docx type file. Does the API support all file mime types or just a specific list of file types, since I assumed it would be the same as the gemini website version.

Here’s the full terminal output (error):

Uploaded file 'StudentFinalDraft.docx' as: https://generativelanguage.googleapis.com/v1beta/files/4wu650wcz753
Processing...

Traceback (most recent call last):
  File "/home/haveyoutried/Documents/GeminiSort.py", line 59, in <module>
    keyPair[o] = model.generate_content(
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/generativeai/generative_models.py", line 331, in generate_content
    response = self._client.generate_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/client.py", line 827, in generate_content
    response = rpc(
               ^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
           ^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/home/haveyoutried/.local/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 "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
             ^^^^^^^^
  File "/home/haveyoutried/.local/lib/python3.11/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/haveyoutried/.local/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 Unsupported MIME type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

If there is a list as mentioned before, could anyone link me up with it? else, could you explain why is the above shown error has occurred, if .docx file is acceptable?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT