struct

Crig::Embeddings::EmbeddingsBuilder(M, T)

Inherits Struct < Value < Object

Builder for embedding jobs. This is the primary ergonomic surface used by client.embeddings(...) and client.embeddings_with_ndims(...).

Constructors

empty(model : M) : self
Source
new(model : M) : EmptyEmbeddingsBuilder(M) forall M

Start a builder directly from a model when you are not going through a client helper.

Source
new(model : M, documents : Array(Tuple(T, Array(String))) = [] of ::Tuple(T, Array(String)))
Source

Instance methods

all_simple_documents(documents : Enumerable(Tuple(String, String))) : self

Batch convenience helper for the common {id, text} embedding case.

Source
build

Execute embedding requests in model-sized batches and return the resulting embeddings grouped back by original document.

Source
document(document : T) : self

Add a document to be embedded. The document can be a String or any type that implements the Embed interface.

Source
documents(documents : Enumerable(T)) : self

Add multiple documents to be embedded.

Source
documents
Source
model
Source
simple_document(id : String, text : String) : self

Convenience helper for the common {id, text} embedding case.

Source