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>
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>
Since v1.0.0
Context
AiEmbeddingModel (class)
Signature
declare class AiEmbeddingModel
Since v1.0.0
utils
AiEmbeddingModel (namespace)
Since v1.0.0
Service (interface)
Signature
export interface Service {
readonly embed: (input: string) => Effect.Effect<Array<number>, AiError>
}
Since v1.0.0
Result (interface)
Signature
export interface Result {
readonly index: number
readonly embeddings: Array<number>
}
Since v1.0.0