Skip to content

feat: add Edge Runtime global types #79

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

Merged
merged 2 commits into from
Apr 14, 2024
Merged
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
45 changes: 45 additions & 0 deletions src/edge-runtime.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
interface ModelOptions {
/**
* Pool embeddings by taking their mean. Applies only for `gte-small` model
*/
mean_pool?: boolean

/**
* Normalize the embeddings result. Applies only for `gte-small` model
*/
normalize?: boolean

/**
* Stream response from model. Applies only for LLMs like `mistral` (default: false)
*/
stream?: boolean

/**
* Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
*/
timeout?: number
}

interface Session {
/**
* Execute the given prompt in model session
*/
run(prompt: string, modelOptions?: ModelOptions): unknown
}

declare var Session: {
prototype: Session
/**
* Create a new model session using given model
*/
new (model: string, sessionOptions?: unknown): Session
}

declare var Supabase: {
/**
* Provides AI related APIs
*/
readonly ai: {
readonly Session: typeof Session
}
}