Skip to main content Link Search Menu Expand Document (external link)

AiEmbeddingModel.ts overview

Since v1.0.0


Exports Grouped by Category


Constructors

make

Signature

declare const make: (options: {
  readonly embedMany: (input: ReadonlyArray<string>) => Effect.Effect<Array<AiEmbeddingModel.Result>, AiError>
  readonly maxBatchSize?: number
  readonly cache?: { readonly capacity: number; readonly timeToLive: Duration.DurationInput }
}) => Effect.Effect<AiEmbeddingModel.Service, never, never>

Source

Since v1.0.0

makeDataLoader

Creates an Embeddings service which will aggregate all embed requests received during the specified window (up to a maximum of maxBatchSize requests, if specified) and execute them as a single batch.

Signature

declare const makeDataLoader: (options: {
  readonly embedMany: (input: ReadonlyArray<string>) => Effect.Effect<Array<AiEmbeddingModel.Result>, AiError>
  readonly window: Duration.DurationInput
  readonly maxBatchSize?: number
}) => Effect.Effect<AiEmbeddingModel.Service, never, Scope>

Source

Since v1.0.0

Context

AiEmbeddingModel (class)

Signature

declare class AiEmbeddingModel

Source

Since v1.0.0

utils

AiEmbeddingModel (namespace)

Source

Since v1.0.0

Service (interface)

Signature

export interface Service {
  readonly embed: (input: string) => Effect.Effect<Array<number>, AiError>
}

Source

Since v1.0.0

Result (interface)

Signature

export interface Result {
  readonly index: number
  readonly embeddings: Array<number>
}

Source

Since v1.0.0