Cannot Insert Video Object - building-multimodal-search-and-rags

Code:

import weaviate, os

client = weaviate.connect_to_embedded(
    version="1.24.4",
    environment_variables={
        "ENABLE_MODULES": "backup-filesystem,multi2vec-palm",
        "BACKUP_FILESYSTEM_PATH": "/home/jovyan/work/backups",
    },
    headers={
        "X-PALM-Api-Key": EMBEDDING_API_KEY,
    }
)

client.is_ready()

Error:

Adding meerkat-watch.mp4
{"action":"requests_total","api":"rest","class_name":"Animals","error":"update vector: connection to Google PaLM failed with status: 400 error: Parameter dimension is not supported with video input.","level":"error","msg":"unexpected error","query_type":"objects","time":"2024-06-21T10:10:29Z"}
---------------------------------------------------------------------------
UnexpectedStatusCodeError                 Traceback (most recent call last)
Cell In[9], line 10
      7 path = "./source/video/" + name    
      9 # insert videos one by one
---> 10 animals.data.insert({
     11     "name": name,
     12     "path": path,
     13     "video": toBase64(path),
     14     "mediaType": "video"
     15 })

File ~/.local/lib/python3.11/site-packages/weaviate/collections/data.py:388, in _DataCollection.insert(self, properties, references, uuid, vector)
    385 if vector is not None:
    386     weaviate_obj = self.__parse_vector(weaviate_obj, vector)
--> 388 return self._insert(weaviate_obj)

File ~/.local/lib/python3.11/site-packages/weaviate/collections/data.py:82, in _Data._insert(self, weaviate_obj)
     79 path = "/objects"
     81 params, weaviate_obj = self.__apply_context_to_params_and_object({}, weaviate_obj)
---> 82 self._connection.post(
     83     path=path,
     84     weaviate_object=weaviate_obj,
     85     params=params,
     86     error_msg="Object was not added",
     87     status_codes=_ExpectedStatusCodes(ok_in=200, error="insert object"),
     88 )
     89 return uuid_package.UUID(weaviate_obj["id"])

File ~/.local/lib/python3.11/site-packages/weaviate/connect/v4.py:500, in _Connection.post(self, path, weaviate_object, params, error_msg, status_codes)
    492 def post(
    493     self,
    494     path: str,
   (...)
    498     status_codes: Optional[_ExpectedStatusCodes] = None,
    499 ) -> Response:
--> 500     return self.__send(
    501         "POST",
    502         url=self.url + self._api_version_path + path,
    503         weaviate_object=weaviate_object,
    504         params=params,
    505         error_msg=error_msg,
    506         status_codes=status_codes,
    507     )

File ~/.local/lib/python3.11/site-packages/weaviate/connect/v4.py:451, in _Connection.__send(self, method, url, error_msg, status_codes, weaviate_object, params)
    449     res = self._client.send(req)
    450     if status_codes is not None and res.status_code not in status_codes.ok:
--> 451         raise UnexpectedStatusCodeError(error_msg, response=res)
    452     return cast(Response, res)
    453 except RuntimeError as e:

UnexpectedStatusCodeError: Object was not added! Unexpected status code: 500, with response body: {'error': [{'message': 'update vector: connection to Google PaLM failed with status: 400 error: Parameter dimension is not supported with video input.'}]}.

I had similar issue tried multiple approaches but the error persists.May be the weaviate guys can check it out.

1 Like

+1 had similar issue

same issue.

Is there a way to bring this into notice to the course instructors or mentors @Community-Team

1 Like

Hello. We have contacted our team.

1 Like

Hi AllaAbdella!
Thank you for reporting this!
I’ve tested that notebook again: L2_Multimodal_Search from the course “Building Multimodal Search and RAG”, most cells are working properly, I’ve encounter some errors related to UnexpectedStatusCodeError, those have been already reported to the Weaviate team to fix it soon!

Hi, I received the same issue today, any updates or help from the @Community-Team or weaviate?

Hello @lesly.zerna

I am receiving the same errors related to UnexpectedStatusCodeError and here’s a sample for the same

Code Executed:

animals = client.collections.get("Animals")

source = os.listdir("./source/video/")

for name in source:
    print(f"Adding {name}")
    path = "./source/video/" + name    

    # insert videos one by one
    animals.data.insert({
        "name": name,
        "path": path,
        "video": toBase64(path),
        "mediaType": "video"
    })

Error:


Adding meerkat-watch.mp4
{"action":"requests_total","api":"rest","class_name":"Animals","error":"update vector: connection to Google failed with status: 401 error: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","level":"error","msg":"unexpected error","query_type":"objects","time":"2024-07-27T09:22:10Z"}
---------------------------------------------------------------------------
UnexpectedStatusCodeError                 Traceback (most recent call last)
Cell In[9], line 10
      7 path = "./source/video/" + name    
      9 # insert videos one by one
---> 10 animals.data.insert({
     11     "name": name,
     12     "path": path,
     13     "video": toBase64(path),
     14     "mediaType": "video"
     15 })

File /usr/local/lib/python3.11/site-packages/weaviate/collections/data.py:391, in _DataCollection.insert(self, properties, references, uuid, vector)
    388 if vector is not None:
    389     weaviate_obj = self.__parse_vector(weaviate_obj, vector)
--> 391 return self._insert(weaviate_obj)

File /usr/local/lib/python3.11/site-packages/weaviate/collections/data.py:82, in _Data._insert(self, weaviate_obj)
     79 path = "/objects"
     81 params, weaviate_obj = self.__apply_context_to_params_and_object({}, weaviate_obj)
---> 82 self._connection.post(
     83     path=path,
     84     weaviate_object=weaviate_obj,
     85     params=params,
     86     error_msg="Object was not added",
     87     status_codes=_ExpectedStatusCodes(ok_in=200, error="insert object"),
     88 )
     89 return uuid_package.UUID(weaviate_obj["id"])

File /usr/local/lib/python3.11/site-packages/weaviate/connect/v4.py:480, in _Connection.post(self, path, weaviate_object, params, error_msg, status_codes)
    472 def post(
    473     self,
    474     path: str,
   (...)
    478     status_codes: Optional[_ExpectedStatusCodes] = None,
    479 ) -> Response:
--> 480     return self.__send(
    481         "POST",
    482         url=self.url + self._api_version_path + path,
    483         weaviate_object=weaviate_object,
    484         params=params,
    485         error_msg=error_msg,
    486         status_codes=status_codes,
    487     )

File /usr/local/lib/python3.11/site-packages/weaviate/connect/v4.py:431, in _Connection.__send(self, method, url, error_msg, status_codes, weaviate_object, params)
    429     res = self._client.send(req)
    430     if status_codes is not None and res.status_code not in status_codes.ok:
--> 431         raise UnexpectedStatusCodeError(error_msg, response=res)
    432     return cast(Response, res)
    433 except RuntimeError as e:

UnexpectedStatusCodeError: Object was not added! Unexpected status code: 500, with response body: {'error': [{'message': 'update vector: connection to Google failed with status: 401 error: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.'}]}.

The error still persists. Kindly correct it.

yes! we’re updating the necessary libraries and APIs endpoints to have these errors solved!