@@ -100,6 +100,7 @@ def test_embed(self):
100100 self .assertIsNotNone (response .embeddings )
101101 self .assertEqual (len (response .embeddings ), 2 )
102102 self .assertEqual (len (response .embeddings [0 ]), 1024 )
103+ self .assertEqual (response .response_type , "embeddings_floats" )
103104
104105 def test_chat (self ):
105106 """Test V1 chat with Command R."""
@@ -159,6 +160,7 @@ def test_embed_v2(self):
159160 self .assertEqual (len (response .embeddings .float_ ), 2 )
160161 # Verify embedding dimensions (1024 for embed-english-v3.0)
161162 self .assertEqual (len (response .embeddings .float_ [0 ]), 1024 )
163+ self .assertEqual (response .response_type , "embeddings_by_type" )
162164
163165 def test_embed_with_model_prefix_v2 (self ):
164166 """Test embedding with 'cohere.' model prefix on v2 client."""
@@ -1023,6 +1025,38 @@ def test_embed_response_lowercases_embedding_keys(self):
10231025 self .assertNotIn ("FLOAT" , result ["embeddings" ])
10241026 self .assertEqual (result ["meta" ]["tokens" ]["output_tokens" ], 7 )
10251027
1028+ def test_embed_response_includes_response_type_v1 (self ):
1029+ """Test V1 embed response includes response_type=embeddings_floats for SDK union."""
1030+ from cohere .oci_client import transform_oci_response_to_cohere
1031+
1032+ result = transform_oci_response_to_cohere (
1033+ "embed" ,
1034+ {
1035+ "id" : "embed-id" ,
1036+ "embeddings" : [[0.1 , 0.2 ]],
1037+ "usage" : {"inputTokens" : 3 , "completionTokens" : 0 },
1038+ },
1039+ is_v2 = False ,
1040+ )
1041+
1042+ self .assertEqual (result ["response_type" ], "embeddings_floats" )
1043+
1044+ def test_embed_response_includes_response_type_v2 (self ):
1045+ """Test V2 embed response includes response_type=embeddings_by_type for SDK union."""
1046+ from cohere .oci_client import transform_oci_response_to_cohere
1047+
1048+ result = transform_oci_response_to_cohere (
1049+ "embed" ,
1050+ {
1051+ "id" : "embed-id" ,
1052+ "embeddings" : {"FLOAT" : [[0.1 , 0.2 ]]},
1053+ "usage" : {"inputTokens" : 3 , "completionTokens" : 0 },
1054+ },
1055+ is_v2 = True ,
1056+ )
1057+
1058+ self .assertEqual (result ["response_type" ], "embeddings_by_type" )
1059+
10261060 def test_normalize_model_for_oci_rejects_empty_model (self ):
10271061 """Test model normalization fails clearly for empty model names."""
10281062 from cohere .oci_client import normalize_model_for_oci
0 commit comments