Interface: EmbeddingResponse
Defined in: packages/agentos/src/rag/IEmbeddingManager.ts:107
Represents the response from an embedding generation request. This structure includes the generated embeddings, information about the model and provider used, token usage details, and any errors encountered during processing (especially relevant for batch requests).
EmbeddingResponse
Properties
embeddings
embeddings:
number[][]
Defined in: packages/agentos/src/rag/IEmbeddingManager.ts:117
An array of embedding vectors. Each inner array (number[]) corresponds
to an input text from the EmbeddingRequest. The order is preserved.
If an error occurred for a specific text in a batch, its corresponding
entry might be missing, or represented by a specific error object if partial
results are supported differently. The errors array should be checked.
Example
[[0.1, 0.2, ...], [0.3, 0.4, ...]]
errors?
optionalerrors:object[]
Defined in: packages/agentos/src/rag/IEmbeddingManager.ts:161
Optional: An array of error objects, relevant if processing a batch of texts
and some individual texts failed. If the entire request failed catastrophically,
the generateEmbeddings method itself should throw an error.
details?
optionaldetails:any
message
message:
string
textIndex
textIndex:
number
Optional
Example
errors: [{ textIndex: 1, message: "Content policy violation", details: { reason: "unsafe_content" } }]
modelId
modelId:
string
Defined in: packages/agentos/src/rag/IEmbeddingManager.ts:125
The ID of the embedding model that was actually used to generate the embeddings. This is important for consistency, especially if model selection was dynamic.
Example
"text-embedding-3-small"
providerId
providerId:
string
Defined in: packages/agentos/src/rag/IEmbeddingManager.ts:132
The ID of the LLM provider that was used.
Example
"openai"
usage
usage:
object
Defined in: packages/agentos/src/rag/IEmbeddingManager.ts:143
Information about token usage and cost for the embedding generation.
costUSD?
optionalcostUSD:number
inputTokens?
optionalinputTokens:number
totalTokens
totalTokens:
number