create_embeddings: Create Embeddings

View source: R/core_api.R

create_embeddingsR Documentation

Create Embeddings

Description

Generate embeddings for text using an embedding model.

Usage

create_embeddings(model, value, registry = NULL)

Arguments

model

Either an EmbeddingModelV1 object, or a string ID like "openai:text-embedding-3-small".

value

A character string or vector to embed.

registry

Optional ProviderRegistry to use.

Value

A list with embeddings and usage information.

Examples


if (interactive()) {
  model <- create_openai()$embedding_model("text-embedding-3-small")
  result <- create_embeddings(model, "Hello, world!")
  print(length(result$embeddings[[1]]))
}


aisdk documentation built on May 29, 2026, 9:07 a.m.