Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(base): add an integration test for Supabase.ai #468

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading