@sap-ai-sdk/orchestration 2.1.1-20251114013311.0 → 2.1.1-20251115013243.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/model-types.d.ts +5 -1
- package/dist/model-types.d.ts.map +1 -1
- package/dist/orchestration-embedding-client.d.ts +29 -0
- package/dist/orchestration-embedding-client.d.ts.map +1 -0
- package/dist/orchestration-embedding-client.js +45 -0
- package/dist/orchestration-embedding-client.js.map +1 -0
- package/dist/orchestration-embedding-response.d.ts +27 -0
- package/dist/orchestration-embedding-response.d.ts.map +1 -0
- package/dist/orchestration-embedding-response.js +38 -0
- package/dist/orchestration-embedding-response.js.map +1 -0
- package/dist/orchestration-types.d.ts +70 -2
- package/dist/orchestration-types.d.ts.map +1 -1
- package/dist/orchestration-types.js.map +1 -1
- package/dist/util/module-config.d.ts +7 -2
- package/dist/util/module-config.d.ts.map +1 -1
- package/dist/util/module-config.js +48 -12
- package/dist/util/module-config.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export type { OrchestrationModuleConfig, PromptTemplatingModule, MaskingModule, GroundingModule, FilteringModule, TranslationModule, PromptTemplate, ChatCompletionRequest, RequestOptions, StreamOptions, DocumentGroundingServiceConfig, DocumentGroundingServiceFilter, DpiMaskingConfig, LlmModelParams, LlmModelDetails, LlamaGuard38BCategory, LlamaGuard38BFilterReturnType, LlamaGuard38BInputFilterConfig, LlamaGuard38BOutputFilterConfig, AzureFilterThreshold, AzureContentSafetyFilterInputParameters, AzureContentSafetyFilterOutputParameters, AzureContentSafetyFilterParameters, AzureContentSafetyFilterReturnType, OrchestrationErrorResponse, DpiMaskingProviderConfig, TranslationConfigParams, TranslationInputParameters, TranslationOutputParameters, TranslationReturnType, TranslationInputConfig, TranslationOutputConfig } from './orchestration-types.js';
|
|
1
|
+
export type { OrchestrationModuleConfig, PromptTemplatingModule, MaskingModule, GroundingModule, FilteringModule, TranslationModule, PromptTemplate, ChatCompletionRequest, RequestOptions, StreamOptions, DocumentGroundingServiceConfig, DocumentGroundingServiceFilter, DpiMaskingConfig, LlmModelParams, LlmModelDetails, LlamaGuard38BCategory, LlamaGuard38BFilterReturnType, LlamaGuard38BInputFilterConfig, LlamaGuard38BOutputFilterConfig, AzureFilterThreshold, AzureContentSafetyFilterInputParameters, AzureContentSafetyFilterOutputParameters, AzureContentSafetyFilterParameters, AzureContentSafetyFilterReturnType, OrchestrationErrorResponse, DpiMaskingProviderConfig, TranslationConfigParams, TranslationInputParameters, TranslationOutputParameters, TranslationReturnType, TranslationInputConfig, TranslationOutputConfig, EmbeddingRequest, EmbeddingModelConfig, EmbeddingModelDetails, EmbeddingModelParams, EmbeddingModuleConfig, EmbeddingData } from './orchestration-types.js';
|
|
2
2
|
export { OrchestrationStreamResponse } from './orchestration-stream-response.js';
|
|
3
3
|
export { OrchestrationStreamChunkResponse } from './orchestration-stream-chunk-response.js';
|
|
4
4
|
export { OrchestrationStream } from './orchestration-stream.js';
|
|
5
5
|
export { OrchestrationClient } from './orchestration-client.js';
|
|
6
6
|
export { OrchestrationResponse } from './orchestration-response.js';
|
|
7
|
-
export
|
|
7
|
+
export { OrchestrationEmbeddingClient } from './orchestration-embedding-client.js';
|
|
8
|
+
export { OrchestrationEmbeddingResponse } from './orchestration-embedding-response.js';
|
|
9
|
+
export type { ChatModel, EmbeddingModel } from './model-types.js';
|
|
8
10
|
export { buildAzureContentSafetyFilter, buildLlamaGuard38BFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildTranslationConfig } from './util/index.js';
|
|
9
11
|
/**
|
|
10
12
|
* Exporting frequently used types.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,8BAA8B,EAC9B,8BAA8B,EAC9B,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,+BAA+B,EAC/B,oBAAoB,EACpB,uCAAuC,EACvC,wCAAwC,EACxC,kCAAkC,EAClC,kCAAkC,EAClC,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,8BAA8B,EAC9B,8BAA8B,EAC9B,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,+BAA+B,EAC/B,oBAAoB,EACpB,uCAAuC,EACvC,wCAAwC,EACxC,kCAAkC,EAClC,kCAAkC,EAClC,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACf,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,7 @@ export { OrchestrationStreamChunkResponse } from './orchestration-stream-chunk-r
|
|
|
3
3
|
export { OrchestrationStream } from './orchestration-stream.js';
|
|
4
4
|
export { OrchestrationClient } from './orchestration-client.js';
|
|
5
5
|
export { OrchestrationResponse } from './orchestration-response.js';
|
|
6
|
+
export { OrchestrationEmbeddingClient } from './orchestration-embedding-client.js';
|
|
7
|
+
export { OrchestrationEmbeddingResponse } from './orchestration-embedding-response.js';
|
|
6
8
|
export { buildAzureContentSafetyFilter, buildLlamaGuard38BFilter, buildDocumentGroundingConfig, buildDpiMaskingProvider, buildTranslationConfig } from './util/index.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAGvF,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC"}
|
package/dist/model-types.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type { AiCoreOpenSourceChatModel, AwsBedrockChatModel, AzureOpenAiChatModel, GcpVertexAiChatModel, PerplexityChatModel } from '@sap-ai-sdk/core';
|
|
1
|
+
import type { AiCoreOpenSourceChatModel, AiCoreOpenSourceEmbeddingModel, AwsBedrockChatModel, AwsBedrockEmbeddingModel, AzureOpenAiChatModel, AzureOpenAiEmbeddingModel, GcpVertexAiChatModel, PerplexityChatModel } from '@sap-ai-sdk/core';
|
|
2
2
|
/**
|
|
3
3
|
* Supported chat models for orchestration.
|
|
4
4
|
*/
|
|
5
5
|
export type ChatModel = AzureOpenAiChatModel | GcpVertexAiChatModel | AwsBedrockChatModel | PerplexityChatModel | AiCoreOpenSourceChatModel;
|
|
6
|
+
/**
|
|
7
|
+
* Supported embedding models for orchestration.
|
|
8
|
+
*/
|
|
9
|
+
export type EmbeddingModel = AzureOpenAiEmbeddingModel | AwsBedrockEmbeddingModel | AiCoreOpenSourceEmbeddingModel;
|
|
6
10
|
//# sourceMappingURL=model-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-types.d.ts","sourceRoot":"","sources":["../src/model-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"model-types.d.ts","sourceRoot":"","sources":["../src/model-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,8BAA8B,EAC9B,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,yBAAyB,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,wBAAwB,GACxB,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OrchestrationEmbeddingResponse } from './orchestration-embedding-response.js';
|
|
2
|
+
import type { CustomRequestConfig } from '@sap-cloud-sdk/http-client';
|
|
3
|
+
import type { DeploymentIdConfig, ResourceGroupConfig } from '@sap-ai-sdk/ai-api/internal.js';
|
|
4
|
+
import type { EmbeddingModuleConfig, EmbeddingRequest } from './orchestration-types.js';
|
|
5
|
+
import type { HttpDestinationOrFetchOptions } from '@sap-cloud-sdk/connectivity';
|
|
6
|
+
/**
|
|
7
|
+
* Orchestration embedding client for generating embeddings with optional orchestration modules.
|
|
8
|
+
*/
|
|
9
|
+
export declare class OrchestrationEmbeddingClient {
|
|
10
|
+
private config;
|
|
11
|
+
private deploymentConfig?;
|
|
12
|
+
private destination?;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of the orchestration embedding client.
|
|
15
|
+
* @param config - Embedding module configuration.
|
|
16
|
+
* @param deploymentConfig - Deployment configuration.
|
|
17
|
+
* @param destination - The destination to use for the request.
|
|
18
|
+
*/
|
|
19
|
+
constructor(config: EmbeddingModuleConfig, deploymentConfig?: (ResourceGroupConfig | DeploymentIdConfig) | undefined, destination?: HttpDestinationOrFetchOptions | undefined);
|
|
20
|
+
/**
|
|
21
|
+
* Generate embeddings for the given input.
|
|
22
|
+
* @param request - Embedding request configuration.
|
|
23
|
+
* @param requestConfig - Custom request configuration.
|
|
24
|
+
* @returns Promise resolving to embedding response.
|
|
25
|
+
*/
|
|
26
|
+
embed(request: EmbeddingRequest, requestConfig?: CustomRequestConfig): Promise<OrchestrationEmbeddingResponse>;
|
|
27
|
+
private executeRequest;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=orchestration-embedding-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-embedding-client.d.ts","sourceRoot":"","sources":["../src/orchestration-embedding-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAEvF,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,qBAAa,4BAA4B;IAQrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,gBAAgB,CAAC;IACzB,OAAO,CAAC,WAAW,CAAC;IATtB;;;;;OAKG;gBAEO,MAAM,EAAE,qBAAqB,EAC7B,gBAAgB,CAAC,GAAE,mBAAmB,GAAG,kBAAkB,aAAA,EAC3D,WAAW,CAAC,EAAE,6BAA6B,YAAA;IAGrD;;;;;OAKG;IACG,KAAK,CACT,OAAO,EAAE,gBAAgB,EACzB,aAAa,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,8BAA8B,CAAC;YAK5B,cAAc;CAyB7B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { executeRequest } from '@sap-ai-sdk/core';
|
|
2
|
+
import { getOrchestrationDeploymentId } from './deployment-resolver.js';
|
|
3
|
+
import { OrchestrationEmbeddingResponse } from './orchestration-embedding-response.js';
|
|
4
|
+
import { constructEmbeddingPostRequest } from './util/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Orchestration embedding client for generating embeddings with optional orchestration modules.
|
|
7
|
+
*/
|
|
8
|
+
export class OrchestrationEmbeddingClient {
|
|
9
|
+
config;
|
|
10
|
+
deploymentConfig;
|
|
11
|
+
destination;
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of the orchestration embedding client.
|
|
14
|
+
* @param config - Embedding module configuration.
|
|
15
|
+
* @param deploymentConfig - Deployment configuration.
|
|
16
|
+
* @param destination - The destination to use for the request.
|
|
17
|
+
*/
|
|
18
|
+
constructor(config, deploymentConfig, destination) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
this.deploymentConfig = deploymentConfig;
|
|
21
|
+
this.destination = destination;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Generate embeddings for the given input.
|
|
25
|
+
* @param request - Embedding request configuration.
|
|
26
|
+
* @param requestConfig - Custom request configuration.
|
|
27
|
+
* @returns Promise resolving to embedding response.
|
|
28
|
+
*/
|
|
29
|
+
async embed(request, requestConfig) {
|
|
30
|
+
const response = await this.executeRequest(request, requestConfig);
|
|
31
|
+
return new OrchestrationEmbeddingResponse(response);
|
|
32
|
+
}
|
|
33
|
+
async executeRequest(request, requestConfig) {
|
|
34
|
+
const body = constructEmbeddingPostRequest(this.config, request);
|
|
35
|
+
const deploymentId = await getOrchestrationDeploymentId(this.deploymentConfig ?? {}, this.destination);
|
|
36
|
+
if (!deploymentId) {
|
|
37
|
+
throw new Error('Failed to resolve deployment ID');
|
|
38
|
+
}
|
|
39
|
+
return executeRequest({
|
|
40
|
+
url: `/inference/deployments/${deploymentId}/v2/embeddings`,
|
|
41
|
+
...(this.deploymentConfig ?? {})
|
|
42
|
+
}, body, requestConfig, this.destination);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=orchestration-embedding-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-embedding-client.js","sourceRoot":"","sources":["../src/orchestration-embedding-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAehE;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAQ7B;IACA;IACA;IATV;;;;;OAKG;IACH,YACU,MAA6B,EAC7B,gBAA2D,EAC3D,WAA2C;QAF3C,WAAM,GAAN,MAAM,CAAuB;QAC7B,qBAAgB,GAAhB,gBAAgB,CAA2C;QAC3D,gBAAW,GAAX,WAAW,CAAgC;IAClD,CAAC;IAEJ;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CACT,OAAyB,EACzB,aAAmC;QAEnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACnE,OAAO,IAAI,8BAA8B,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAEO,KAAK,CAAC,cAAc,CAC1B,OAAyB,EACzB,aAAmC;QAEnC,MAAM,IAAI,GAAG,6BAA6B,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEjE,MAAM,YAAY,GAAG,MAAM,4BAA4B,CACrD,IAAI,CAAC,gBAAgB,IAAI,EAAE,EAC3B,IAAI,CAAC,WAAW,CACjB,CAAC;QAEF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,cAAc,CACnB;YACE,GAAG,EAAE,0BAA0B,YAAY,gBAAgB;YAC3D,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC;SACjC,EACD,IAAI,EACJ,aAAa,EACb,IAAI,CAAC,WAAW,CACjB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HttpResponse } from '@sap-cloud-sdk/http-client';
|
|
2
|
+
import type { EmbeddingsPostResponse, EmbeddingsUsage, ModuleResultsBase } from './client/api/schema/index.js';
|
|
3
|
+
import type { EmbeddingData } from './orchestration-types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Response wrapper for orchestration embedding requests.
|
|
6
|
+
*/
|
|
7
|
+
export declare class OrchestrationEmbeddingResponse {
|
|
8
|
+
readonly response: HttpResponse;
|
|
9
|
+
readonly _data: EmbeddingsPostResponse;
|
|
10
|
+
constructor(response: HttpResponse);
|
|
11
|
+
/**
|
|
12
|
+
* Final embedding results with index and object type (which is always `embedding`) information.
|
|
13
|
+
* @returns Array of embedding data objects containing both vectors, indices, and object types.
|
|
14
|
+
*/
|
|
15
|
+
getEmbeddings(): EmbeddingData[];
|
|
16
|
+
/**
|
|
17
|
+
* Usage information.
|
|
18
|
+
* @returns Usage information or undefined.
|
|
19
|
+
*/
|
|
20
|
+
getTokenUsage(): EmbeddingsUsage;
|
|
21
|
+
/**
|
|
22
|
+
* Intermediate results from orchestration modules.
|
|
23
|
+
* @returns Intermediate results or undefined.
|
|
24
|
+
*/
|
|
25
|
+
getIntermediateResults(): ModuleResultsBase | undefined;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=orchestration-embedding-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-embedding-response.d.ts","sourceRoot":"","sources":["../src/orchestration-embedding-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EACV,sBAAsB,EAEtB,eAAe,EACf,iBAAiB,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;GAEG;AACH,qBAAa,8BAA8B;aAGb,QAAQ,EAAE,YAAY;IAFlD,SAAgB,KAAK,EAAE,sBAAsB,CAAC;gBAElB,QAAQ,EAAE,YAAY;IAIlD;;;OAGG;IACH,aAAa,IAAI,aAAa,EAAE;IAQhC;;;OAGG;IACH,aAAa,IAAI,eAAe;IAIhC;;;OAGG;IACH,sBAAsB,IAAI,iBAAiB,GAAG,SAAS;CAGxD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response wrapper for orchestration embedding requests.
|
|
3
|
+
*/
|
|
4
|
+
export class OrchestrationEmbeddingResponse {
|
|
5
|
+
response;
|
|
6
|
+
_data;
|
|
7
|
+
constructor(response) {
|
|
8
|
+
this.response = response;
|
|
9
|
+
this._data = response.data;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Final embedding results with index and object type (which is always `embedding`) information.
|
|
13
|
+
* @returns Array of embedding data objects containing both vectors, indices, and object types.
|
|
14
|
+
*/
|
|
15
|
+
getEmbeddings() {
|
|
16
|
+
// TODO: Remove non-null assertion when final_result is made mandatory in the schema
|
|
17
|
+
return this._data.final_result.data.map((result) => ({
|
|
18
|
+
embedding: result.embedding,
|
|
19
|
+
index: result.index,
|
|
20
|
+
object: 'embedding'
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Usage information.
|
|
25
|
+
* @returns Usage information or undefined.
|
|
26
|
+
*/
|
|
27
|
+
getTokenUsage() {
|
|
28
|
+
return this._data.final_result.usage;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Intermediate results from orchestration modules.
|
|
32
|
+
* @returns Intermediate results or undefined.
|
|
33
|
+
*/
|
|
34
|
+
getIntermediateResults() {
|
|
35
|
+
return this._data.intermediate_results;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=orchestration-embedding-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration-embedding-response.js","sourceRoot":"","sources":["../src/orchestration-embedding-response.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,OAAO,8BAA8B;IAGb;IAFZ,KAAK,CAAyB;IAE9C,YAA4B,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAChD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,oFAAoF;QACpF,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAuB,EAAE,EAAE,CAAC,CAAC;YACpE,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,WAAW;SACpB,CAAC,CAAC,CAAC;IACN,CAAC;IACD;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,sBAAsB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Xor } from '@sap-cloud-sdk/util';
|
|
2
2
|
import type { CustomRequestConfig } from '@sap-cloud-sdk/http-client';
|
|
3
|
-
import type { ChatModel } from './model-types.js';
|
|
4
|
-
import type { ChatMessages, DataRepositoryType, DocumentGroundingFilter, DpiConfig, DpiEntities, FilteringStreamOptions, LlamaGuard38B, LLMModelDetails as OriginalLLMModelDetails, Template, TemplateRef, TemplatingChatMessage, DPIStandardEntity, DPICustomEntity, InputFilteringConfig, OutputFilteringConfig, MaskingProviderConfig, GlobalStreamOptions, ErrorResponse, AzureContentSafetyInputFilterConfig, AzureContentSafetyOutputFilterConfig, LlamaGuard38BFilterConfig, SAPDocumentTranslationInput, SAPDocumentTranslationOutput } from './client/api/schema/index.js';
|
|
3
|
+
import type { ChatModel, EmbeddingModel } from './model-types.js';
|
|
4
|
+
import type { ChatMessages, DataRepositoryType, DocumentGroundingFilter, DpiConfig, DpiEntities, FilteringStreamOptions, LlamaGuard38B, LLMModelDetails as OriginalLLMModelDetails, Template, TemplateRef, TemplatingChatMessage, DPIStandardEntity, DPICustomEntity, InputFilteringConfig, OutputFilteringConfig, MaskingProviderConfig, GlobalStreamOptions, ErrorResponse, AzureContentSafetyInputFilterConfig, AzureContentSafetyOutputFilterConfig, LlamaGuard38BFilterConfig, EmbeddingsModelDetails as OriginalEmbeddingsModelDetails, EmbeddingsModelParams as OriginalEmbeddingsModelParams, SAPDocumentTranslationInput, SAPDocumentTranslationOutput } from './client/api/schema/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Chat completion request configuration.
|
|
7
7
|
*/
|
|
@@ -438,5 +438,73 @@ export type LlamaGuard38BFilterReturnType<T extends ConfigType> = T extends 'inp
|
|
|
438
438
|
* Representation of the 'DpiConfig' schema.
|
|
439
439
|
*/
|
|
440
440
|
export type DpiMaskingProviderConfig = DpiConfig;
|
|
441
|
+
/**
|
|
442
|
+
* Embedding request configuration.
|
|
443
|
+
*/
|
|
444
|
+
export interface EmbeddingRequest {
|
|
445
|
+
/**
|
|
446
|
+
* Text input for which embeddings need to be generated.
|
|
447
|
+
* Can be a single string or array of strings.
|
|
448
|
+
* @example
|
|
449
|
+
* input: "This is a text to embed" or
|
|
450
|
+
* input: ["Text 1", "Text 2", "Text 3"]
|
|
451
|
+
*/
|
|
452
|
+
input: string | string[];
|
|
453
|
+
/**
|
|
454
|
+
* Represents the task for which the embeddings need to be generated.
|
|
455
|
+
* @default 'text'
|
|
456
|
+
*/
|
|
457
|
+
type?: 'text' | 'document' | 'query';
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Embedding model details.
|
|
461
|
+
*/
|
|
462
|
+
export type EmbeddingModelDetails = Omit<OriginalEmbeddingsModelDetails, 'name' | 'params'> & {
|
|
463
|
+
name: EmbeddingModel;
|
|
464
|
+
params?: EmbeddingModelParams;
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Embedding model parameters.
|
|
468
|
+
*/
|
|
469
|
+
export type EmbeddingModelParams = OriginalEmbeddingsModelParams;
|
|
470
|
+
/**
|
|
471
|
+
* Embedding model configuration.
|
|
472
|
+
*/
|
|
473
|
+
export interface EmbeddingModelConfig {
|
|
474
|
+
/**
|
|
475
|
+
* Model details for embedding generation.
|
|
476
|
+
*/
|
|
477
|
+
model: EmbeddingModelDetails;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Embedding module configuration.
|
|
481
|
+
*/
|
|
482
|
+
export interface EmbeddingModuleConfig {
|
|
483
|
+
/**
|
|
484
|
+
* Embeddings model configuration.
|
|
485
|
+
*/
|
|
486
|
+
embeddings: EmbeddingModelConfig;
|
|
487
|
+
/**
|
|
488
|
+
* Masking module configuration.
|
|
489
|
+
*/
|
|
490
|
+
masking?: MaskingModule;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Embedding data with vector and index information.
|
|
494
|
+
*/
|
|
495
|
+
export interface EmbeddingData {
|
|
496
|
+
/**
|
|
497
|
+
* The object type, which is always "embedding".
|
|
498
|
+
*/
|
|
499
|
+
object: 'embedding';
|
|
500
|
+
/**
|
|
501
|
+
* The embedding vector, either as a number array or base64-encoded string.
|
|
502
|
+
*/
|
|
503
|
+
embedding: number[] | string;
|
|
504
|
+
/**
|
|
505
|
+
* The index of the embedding in the list of embeddings.
|
|
506
|
+
*/
|
|
507
|
+
index: number;
|
|
508
|
+
}
|
|
441
509
|
export {};
|
|
442
510
|
//# sourceMappingURL=orchestration-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-types.d.ts","sourceRoot":"","sources":["../src/orchestration-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestration-types.d.ts","sourceRoot":"","sources":["../src/orchestration-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,eAAe,IAAI,uBAAuB,EAC1C,QAAQ,EACR,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,mCAAmC,EACnC,oCAAoC,EACpC,yBAAyB,EACzB,sBAAsB,IAAI,8BAA8B,EACxD,qBAAqB,IAAI,6BAA6B,EACtD,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC;IAE/B;;;;;;;;;;;;;OAaG;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,GAAG,MAAM,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestration-types.js","sourceRoot":"","sources":["../src/orchestration-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orchestration-types.js","sourceRoot":"","sources":["../src/orchestration-types.ts"],"names":[],"mappings":"AA2YA;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,CAAC;IACjB,qBAAqB,EAAE,CAAC;IACxB,SAAS,EAAE,CAAC;CACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatCompletionRequest, StreamOptions, OrchestrationModuleConfig } from '../orchestration-types.js';
|
|
2
|
-
import type { CompletionPostRequest, FilteringStreamOptions, ModuleConfigs, OrchestrationConfig, OutputFilteringConfig, PromptTemplatingModuleConfig } from '../client/api/schema/index.js';
|
|
1
|
+
import type { ChatCompletionRequest, StreamOptions, OrchestrationModuleConfig, EmbeddingModuleConfig, EmbeddingRequest } from '../orchestration-types.js';
|
|
2
|
+
import type { CompletionPostRequest, FilteringStreamOptions, ModuleConfigs, OrchestrationConfig, OutputFilteringConfig, PromptTemplatingModuleConfig, EmbeddingsPostRequest } from '../client/api/schema/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -20,4 +20,9 @@ export declare function addStreamOptions(moduleConfigs: ModuleConfigs, streamOpt
|
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export declare function constructCompletionPostRequest(config: OrchestrationModuleConfig, request?: ChatCompletionRequest, stream?: boolean, streamOptions?: StreamOptions): CompletionPostRequest;
|
|
23
|
+
/**
|
|
24
|
+
* Constructs an embedding post request from the given configuration and request.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function constructEmbeddingPostRequest(config: EmbeddingModuleConfig, request: EmbeddingRequest): EmbeddingsPostRequest;
|
|
23
28
|
//# sourceMappingURL=module-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-config.d.ts","sourceRoot":"","sources":["../../src/util/module-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,yBAAyB,
|
|
1
|
+
{"version":3,"file":"module-config.d.ts","sourceRoot":"","sources":["../../src/util/module-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EAErB,4BAA4B,EAE5B,qBAAqB,EAGtB,MAAM,+BAA+B,CAAC;AAOvC;;GAEG;AACH,wBAAgB,kDAAkD,CAChE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,CAAC,EAAE,qBAAqB,EAC9B,MAAM,CAAC,EAAE,OAAO,GACf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAkBrB;AAED;;GAEG;AACH,wBAAgB,8CAA8C,CAC5D,4BAA4B,EAAE,4BAA4B,EAC1D,aAAa,CAAC,EAAE,aAAa,GAC5B,4BAA4B,CAqB9B;AAED;;GAEG;AACH,wBAAgB,uCAAuC,CACrD,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB,GAC7C,qBAAqB,CAQvB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,aAAa,EAC5B,aAAa,CAAC,EAAE,aAAa,GAC5B,mBAAmB,CAkCrB;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,yBAAyB,EACjC,OAAO,CAAC,EAAE,qBAAqB,EAC/B,MAAM,CAAC,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,aAAa,GAC5B,qBAAqB,CAcvB;AAiDD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,qBAAqB,CAavB"}
|
|
@@ -94,6 +94,20 @@ export function addStreamOptions(moduleConfigs, streamOptions) {
|
|
|
94
94
|
* @internal
|
|
95
95
|
*/
|
|
96
96
|
export function constructCompletionPostRequest(config, request, stream, streamOptions) {
|
|
97
|
+
const moduleConfigurations = buildCompletionModulesConfig(config, request);
|
|
98
|
+
return {
|
|
99
|
+
config: stream
|
|
100
|
+
? addStreamOptions(moduleConfigurations, streamOptions)
|
|
101
|
+
: { modules: moduleConfigurations },
|
|
102
|
+
...(request?.placeholderValues && {
|
|
103
|
+
placeholder_values: request.placeholderValues
|
|
104
|
+
}),
|
|
105
|
+
...(request?.messagesHistory && {
|
|
106
|
+
messages_history: request.messagesHistory
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function buildCompletionModulesConfig(config, request) {
|
|
97
111
|
const { promptTemplating, filtering, masking, grounding, translation } = config;
|
|
98
112
|
// prompt is not a string here as it is already parsed in `parseAndMergeTemplating` method
|
|
99
113
|
const prompt = {
|
|
@@ -110,7 +124,7 @@ export function constructCompletionPostRequest(config, request, stream, streamOp
|
|
|
110
124
|
...(request?.messages || [])
|
|
111
125
|
];
|
|
112
126
|
}
|
|
113
|
-
|
|
127
|
+
return {
|
|
114
128
|
prompt_templating: {
|
|
115
129
|
...promptTemplating,
|
|
116
130
|
prompt
|
|
@@ -120,21 +134,43 @@ export function constructCompletionPostRequest(config, request, stream, streamOp
|
|
|
120
134
|
...(grounding && Object.keys(grounding).length && { grounding }),
|
|
121
135
|
...(translation && Object.keys(translation).length && { translation })
|
|
122
136
|
};
|
|
123
|
-
return {
|
|
124
|
-
config: stream
|
|
125
|
-
? addStreamOptions(moduleConfigurations, streamOptions)
|
|
126
|
-
: { modules: moduleConfigurations },
|
|
127
|
-
...(request?.placeholderValues && {
|
|
128
|
-
placeholder_values: request.placeholderValues
|
|
129
|
-
}),
|
|
130
|
-
...(request?.messagesHistory && {
|
|
131
|
-
messages_history: request.messagesHistory
|
|
132
|
-
})
|
|
133
|
-
};
|
|
134
137
|
}
|
|
135
138
|
function isTemplate(templating) {
|
|
136
139
|
return (templating &&
|
|
137
140
|
typeof templating === 'object' &&
|
|
138
141
|
!('template_ref' in templating));
|
|
139
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Constructs an embedding post request from the given configuration and request.
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export function constructEmbeddingPostRequest(config, request) {
|
|
148
|
+
const orchestrationConfig = {
|
|
149
|
+
modules: buildEmbeddingModulesConfig(config)
|
|
150
|
+
};
|
|
151
|
+
const embeddingRequest = {
|
|
152
|
+
config: orchestrationConfig,
|
|
153
|
+
input: {
|
|
154
|
+
text: request.input,
|
|
155
|
+
...(request.type && { type: request.type })
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return embeddingRequest;
|
|
159
|
+
}
|
|
160
|
+
function buildEmbeddingModulesConfig(config) {
|
|
161
|
+
const { embeddings, masking } = config;
|
|
162
|
+
const { model } = embeddings;
|
|
163
|
+
const { name, version, params } = model;
|
|
164
|
+
const modules = {
|
|
165
|
+
embeddings: {
|
|
166
|
+
model: {
|
|
167
|
+
name,
|
|
168
|
+
...(version && { version }),
|
|
169
|
+
...(params && { params })
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
...(masking && Object.keys(masking).length && { masking })
|
|
173
|
+
};
|
|
174
|
+
return modules;
|
|
175
|
+
}
|
|
140
176
|
//# sourceMappingURL=module-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-config.js","sourceRoot":"","sources":["../../src/util/module-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,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A4B;QACvC,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI;gBACJ,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC;gBAC3B,GAAG,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;aAC1B;SACF;QACD,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,IAAI,EAAE,OAAO,EAAE,CAAC;KAC3D,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ai-sdk/orchestration",
|
|
3
|
-
"version": "2.1.1-
|
|
3
|
+
"version": "2.1.1-20251115013243.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@sap-cloud-sdk/util": "^4.1.2",
|
|
29
29
|
"yaml": "^2.8.1",
|
|
30
|
-
"@sap-ai-sdk/core": "^2.1.1-
|
|
31
|
-
"@sap-ai-sdk/ai-api": "^2.1.1-
|
|
32
|
-
"@sap-ai-sdk/prompt-registry": "^2.1.1-
|
|
30
|
+
"@sap-ai-sdk/core": "^2.1.1-20251115013243.0",
|
|
31
|
+
"@sap-ai-sdk/ai-api": "^2.1.1-20251115013243.0",
|
|
32
|
+
"@sap-ai-sdk/prompt-registry": "^2.1.1-20251115013243.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@sap-cloud-sdk/http-client": "^4.1.2",
|