@@ -571,7 +571,7 @@ static void dbmem_context_free (void *ptr) {
571571 if (ctx -> cache_buffer ) dbmem_free (ctx -> cache_buffer );
572572
573573 // custom provider
574- if (ctx -> custom_engine && ctx -> custom_provider .free ) ctx -> custom_provider .free (ctx -> custom_engine );
574+ if (ctx -> custom_engine && ctx -> custom_provider .free ) ctx -> custom_provider .free (ctx -> custom_engine , ctx -> custom_provider . xdata );
575575 if (ctx -> custom_provider_name ) dbmem_free (ctx -> custom_provider_name );
576576
577577 #ifndef DBMEM_OMIT_LOCAL_ENGINE
@@ -608,7 +608,7 @@ bool dbmem_context_is_custom (dbmem_context *ctx) {
608608
609609int dbmem_context_custom_compute (dbmem_context * ctx , const char * text , int text_len , embedding_result_t * result ) {
610610 dbmem_embedding_result_t cr = {0 };
611- int rc = ctx -> custom_provider .compute (ctx -> custom_engine , text , text_len , & cr );
611+ int rc = ctx -> custom_provider .compute (ctx -> custom_engine , text , text_len , ctx -> custom_provider . xdata , & cr );
612612 if (rc != 0 ) return rc ;
613613 result -> n_tokens = cr .n_tokens ;
614614 result -> n_tokens_truncated = cr .n_tokens_truncated ;
@@ -950,10 +950,10 @@ static void dbmem_set_model (sqlite3_context *context, int argc, sqlite3_value *
950950 // custom provider path
951951 if (is_custom_provider ) {
952952 // free previous custom engine if any
953- if (ctx -> custom_engine && ctx -> custom_provider .free ) ctx -> custom_provider .free (ctx -> custom_engine );
953+ if (ctx -> custom_engine && ctx -> custom_provider .free ) ctx -> custom_provider .free (ctx -> custom_engine , ctx -> custom_provider . xdata );
954954 ctx -> custom_engine = NULL ;
955955
956- ctx -> custom_engine = ctx -> custom_provider .init (model , ctx -> api_key , ctx -> error_msg );
956+ ctx -> custom_engine = ctx -> custom_provider .init (model , ctx -> api_key , ctx -> custom_provider . xdata , ctx -> error_msg );
957957 if (ctx -> custom_engine == NULL ) {
958958 sqlite3_result_error (context , ctx -> error_msg , -1 );
959959 return ;
@@ -1562,7 +1562,7 @@ SQLITE_DBMEMORY_API int sqlite3_memory_register_provider (sqlite3 *db, const cha
15621562 if (!ctx ) return SQLITE_ERROR ;
15631563
15641564 // free previous custom provider if any
1565- if (ctx -> custom_engine && ctx -> custom_provider .free ) ctx -> custom_provider .free (ctx -> custom_engine );
1565+ if (ctx -> custom_engine && ctx -> custom_provider .free ) ctx -> custom_provider .free (ctx -> custom_engine , ctx -> custom_provider . xdata );
15661566 ctx -> custom_engine = NULL ;
15671567 if (ctx -> custom_provider_name ) dbmem_free (ctx -> custom_provider_name );
15681568
0 commit comments