Hi I am doing a course on deeplearning.ai called ‘Building Multimodal Search and RAG’. I am running the below code and getting the following error
Code:
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:
{"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-07-23T12:41:55Z"}
---------------------------------------------------------------------------
UnexpectedStatusCodeError Traceback (most recent call last)
Cell In[8], 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 PaLM failed with status: 400 error: Parameter dimension is not supported with video input.'}]}.```
Earlier I was adding image object to the same collection it was working fine, the code for collection creation and image object addition is
from weaviate.classes.config import Configure
# Just checking if you ever need to re run it
if(client.collections.exists("Animals")):
client.collections.delete("Animals")
client.collections.create(
name="Animals",
vectorizer_config=Configure.Vectorizer.multi2vec_palm(
image_fields=["image"],
video_fields=["video"],
project_id="semi-random-dev",
location="us-central1",
model_id="multimodalembedding@001",
dimensions=1408,
)
)
{"level":"info","msg":"Created shard animals_wPRveZCpcK2K in 1.110407ms","time":"2024-07-24T23:59:00Z"}
{"action":"hnsw_vector_cache_prefill","count":1000,"index_id":"main","level":"info","limit":1000000000000,"msg":"prefilled vector cache","time":"2024-07-24T23:59:00Z","took":82186}
<weaviate.collections.collection.Collection at 0x7f5a22708d90>
It would be great if someone can help me out. Thanks!