Last active
June 6, 2024 13:44
-
-
Save swissspidy/477df0a812ba68fada7ab54695eb7a78 to your computer and use it in GitHub Desktop.
TypeScript type definitions for Chrome's new built-in AI prompt API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare global { | |
interface AI { | |
canCreateTextSession( | |
opts?: AITextSessionOptions | |
): Promise< 'no' | 'readily' >; | |
createTextSession(): Promise< AITextSession >; | |
defaultTextSessionOptions(): Promise<AITextSessionOptions> | |
} | |
interface AITextSession { | |
promptStreaming( prompt: string ): IterableIterator< string >; | |
prompt( prompt: string ): Promise< string >; | |
} | |
interface AITextSessionOptions { | |
temperature: 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0; | |
topK: number; | |
} | |
interface Window { | |
ai: AI; | |
} | |
} | |
export type {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment