@@ -3,8 +3,8 @@ use std::sync::Arc;
33use chrono:: { SecondsFormat , Utc } ;
44use pyo3:: exceptions:: PyRuntimeError ;
55use pyo3:: prelude:: * ;
6- use pyo3:: IntoPy ;
76use pyo3:: types:: { PyBytes , PyDict , PyType } ;
7+ use pyo3:: IntoPyObject ;
88use tokio:: runtime:: Runtime ;
99
1010use lance_context:: serde:: CONTENT_TYPE_TEXT ;
@@ -69,9 +69,7 @@ impl Context {
6969 let ( content_type, text_payload, binary_payload, inner_content) =
7070 match content. extract :: < & [ u8 ] > ( ) {
7171 Ok ( bytes) => (
72- data_type
73- . unwrap_or ( DEFAULT_BINARY_CONTENT_TYPE )
74- . to_string ( ) ,
72+ data_type. unwrap_or ( DEFAULT_BINARY_CONTENT_TYPE ) . to_string ( ) ,
7573 None ,
7674 Some ( bytes. to_vec ( ) ) ,
7775 BINARY_PLACEHOLDER . to_string ( ) ,
@@ -147,7 +145,11 @@ impl Context {
147145}
148146
149147fn new_run_id ( ) -> String {
150- format ! ( "run-{}-{}" , Utc :: now( ) . timestamp_micros( ) , std:: process:: id( ) )
148+ format ! (
149+ "run-{}-{}" ,
150+ Utc :: now( ) . timestamp_micros( ) ,
151+ std:: process:: id( )
152+ )
151153}
152154
153155fn search_hit_to_py ( py : Python < ' _ > , hit : SearchResult ) -> PyResult < PyObject > {
@@ -180,9 +182,9 @@ fn search_hit_to_py(py: Python<'_>, hit: SearchResult) -> PyResult<PyObject> {
180182 state_dict. set_item ( "active_plan_id" , metadata. active_plan_id ) ?;
181183 state_dict. set_item ( "tokens_used" , metadata. tokens_used ) ?;
182184 state_dict. set_item ( "custom" , metadata. custom ) ?;
183- state_dict. into_py ( py)
185+ state_dict. into_pyobject ( py) ? . unbind ( ) . into ( )
184186 }
185- None => py. None ( ) . into_py ( py) ,
187+ None => py. None ( ) . into_pyobject ( py) ? . unbind ( ) . into ( ) ,
186188 } ;
187189 dict. set_item ( "state_metadata" , state_obj) ?;
188190 dict. set_item ( "content_type" , content_type) ?;
@@ -193,7 +195,7 @@ fn search_hit_to_py(py: Python<'_>, hit: SearchResult) -> PyResult<PyObject> {
193195 }
194196 dict. set_item ( "embedding" , embedding) ?;
195197 dict. set_item ( "distance" , distance) ?;
196- Ok ( dict. into_py ( py) )
198+ Ok ( dict. into_pyobject ( py) ? . unbind ( ) . into ( ) )
197199}
198200
199201fn to_py_err < E : std:: fmt:: Display > ( err : E ) -> PyErr {
0 commit comments