effect-io-ai

Package: @effect/ai
Module: EmbeddingModel

EmbeddingModel.Service

The service interface for vector embedding operations.

Defines the contract that all embedding model implementations must fulfill. The service provides text-to-vector conversion functionality.

Signature

export interface Service {
  /**
   * Converts a text string into a vector embedding.
   */
  readonly embed: (input: string) => Effect.Effect<Array<number>, AiError.AiError>
  /**
   * Converts a batch of text strings into a chunk of vector embeddings.
   */
  readonly embedMany: (input: ReadonlyArray<string>, options?: {
    /**
     * The concurrency level to use while batching requests.
     */
    readonly concurrency?: Types.Concurrency | undefined
  }) => Effect.Effect<Array<Array<number>>, AiError.AiError>
}

Source

Since v1.0.0