edge-runtime.d.ts62 lines · main
1declare namespace Briven {
2 export interface ModelOptions {
3 /**
4 * Pool embeddings by taking their mean. Applies only for `gte-small` model
5 */
6 mean_pool?: boolean
7
8 /**
9 * Normalize the embeddings result. Applies only for `gte-small` model
10 */
11 normalize?: boolean
12
13 /**
14 * Stream response from model. Applies only for LLMs like `mistral` (default: false)
15 */
16 stream?: boolean
17
18 /**
19 * Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
20 */
21 timeout?: number
22
23 /**
24 * Mode for the inference API host. (default: 'ollama')
25 */
26 mode?: 'ollama' | 'openaicompatible'
27 signal?: AbortSignal
28 }
29
30 export class Session {
31 /**
32 * Create a new model session using given model
33 */
34 constructor(model: string, sessionOptions?: unknown)
35
36 /**
37 * Execute the given prompt in model session
38 */
39 run(
40 prompt:
41 | string
42 | Omit<import('npm:openai@^4.52.5').OpenAI.Chat.ChatCompletionCreateParams, 'model' | 'stream'>,
43 modelOptions?: ModelOptions
44 ): unknown
45 }
46
47 /**
48 * Provides AI related APIs
49 */
50 export interface Ai {
51 readonly Session: typeof Session
52 }
53
54 /**
55 * Provides AI related APIs
56 */
57 export const ai: Ai
58}
59
60declare namespace EdgeRuntime {
61 export function waitUntil<T>(promise: Promise<T>): Promise<T>
62}