@viviedu/applet-sdk
    Preparing search index...

    Class EdgeAi

    The edgeAi namespace on a BoxApplet. Talks directly to the box over HTTP. Obtained via applet.edgeAi.

    Index

    Methods

    • Encode an image on the box for model, returning an ImageEmbeddingRef to reuse across prompts. The ref is only valid for model.

      Parameters

      • model: Model
      • image: ImageBytes
      • Optionaloptions: { abortSignal?: AbortSignal }

      Returns Promise<ImageEmbeddingRef>

    • Load a model onto the box (starts/keeps it resident). Rejects if it fails.

      Parameters

      Returns Promise<void>

    • Run a one-shot prompt against a loaded model and return the full response.

      Parameters

      Returns Promise<string>

    • Transcribe complete audio with a loaded speech model and return the whole transcript. Takes only a finished buffer: a feed has no result until it ends, so there would be nothing to return.

      Parameters

      • model: Model
      • audio: Float32Array<ArrayBuffer>
      • options: TranscribeOptions

      Returns Promise<string>

    • Run a prompt and stream the generated tokens as they arrive (SSE).

      Parameters

      • model: Model
      • prompt: PromptInput
      • Optionaloptions: Omit<PromptOptions, "abortSignal">

      Returns PromptStream

    • Transcribe audio with a loaded speech model, streaming results as they are decoded. Consume with for await; call cancel() to stop early.

      audio may be a finished buffer or a feed that produces samples over time; a feed is sent as the request body arrives rather than being collected first.

      Parameters

      • model: Model
      • audio: AudioSamples
      • options: Omit<TranscribeOptions, "abortSignal">

      Returns TranscriptionStream

    • Tokenise prompt on the box with model's tokenizer.

      Parameters

      • model: Model
      • prompt: string
      • Optionaloptions: { abortSignal?: AbortSignal }

      Returns Promise<Tokenization>

    • Create a EdgeAi instance.

      If the feature is not enabled or the info is undefined then a stub is returned that will error.

      TODO IGNT-895: Make sure the returned stub properly returns an error state

      Parameters

      • featureEnabled: boolean
      • info: UndefinedToOptional<{ token: string; url: string }> | undefined
      • logger: Logger

      Returns EdgeAi