File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ const session = new Supabase . ai . Session ( 'gte-small' ) ;
2+
3+ export default {
4+ async fetch ( ) {
5+ // Generate embedding
6+ const embedding = await session . run ( "meow" , {
7+ mean_pool : true ,
8+ normalize : true
9+ } ) ;
10+
11+ return new Response (
12+ null ,
13+ {
14+ status : embedding instanceof Array ? 200 : 500
15+ }
16+ ) ;
17+ }
18+ }
Original file line number Diff line number Diff line change @@ -2856,6 +2856,26 @@ async fn test_tmp_fs_should_not_be_available_in_import_stmt() {
28562856 ) ;
28572857}
28582858
2859+ #[ tokio:: test]
2860+ #[ serial]
2861+ async fn test_supabase_ai_gte ( ) {
2862+ let tb = TestBedBuilder :: new ( "./test_cases/main" )
2863+ . with_per_worker_policy ( None )
2864+ . build ( )
2865+ . await ;
2866+
2867+ let resp = tb
2868+ . request ( |b| {
2869+ b. uri ( "/supabase-ai" )
2870+ . body ( Body :: empty ( ) )
2871+ . context ( "can't make request" )
2872+ } )
2873+ . await
2874+ . unwrap ( ) ;
2875+
2876+ assert_eq ! ( resp. status( ) . as_u16( ) , StatusCode :: OK ) ;
2877+ }
2878+
28592879// -- sb_ai: ORT @huggingface/transformers
28602880async fn test_ort_transformers_js ( script_path : & str ) {
28612881 fn visit_json ( value : & mut serde_json:: Value ) {
You can’t perform that action at this time.
0 commit comments