Skip to content

Commit 26a23e0

Browse files
authored
Merge pull request #79 from supabase/supabase-ai-types
feat: add Edge Runtime global types
2 parents 098537a + bc12abc commit 26a23e0

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/edge-runtime.d.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
interface ModelOptions {
2+
/**
3+
* Pool embeddings by taking their mean. Applies only for `gte-small` model
4+
*/
5+
mean_pool?: boolean
6+
7+
/**
8+
* Normalize the embeddings result. Applies only for `gte-small` model
9+
*/
10+
normalize?: boolean
11+
12+
/**
13+
* Stream response from model. Applies only for LLMs like `mistral` (default: false)
14+
*/
15+
stream?: boolean
16+
17+
/**
18+
* Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
19+
*/
20+
timeout?: number
21+
}
22+
23+
interface Session {
24+
/**
25+
* Execute the given prompt in model session
26+
*/
27+
run(prompt: string, modelOptions?: ModelOptions): unknown
28+
}
29+
30+
declare var Session: {
31+
prototype: Session
32+
/**
33+
* Create a new model session using given model
34+
*/
35+
new (model: string, sessionOptions?: unknown): Session
36+
}
37+
38+
declare var Supabase: {
39+
/**
40+
* Provides AI related APIs
41+
*/
42+
readonly ai: {
43+
readonly Session: typeof Session
44+
}
45+
}

0 commit comments

Comments
 (0)