Whatever message this page gives is out now! Go check it out!

embedAll

Last update:
May 18, 2026

Description

Generates embeddings for multiple text inputs in a single call. This method is optimized for throughput and is the recommended way to embed:
  • document batches during ingestion, or
  • large sets of knowledge‑base entries.

Syntax

embedAll(array text)

Returns

A struct containing:
  • embeddings – an array of vectors (one per input string, in the same order).
  • tokenUsage – aggregated token usage metrics (if provider makes it available).
  • finishReason – reason the call completed (if provided by the provider).
  • metadata – provider‑specific metadata.

Parameters

Parameters
Parameter
Type
Required
Description
text
Array
Yes
Array of text strings to embed (batch input).

Usage

Use embedAll() whenever you have more than one string to embed.

Example

<cfscript>
        embeddingModel = {
            provider: "openai",
            modelName: "text-embedding-3-small",
            apiKey: #application.apiKey#
        };
        texts = [
            "Machine learning is a subset of artificial intelligence",
            "ColdFusion is a rapid application development platform",
            "Vector databases enable semantic search capabilities",
            "Embeddings represent text as numerical vectors",
            "Natural language processing uses neural networks"
        ];
        result = embeddingModel.embedAll(texts);
        writeDump(result)
        break;
        hasEmbeddings = isDefined("result") AND isStruct(result) AND structKeyExists(result, "embeddings") AND isArray(result.embeddings) AND arrayLen(result.embeddings) EQ 5;
        writeOutput(hasEmbeddings);
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page