hello world

If you’re running Chrome with the API, here’s a UI to prompt an LLM running locally in your browser:




I wrote these TypeScript type definitions for the API:

declare global {
  interface WindowOrWorkerGlobalScope {
    readonly ai?: {
      canCreateTextSession(): Promise<"readily" | "after-download" | "no">;
        options?: Partial<AITextSessionOptions>,
      ): Promise<AITextSession>;
      defaultTextSessionOptions(): Promise<AITextSessionOptions>;

type AITextSession = {
  prompt(input: string): Promise<string>;
  promptStreaming(input: string): AsyncIterable<string>;
  destroy(): void;
  clone(): AITextSession; // Not yet implemented!

type AITextSessionOptions = {
  topK: number;
  temperature: number;
Tagged .

Similar posts

More by Jim

Want to build a fantastic product using LLMs? I work at Granola where we're building the future IDE for knowledge work. Come and work with us! Read more or get in touch!

This page copyright James Fisher 2024. Content is not associated with my employer. Found an error? Edit this page.