Patch Changes
-
#4389
f089470
Thanks @IMax153! - Add support for GenAI telemetry annotations. -
#4368
a0c85e6
Thanks @IMax153! - Support creation of embeddings from the AI integration packages.For example, the following program will create an OpenAI
Embeddings
service
that will aggregate all embedding requests received within a500
millisecond
window into a single batch.import { Embeddings } from "@effect/ai" import { OpenAiClient, OpenAiEmbeddings } from "@effect/ai-openai" import { NodeHttpClient } from "@effect/platform-node" import { Config, Effect, Layer } from "effect" // Create the OpenAI client const OpenAi = OpenAiClient.layerConfig({ apiKey: Config.redacted("OPENAI_API_KEY") }).pipe(Layer.provide(NodeHttpClient.layerUndici)) // Create an embeddings service for the `text-embedding-3-large` model const TextEmbeddingsLarge = OpenAiEmbeddings.layerDataLoader({ model: "text-embedding-3-large", window: "500 millis", maxBatchSize: 2048 }).pipe(Layer.provide(OpenAi)) // Use the generic `Embeddings` service interface in your program const program = Effect.gen(function* () { const embeddings = yield* Embeddings.Embeddings const result = yield* embeddings.embed("The input to embed") }) // Provide the specific implementation to use program.pipe(Effect.provide(TextEmbeddingsLarge), Effect.runPromise)
-
Updated dependencies [
f5e3b1b
,59b3cfb
,766113c
,fcf3b7c
,bb05fb8
,712277f
,f269122
,8f6006a
,f089470
,c45b559
,430c846
,7b03057
,a9c94c8
,107e6f0
,c9175ae
,65c11b9
,e386d2f
,9172efb
,a0c85e6
]:- @effect/ai@0.8.2
- @effect/platform@0.75.2
- effect@3.12.8
- @effect/experimental@0.39.2