@sap-ai-sdk/orchestration
Version:
SAP Cloud SDK for AI is the official Software Development Kit (SDK) for **SAP AI Core**, **SAP Generative AI Hub**, and **Orchestration Service**.
38 lines • 1.2 kB
JavaScript
/**
* Response wrapper for orchestration embedding requests.
*/
export class OrchestrationEmbeddingResponse {
response;
_data;
constructor(response) {
this.response = response;
this._data = response.data;
}
/**
* Final embedding results with index and object type (which is always `embedding`) information.
* @returns Array of embedding data objects containing both vectors, indices, and object types.
*/
getEmbeddings() {
// TODO: Remove non-null assertion when final_result is made mandatory in the schema
return this._data.final_result.data.map((result) => ({
embedding: result.embedding,
index: result.index,
object: 'embedding'
}));
}
/**
* Usage information.
* @returns Usage information or undefined.
*/
getTokenUsage() {
return this._data.final_result.usage;
}
/**
* Intermediate results from orchestration modules.
* @returns Intermediate results or undefined.
*/
getIntermediateResults() {
return this._data.intermediate_results;
}
}
//# sourceMappingURL=orchestration-embedding-response.js.map