@sap-ai-sdk/foundation-models 1.2.1-20241114013105.0 → 1.2.1-20241115013129.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.
@@ -20,13 +20,12 @@ export declare class AzureOpenAiChatCompletionResponse {
20
20
  * @param choiceIndex - The index of the choice to parse.
21
21
  * @returns The finish reason.
22
22
  */
23
- getFinishReason(choiceIndex?: number): this['data']['choices'][0]['finish_reason'];
23
+ getFinishReason(choiceIndex?: number): string | undefined;
24
24
  /**
25
25
  * Parses the Azure OpenAI response and returns the content.
26
26
  * @param choiceIndex - The index of the choice to parse.
27
27
  * @returns The message content.
28
28
  */
29
29
  getContent(choiceIndex?: number): string | undefined | null;
30
- private logInvalidChoiceIndex;
31
30
  }
32
31
  //# sourceMappingURL=azure-openai-chat-completion-response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure-openai-chat-completion-response.d.ts","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-completion-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAOlG;;GAEG;AACH,qBAAa,iCAAiC;aAKhB,WAAW,EAAE,YAAY;IAJrD;;OAEG;IACH,SAAgB,IAAI,EAAE,uCAAuC,CAAC;gBAClC,WAAW,EAAE,YAAY;IAIrD;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;IAItC;;;;OAIG;IACH,eAAe,CACb,WAAW,SAAI,GACd,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;IAK9C;;;;OAIG;IACH,UAAU,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI;IAKtD,OAAO,CAAC,qBAAqB;CAK9B"}
1
+ {"version":3,"file":"azure-openai-chat-completion-response.d.ts","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-completion-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,oCAAoC,CAAC;AAElG;;GAEG;AACH,qBAAa,iCAAiC;aAKhB,WAAW,EAAE,YAAY;IAJrD;;OAEG;IACH,SAAgB,IAAI,EAAE,uCAAuC,CAAC;gBAClC,WAAW,EAAE,YAAY;IAIrD;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;IAItC;;;;OAIG;IACH,eAAe,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAIpD;;;;OAIG;IACH,UAAU,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI;CAIvD"}
@@ -1,8 +1,3 @@
1
- import { createLogger } from '@sap-cloud-sdk/util';
2
- const logger = createLogger({
3
- package: 'foundation-models',
4
- messageContext: 'azure-openai-chat-completion-response'
5
- });
6
1
  /**
7
2
  * Azure OpenAI chat completion response.
8
3
  */
@@ -29,8 +24,7 @@ export class AzureOpenAiChatCompletionResponse {
29
24
  * @returns The finish reason.
30
25
  */
31
26
  getFinishReason(choiceIndex = 0) {
32
- this.logInvalidChoiceIndex(choiceIndex);
33
- return this.data.choices[choiceIndex]?.finish_reason;
27
+ return this.data.choices.find(c => c.index === choiceIndex)?.finish_reason;
34
28
  }
35
29
  /**
36
30
  * Parses the Azure OpenAI response and returns the content.
@@ -38,13 +32,8 @@ export class AzureOpenAiChatCompletionResponse {
38
32
  * @returns The message content.
39
33
  */
40
34
  getContent(choiceIndex = 0) {
41
- this.logInvalidChoiceIndex(choiceIndex);
42
- return this.data.choices[choiceIndex]?.message?.content;
43
- }
44
- logInvalidChoiceIndex(choiceIndex) {
45
- if (choiceIndex < 0 || choiceIndex >= this.data.choices.length) {
46
- logger.error(`Choice index ${choiceIndex} is out of bounds.`);
47
- }
35
+ return this.data.choices.find(c => c.index === choiceIndex)?.message
36
+ ?.content;
48
37
  }
49
38
  }
50
39
  //# sourceMappingURL=azure-openai-chat-completion-response.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure-openai-chat-completion-response.js","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-completion-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,OAAO,EAAE,mBAAmB;IAC5B,cAAc,EAAE,uCAAuC;CACxD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,OAAO,iCAAiC;IAKhB;IAJ5B;;OAEG;IACa,IAAI,CAA0C;IAC9D,YAA4B,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;QACnD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,eAAe,CACb,WAAW,GAAG,CAAC;QAEf,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,WAAW,GAAG,CAAC;QACxB,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;IAC1D,CAAC;IAEO,qBAAqB,CAAC,WAAmB;QAC/C,IAAI,WAAW,GAAG,CAAC,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAC/D,MAAM,CAAC,KAAK,CAAC,gBAAgB,WAAW,oBAAoB,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"azure-openai-chat-completion-response.js","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-completion-response.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,iCAAiC;IAKhB;IAJ5B;;OAEG;IACa,IAAI,CAA0C;IAC9D,YAA4B,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;QACnD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,WAAW,GAAG,CAAC;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,aAAa,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,WAAW,GAAG,CAAC;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,OAAO;YAClE,EAAE,OAAO,CAAC;IACd,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ai-sdk/foundation-models",
3
- "version": "1.2.1-20241114013105.0",
3
+ "version": "1.2.1-20241115013129.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -22,8 +22,8 @@
22
22
  "dependencies": {
23
23
  "@sap-cloud-sdk/http-client": "^3.22.2",
24
24
  "@sap-cloud-sdk/util": "^3.22.2",
25
- "@sap-ai-sdk/ai-api": "^1.2.1-20241114013105.0",
26
- "@sap-ai-sdk/core": "^1.2.1-20241114013105.0"
25
+ "@sap-ai-sdk/ai-api": "^1.2.1-20241115013129.0",
26
+ "@sap-ai-sdk/core": "^1.2.1-20241115013129.0"
27
27
  },
28
28
  "scripts": {
29
29
  "compile": "tsc",