Skip to content

Commit

Permalink
chore(base): add an integration test for Supabase.ai (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyannyacha authored Jan 2, 2025
1 parent 65c4e17 commit 5558d8e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
18 changes: 18 additions & 0 deletions crates/base/test_cases/supabase-ai/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const session = new Supabase.ai.Session('gte-small');

export default {
async fetch() {
// Generate embedding
const embedding = await session.run("meow", {
mean_pool: true,
normalize: true
});

return new Response(
null,
{
status: embedding instanceof Array ? 200 : 500
}
);
}
}
20 changes: 20 additions & 0 deletions crates/base/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,26 @@ async fn test_tmp_fs_should_not_be_available_in_import_stmt() {
);
}

#[tokio::test]
#[serial]
async fn test_supabase_ai_gte() {
let tb = TestBedBuilder::new("./test_cases/main")
.with_per_worker_policy(None)
.build()
.await;

let resp = tb
.request(|b| {
b.uri("/supabase-ai")
.body(Body::empty())
.context("can't make request")
})
.await
.unwrap();

assert_eq!(resp.status().as_u16(), StatusCode::OK);
}

// -- sb_ai: ORT @huggingface/transformers
async fn test_ort_transformers_js(script_path: &str) {
fn visit_json(value: &mut serde_json::Value) {
Expand Down

0 comments on commit 5558d8e

Please sign in to comment.