Interface: EmbeddingInstance
@providerprotocol/ai / @providerprotocol/ai / EmbeddingInstance
Interface: EmbeddingInstance<TParams>
Section titled “Interface: EmbeddingInstance<TParams>”Defined in: src/types/embedding.ts:190
Embedding instance returned by the embedding() function.
Example
Section titled “Example”const embedder = embedding({ model: openai('text-embedding-3-large') });
// Single inputconst result = await embedder.embed('Hello world');
// Batch inputconst batch = await embedder.embed(['doc1', 'doc2', 'doc3']);
// Large-scale with progressconst stream = embedder.embed(documents, { chunked: true });for await (const progress of stream) { console.log(`${progress.percent}% complete`);}Type Parameters
Section titled “Type Parameters”TParams
Section titled “TParams”TParams = unknown
Provider-specific parameter type
Properties
Section titled “Properties”
readonlymodel:BoundEmbeddingModel<TParams>
Defined in: src/types/embedding.ts:212
The bound embedding model
params
Section titled “params”
readonlyparams:TParams|undefined
Defined in: src/types/embedding.ts:215
Current parameters
Methods
Section titled “Methods”embed()
Section titled “embed()”Call Signature
Section titled “Call Signature”embed(
input,options?):Promise<EmbeddingResult>
Defined in: src/types/embedding.ts:198
Generate embeddings for one or more inputs.
Parameters
Section titled “Parameters”Single input or array of inputs
EmbeddingInput | EmbeddingInput[]
options?
Section titled “options?”EmbedOptions & object
Optional embed options
Returns
Section titled “Returns”Promise<EmbeddingResult>
Promise
Call Signature
Section titled “Call Signature”embed(
input,options):EmbeddingStream
Defined in: src/types/embedding.ts:202
Parameters
Section titled “Parameters”options
Section titled “options”EmbedOptions & object
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”embed(
input,options?):EmbeddingStream|Promise<EmbeddingResult>
Defined in: src/types/embedding.ts:206
Parameters
Section titled “Parameters”EmbeddingInput | EmbeddingInput[]
options?
Section titled “options?”Returns
Section titled “Returns”EmbeddingStream | Promise<EmbeddingResult>