@sap-ai-sdk/orchestration 1.13.1-20250523013202.0 → 1.13.1-20250525013223.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.
@@ -1,4 +1,4 @@
1
- import type { CompletionPostResponseStreaming, TokenUsage, ToolCallChunk } from './client/api/schema/index.js';
1
+ import type { CompletionPostResponseStreaming, LlmChoiceStreaming, TokenUsage, ToolCallChunk } from './client/api/schema/index.js';
2
2
  /**
3
3
  * Orchestration stream chunk response.
4
4
  */
@@ -28,6 +28,12 @@ export declare class OrchestrationStreamChunkResponse {
28
28
  * @returns The message delta content.
29
29
  */
30
30
  getDeltaContent(choiceIndex?: number): string | undefined;
31
+ /**
32
+ * Parses the chunk response and returns the choice by index.
33
+ * @param index - The index of the choice to find.
34
+ * @returns An {@link LLMChoiceStreaming} object associated withe index.
35
+ */
36
+ findChoiceByIndex(index: number): LlmChoiceStreaming | undefined;
31
37
  private getChoices;
32
38
  }
33
39
  //# sourceMappingURL=orchestration-stream-chunk-response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-stream-chunk-response.d.ts","sourceRoot":"","sources":["../src/orchestration-stream-chunk-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAE/B,UAAU,EACV,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,qBAAa,gCAAgC;aACf,IAAI,EAAE,+BAA+B;gBAArC,IAAI,EAAE,+BAA+B;IAIjE;;;OAGG;IACH,aAAa,IAAI,UAAU,GAAG,SAAS;IAIvC;;;;OAIG;IACH,eAAe,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAIpD;;;;OAIG;IACH,iBAAiB,CAAC,WAAW,SAAI,GAAG,aAAa,EAAE,GAAG,SAAS;IAK/D;;;;OAIG;IACH,eAAe,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAIpD,OAAO,CAAC,UAAU;CAGnB"}
1
+ {"version":3,"file":"orchestration-stream-chunk-response.d.ts","sourceRoot":"","sources":["../src/orchestration-stream-chunk-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,kBAAkB,EAClB,UAAU,EACV,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,qBAAa,gCAAgC;aACf,IAAI,EAAE,+BAA+B;gBAArC,IAAI,EAAE,+BAA+B;IAIjE;;;OAGG;IACH,aAAa,IAAI,UAAU,GAAG,SAAS;IAIvC;;;;OAIG;IACH,eAAe,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAIpD;;;;OAIG;IACH,iBAAiB,CAAC,WAAW,SAAI,GAAG,aAAa,EAAE,GAAG,SAAS;IAI/D;;;;OAIG;IACH,eAAe,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAIpD;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAMhE,OAAO,CAAC,UAAU;CAGnB"}
@@ -20,7 +20,7 @@ export class OrchestrationStreamChunkResponse {
20
20
  * @returns The finish reason.
21
21
  */
22
22
  getFinishReason(choiceIndex = 0) {
23
- return this.getChoices()?.find(c => c.index === choiceIndex)?.finish_reason;
23
+ return this.findChoiceByIndex(choiceIndex)?.finish_reason;
24
24
  }
25
25
  /**
26
26
  * Gets the delta tool calls for a specific choice index.
@@ -28,8 +28,7 @@ export class OrchestrationStreamChunkResponse {
28
28
  * @returns The delta tool calls for the specified choice index.
29
29
  */
30
30
  getDeltaToolCalls(choiceIndex = 0) {
31
- return this.getChoices()?.find(c => c.index === choiceIndex)?.delta
32
- .tool_calls;
31
+ return this.findChoiceByIndex(choiceIndex)?.delta.tool_calls;
33
32
  }
34
33
  /**
35
34
  * Parses the chunk response and returns the delta content.
@@ -37,7 +36,15 @@ export class OrchestrationStreamChunkResponse {
37
36
  * @returns The message delta content.
38
37
  */
39
38
  getDeltaContent(choiceIndex = 0) {
40
- return this.getChoices()?.find(c => c.index === choiceIndex)?.delta.content;
39
+ return this.findChoiceByIndex(choiceIndex)?.delta.content;
40
+ }
41
+ /**
42
+ * Parses the chunk response and returns the choice by index.
43
+ * @param index - The index of the choice to find.
44
+ * @returns An {@link LLMChoiceStreaming} object associated withe index.
45
+ */
46
+ findChoiceByIndex(index) {
47
+ return this.getChoices()?.find((c) => c.index === index);
41
48
  }
42
49
  getChoices() {
43
50
  return this.data.orchestration_result?.choices;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-stream-chunk-response.js","sourceRoot":"","sources":["../src/orchestration-stream-chunk-response.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,gCAAgC;IACf;IAA5B,YAA4B,IAAqC;QAArC,SAAI,GAAJ,IAAI,CAAiC;QAC/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,WAAW,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,aAAa,CAAC;IAC9E,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,WAAW,GAAG,CAAC;QAC/B,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,KAAK;aAChE,UAAU,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,WAAW,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAC9E,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACjD,CAAC;CACF"}
1
+ {"version":3,"file":"orchestration-stream-chunk-response.js","sourceRoot":"","sources":["../src/orchestration-stream-chunk-response.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,gCAAgC;IACf;IAA5B,YAA4B,IAAqC;QAArC,SAAI,GAAJ,IAAI,CAAiC;QAC/D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,WAAW,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,WAAW,GAAG,CAAC;QAC/B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,WAAW,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAC5B,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAC7C,CAAC;IACJ,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACjD,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ai-sdk/orchestration",
3
- "version": "1.13.1-20250523013202.0",
3
+ "version": "1.13.1-20250525013223.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -22,9 +22,9 @@
22
22
  "dependencies": {
23
23
  "@sap-cloud-sdk/util": "^4.0.2",
24
24
  "yaml": "^2.8.0",
25
- "@sap-ai-sdk/core": "^1.13.1-20250523013202.0",
26
- "@sap-ai-sdk/ai-api": "^1.13.1-20250523013202.0",
27
- "@sap-ai-sdk/prompt-registry": "^1.13.1-20250523013202.0"
25
+ "@sap-ai-sdk/core": "^1.13.1-20250525013223.0",
26
+ "@sap-ai-sdk/ai-api": "^1.13.1-20250525013223.0",
27
+ "@sap-ai-sdk/prompt-registry": "^1.13.1-20250525013223.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@sap-cloud-sdk/http-client": "^4.0.2",