@@ -146,7 +146,7 @@ def test_to_dict_without_flattening():
146146def test_to_dict_with_custom_parameters ():
147147 doc = Document (
148148 content = "test text" ,
149- blob = ByteStream (b"some bytes" , mime_type = "application/pdf" ),
149+ blob = ByteStream (b"some bytes" , mime_type = "application/pdf" , meta = { "foo" : "bar" } ),
150150 meta = {"some" : "values" , "test" : 10 },
151151 score = 0.99 ,
152152 embedding = [10.0 , 10.0 ],
@@ -156,7 +156,7 @@ def test_to_dict_with_custom_parameters():
156156 assert doc .to_dict () == {
157157 "id" : doc .id ,
158158 "content" : "test text" ,
159- "blob" : {"data" : list (b"some bytes" ), "mime_type" : "application/pdf" },
159+ "blob" : {"data" : list (b"some bytes" ), "mime_type" : "application/pdf" , "meta" : { "foo" : "bar" } },
160160 "some" : "values" ,
161161 "test" : 10 ,
162162 "score" : 0.99 ,
@@ -178,10 +178,10 @@ def test_to_dict_with_custom_parameters_without_flattening():
178178 assert doc .to_dict (flatten = False ) == {
179179 "id" : doc .id ,
180180 "content" : "test text" ,
181- "blob" : {"data" : list (b"some bytes" ), "mime_type" : "application/pdf" },
181+ "blob" : {"data" : list (b"some bytes" ), "mime_type" : "application/pdf" , "meta" : {} },
182182 "meta" : {"some" : "values" , "test" : 10 },
183183 "score" : 0.99 ,
184- "embedding" : [10 , 10 ],
184+ "embedding" : [10.0 , 10.0 ],
185185 "sparse_embedding" : {"indices" : [0 , 2 , 4 ], "values" : [0.1 , 0.2 , 0.3 ]},
186186 }
187187
@@ -212,15 +212,15 @@ def from_from_dict_with_parameters():
212212 assert Document .from_dict (
213213 {
214214 "content" : "test text" ,
215- "blob" : {"data" : list (blob_data ), "mime_type" : "text/markdown" },
215+ "blob" : {"data" : list (blob_data ), "mime_type" : "text/markdown" , "meta" : { "text" : "test text" } },
216216 "meta" : {"text" : "test text" },
217217 "score" : 0.812 ,
218218 "embedding" : [0.1 , 0.2 , 0.3 ],
219219 "sparse_embedding" : {"indices" : [0 , 2 , 4 ], "values" : [0.1 , 0.2 , 0.3 ]},
220220 }
221221 ) == Document (
222222 content = "test text" ,
223- blob = ByteStream (blob_data , mime_type = "text/markdown" ),
223+ blob = ByteStream (blob_data , mime_type = "text/markdown" , meta = { "text" : "test text" } ),
224224 meta = {"text" : "test text" },
225225 score = 0.812 ,
226226 embedding = [0.1 , 0.2 , 0.3 ],
0 commit comments