@@ -588,9 +588,6 @@ def test_no_model_custom_vector_doc(self):
588
588
Note: `no_model` is not yet supported on Cloud.
589
589
"""
590
590
self .test_cases = [(CloudTestIndex .unstructured_no_model , self .unstructured_no_model_index_name )]
591
- self .test_cases_multimodal = [
592
- (CloudTestIndex .structured_languagebind_model , self .structured_languagebind_index_name )
593
- ]
594
591
595
592
for cloud_test_index_to_use , open_source_test_index_name in self .test_cases :
596
593
test_index_name = self .get_test_index_name (
@@ -707,103 +704,6 @@ def test_add_empty_docs_batched(self):
707
704
tensor_fields = "field a" )
708
705
assert res == []
709
706
710
- def test_add_multimodal_single_documents (self ):
711
- documents = [
712
- {
713
- "video_field_3" : "https://marqo-k400-video-test-dataset.s3.amazonaws.com/videos/---QUuC4vJs_000084_000094.mp4" ,
714
- "_id" : "1"
715
- },
716
- {
717
- "audio_field_2" : "https://marqo-ecs-50-audio-test-dataset.s3.amazonaws.com/audios/marqo-audio-test.mp3" ,
718
- "_id" : "2"
719
- },
720
- {
721
- "image_field_2" : "https://raw.githubusercontent.com/marqo-ai/marqo-api-tests/mainline/assets/ai_hippo_realistic.png" ,
722
- "_id" : "3"
723
- },
724
- {
725
- "text_field_3" : "hello there padawan. Today you will begin your training to be a Jedi" ,
726
- "_id" : "4"
727
- },
728
- ]
729
- for cloud_test_index_to_use , open_source_test_index_name in self .test_cases_multimodal :
730
- if "languagebind" not in str (cloud_test_index_to_use ):
731
- continue
732
- test_index_name = self .get_test_index_name (
733
- cloud_test_index_to_use = cloud_test_index_to_use ,
734
- open_source_test_index_name = open_source_test_index_name
735
- )
736
- with self .subTest (test_index_name ):
737
- tensor_fields = ["text_field_3" , "image_field_2" , "video_field_3" , "audio_field_2" ] if "unstructured" in test_index_name else None
738
- res = self .client .index (test_index_name ).add_documents (documents , tensor_fields = tensor_fields )
739
- print (res )
740
-
741
- for item in res ['items' ]:
742
- self .assertEqual (200 , item ['status' ])
743
-
744
- get_res = self .client .index (test_index_name ).get_documents (
745
- document_ids = ["1" , "2" , "3" , "4" ],
746
- expose_facets = True
747
- )
748
- print (get_res )
749
-
750
- for i , doc in enumerate (get_res ['results' ]):
751
- i += 1
752
- tensor_facets = doc ['_tensor_facets' ]
753
- self .assertIn ('_embedding' , tensor_facets [0 ])
754
- self .assertEqual (len (tensor_facets [0 ]['_embedding' ]), 768 )
755
-
756
- def test_add_multimodal_field_document (self ):
757
- multimodal_document = [{
758
- "_id" : "1_multimodal" ,
759
- "text_field_1" : "New York" ,
760
- "text_field_2" : "Los Angeles" ,
761
- "image_field_1" : "https://raw.githubusercontent.com/marqo-ai/marqo-api-tests/mainline/assets/ai_hippo_realistic.png" ,
762
- "video_field_1" : "https://marqo-k400-video-test-dataset.s3.amazonaws.com/videos/---QUuC4vJs_000084_000094.mp4" ,
763
- "video_field_2" : "https://marqo-k400-video-test-dataset.s3.amazonaws.com/videos/---QUuC4vJs_000084_000094.mp4" ,
764
- "audio_field_1" : "https://marqo-ecs-50-audio-test-dataset.s3.amazonaws.com/audios/marqo-audio-test.mp3" ,
765
- }]
766
- for cloud_test_index_to_use , open_source_test_index_name in self .test_cases_multimodal :
767
- if "languagebind" not in str (cloud_test_index_to_use ):
768
- continue
769
- test_index_name = self .get_test_index_name (
770
- cloud_test_index_to_use = cloud_test_index_to_use ,
771
- open_source_test_index_name = open_source_test_index_name
772
- )
773
- with self .subTest (test_index_name ):
774
- mappings = {
775
- "multimodal_field" : {
776
- "type" : "multimodal_combination" ,
777
- "weights" : {
778
- "text_field_1" : 0.1 ,
779
- "text_field_2" : 0.1 ,
780
- "image_field_1" : 0.5 ,
781
- "video_field_1" : 0.1 ,
782
- "video_field_2" : 0.1 ,
783
- "audio_field_1" : 0.1
784
- },
785
- }
786
- } if "unstructured" in test_index_name else None
787
- tensor_fields = ["multimodal_field" ] if "unstructured" in test_index_name else None
788
- res = self .client .index (test_index_name ).add_documents (
789
- multimodal_document ,
790
- tensor_fields = tensor_fields ,
791
- mappings = mappings
792
- )
793
- print (res )
794
-
795
- for item in res ['items' ]:
796
- self .assertEqual (200 , item ['status' ])
797
-
798
- doc = self .client .index (test_index_name ).get_documents (
799
- document_ids = ["1_multimodal" ],
800
- expose_facets = True
801
- )
802
- print (doc )
803
-
804
- self .assertIn ('_tensor_facets' , doc ['results' ][0 ])
805
- self .assertIn ('_embedding' , doc ['results' ][0 ]['_tensor_facets' ][0 ])
806
- self .assertEqual (len (doc ['results' ][0 ]['_tensor_facets' ][0 ]['_embedding' ]), 768 )
807
707
808
708
def test_media_download_headers_is_not_included (self ):
809
709
"""Ensure newly added attributes mediaDownloadHeaders is not included in the request body."""
@@ -835,4 +735,4 @@ def run():
835
735
self .assertEqual ({"key" : "value-2" }, kwargs ["body" ]["imageDownloadHeaders" ])
836
736
self .assertEqual ({"key" : "value-1" }, kwargs ["body" ]["mediaDownloadHeaders" ])
837
737
return True
838
- run ()
738
+ run ()
0 commit comments