@sap-ai-sdk/foundation-models 0.1.1-20240917012643.0 → 0.1.1-20240918013048.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/{openai/openai-chat-client.d.ts → azure-openai/azure-openai-chat-client.d.ts} +9 -8
- package/dist/azure-openai/azure-openai-chat-client.d.ts.map +1 -0
- package/dist/{openai/openai-chat-client.js → azure-openai/azure-openai-chat-client.js} +6 -6
- package/dist/azure-openai/azure-openai-chat-client.js.map +1 -0
- package/dist/{openai/openai-response.d.ts → azure-openai/azure-openai-chat-completion-response.d.ts} +7 -7
- package/dist/azure-openai/azure-openai-chat-completion-response.d.ts.map +1 -0
- package/dist/{openai/openai-response.js → azure-openai/azure-openai-chat-completion-response.js} +5 -5
- package/dist/azure-openai/azure-openai-chat-completion-response.js.map +1 -0
- package/dist/{openai/openai-embedding-client.d.ts → azure-openai/azure-openai-embedding-client.d.ts} +9 -7
- package/dist/azure-openai/azure-openai-embedding-client.d.ts.map +1 -0
- package/dist/{openai/openai-embedding-client.js → azure-openai/azure-openai-embedding-client.js} +6 -5
- package/dist/azure-openai/azure-openai-embedding-client.js.map +1 -0
- package/dist/azure-openai/azure-openai-embedding-response.d.ts +21 -0
- package/dist/azure-openai/azure-openai-embedding-response.d.ts.map +1 -0
- package/dist/azure-openai/azure-openai-embedding-response.js +34 -0
- package/dist/azure-openai/azure-openai-embedding-response.js.map +1 -0
- package/dist/azure-openai/azure-openai-types-schema.d.ts +3087 -0
- package/dist/azure-openai/azure-openai-types-schema.d.ts.map +1 -0
- package/dist/azure-openai/azure-openai-types-schema.js +267 -0
- package/dist/azure-openai/azure-openai-types-schema.js.map +1 -0
- package/dist/{openai/openai-types.d.ts → azure-openai/azure-openai-types.d.ts} +71 -71
- package/dist/azure-openai/azure-openai-types.d.ts.map +1 -0
- package/dist/azure-openai/azure-openai-types.js +2 -0
- package/dist/azure-openai/azure-openai-types.js.map +1 -0
- package/dist/azure-openai/index.d.ts +7 -0
- package/dist/azure-openai/index.d.ts.map +1 -0
- package/dist/azure-openai/index.js +7 -0
- package/dist/azure-openai/index.js.map +1 -0
- package/dist/azure-openai/model-types.d.ts +10 -0
- package/dist/azure-openai/model-types.d.ts.map +1 -0
- package/dist/azure-openai/model-types.js +2 -0
- package/dist/azure-openai/model-types.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/package.json +12 -9
- package/dist/openai/index.d.ts +0 -5
- package/dist/openai/index.d.ts.map +0 -1
- package/dist/openai/index.js +0 -5
- package/dist/openai/index.js.map +0 -1
- package/dist/openai/openai-chat-client.d.ts.map +0 -1
- package/dist/openai/openai-chat-client.js.map +0 -1
- package/dist/openai/openai-embedding-client.d.ts.map +0 -1
- package/dist/openai/openai-embedding-client.js.map +0 -1
- package/dist/openai/openai-response.d.ts.map +0 -1
- package/dist/openai/openai-response.js.map +0 -1
- package/dist/openai/openai-types.d.ts.map +0 -1
- package/dist/openai/openai-types.js +0 -2
- package/dist/openai/openai-types.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { type CustomRequestConfig
|
|
1
|
+
import { type CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
2
2
|
import { type ModelDeployment } from '@sap-ai-sdk/ai-api/internal.js';
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { AzureOpenAiChatModel } from './model-types.js';
|
|
4
|
+
import type { AzureOpenAiChatCompletionParameters } from './azure-openai-types.js';
|
|
5
|
+
import { AzureOpenAiChatCompletionResponse } from './azure-openai-chat-completion-response.js';
|
|
5
6
|
/**
|
|
6
|
-
* OpenAI client for chat completion.
|
|
7
|
+
* Azure OpenAI client for chat completion.
|
|
7
8
|
*/
|
|
8
|
-
export declare class
|
|
9
|
+
export declare class AzureOpenAiChatClient {
|
|
9
10
|
private modelDeployment;
|
|
10
11
|
/**
|
|
11
|
-
* Creates an instance of the OpenAI chat client.
|
|
12
|
+
* Creates an instance of the Azure OpenAI chat client.
|
|
12
13
|
* @param modelDeployment - This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.
|
|
13
14
|
*/
|
|
14
15
|
constructor(modelDeployment: ModelDeployment<AzureOpenAiChatModel>);
|
|
@@ -18,6 +19,6 @@ export declare class OpenAiChatClient {
|
|
|
18
19
|
* @param requestConfig - The request configuration.
|
|
19
20
|
* @returns The completion result.
|
|
20
21
|
*/
|
|
21
|
-
run(data:
|
|
22
|
+
run(data: AzureOpenAiChatCompletionParameters, requestConfig?: CustomRequestConfig): Promise<AzureOpenAiChatCompletionResponse>;
|
|
22
23
|
}
|
|
23
|
-
//# sourceMappingURL=openai-chat-client.d.ts.map
|
|
24
|
+
//# sourceMappingURL=azure-openai-chat-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-chat-client.d.ts","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAI/F;;GAEG;AACH,qBAAa,qBAAqB;IAKpB,OAAO,CAAC,eAAe;IAJnC;;;OAGG;gBACiB,eAAe,EAAE,eAAe,CAAC,oBAAoB,CAAC;IAE1E;;;;;OAKG;IACG,GAAG,CACP,IAAI,EAAE,mCAAmC,EACzC,aAAa,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,iCAAiC,CAAC;CAe9C"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { executeRequest } from '@sap-ai-sdk/core';
|
|
2
2
|
import { getDeploymentId } from '@sap-ai-sdk/ai-api/internal.js';
|
|
3
|
-
import {
|
|
3
|
+
import { AzureOpenAiChatCompletionResponse } from './azure-openai-chat-completion-response.js';
|
|
4
4
|
const apiVersion = '2024-02-01';
|
|
5
5
|
/**
|
|
6
|
-
* OpenAI client for chat completion.
|
|
6
|
+
* Azure OpenAI client for chat completion.
|
|
7
7
|
*/
|
|
8
|
-
export class
|
|
8
|
+
export class AzureOpenAiChatClient {
|
|
9
9
|
modelDeployment;
|
|
10
10
|
/**
|
|
11
|
-
* Creates an instance of the OpenAI chat client.
|
|
11
|
+
* Creates an instance of the Azure OpenAI chat client.
|
|
12
12
|
* @param modelDeployment - This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.
|
|
13
13
|
*/
|
|
14
14
|
constructor(modelDeployment) {
|
|
@@ -26,7 +26,7 @@ export class OpenAiChatClient {
|
|
|
26
26
|
url: `/inference/deployments/${deploymentId}/chat/completions`,
|
|
27
27
|
apiVersion
|
|
28
28
|
}, data, requestConfig);
|
|
29
|
-
return new
|
|
29
|
+
return new AzureOpenAiChatCompletionResponse(response);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=openai-chat-client.js.map
|
|
32
|
+
//# sourceMappingURL=azure-openai-chat-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-chat-client.js","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EACL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAE/F,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAKZ;IAJpB;;;OAGG;IACH,YAAoB,eAAsD;QAAtD,oBAAe,GAAf,eAAe,CAAuC;IAAG,CAAC;IAE9E;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,IAAyC,EACzC,aAAmC;QAEnC,MAAM,YAAY,GAAG,MAAM,eAAe,CACxC,IAAI,CAAC,eAAe,EACpB,cAAc,CACf,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,cAAc,CACnC;YACE,GAAG,EAAE,0BAA0B,YAAY,mBAAmB;YAC9D,UAAU;SACX,EACD,IAAI,EACJ,aAAa,CACd,CAAC;QACF,OAAO,IAAI,iCAAiC,CAAC,QAAQ,CAAC,CAAC;IACzD,CAAC;CACF"}
|
package/dist/{openai/openai-response.d.ts → azure-openai/azure-openai-chat-completion-response.d.ts}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { HttpResponse } from '@sap-cloud-sdk/http-client';
|
|
2
|
-
import {
|
|
2
|
+
import { AzureOpenAiChatCompletionOutput, AzureOpenAiUsage } from './azure-openai-types.js';
|
|
3
3
|
/**
|
|
4
|
-
* OpenAI chat completion response.
|
|
4
|
+
* Azure OpenAI chat completion response.
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class AzureOpenAiChatCompletionResponse {
|
|
7
7
|
readonly rawResponse: HttpResponse;
|
|
8
8
|
/**
|
|
9
9
|
* The chat completion response.
|
|
10
10
|
*/
|
|
11
|
-
readonly data:
|
|
11
|
+
readonly data: AzureOpenAiChatCompletionOutput;
|
|
12
12
|
constructor(rawResponse: HttpResponse);
|
|
13
13
|
/**
|
|
14
14
|
* Usage of tokens in the response.
|
|
15
15
|
* @returns Token usage.
|
|
16
16
|
*/
|
|
17
|
-
getTokenUsage():
|
|
17
|
+
getTokenUsage(): AzureOpenAiUsage;
|
|
18
18
|
/**
|
|
19
19
|
* Reason for stopping the completion.
|
|
20
20
|
* @param choiceIndex - The index of the choice to parse.
|
|
@@ -22,11 +22,11 @@ export declare class OpenAiChatCompletionResponse {
|
|
|
22
22
|
*/
|
|
23
23
|
getFinishReason(choiceIndex?: number): string | undefined;
|
|
24
24
|
/**
|
|
25
|
-
* Parses the
|
|
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;
|
|
30
30
|
private logInvalidChoiceIndex;
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=openai-response.d.ts.map
|
|
32
|
+
//# sourceMappingURL=azure-openai-chat-completion-response.d.ts.map
|
|
@@ -0,0 +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":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EACL,+BAA+B,EAC/B,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAOjC;;GAEG;AACH,qBAAa,iCAAiC;aAMhB,WAAW,EAAE,YAAY;IALrD;;OAEG;IACH,SAAgB,IAAI,EAAE,+BAA+B,CAAC;gBAE1B,WAAW,EAAE,YAAY;IAIrD;;;OAGG;IACH,aAAa,IAAI,gBAAgB;IAIjC;;;;OAIG;IACH,eAAe,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAKpD;;;;OAIG;IACH,UAAU,CAAC,WAAW,SAAI,GAAG,MAAM,GAAG,SAAS;IAK/C,OAAO,CAAC,qBAAqB;CAK9B"}
|
package/dist/{openai/openai-response.js → azure-openai/azure-openai-chat-completion-response.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createLogger } from '@sap-cloud-sdk/util';
|
|
2
2
|
const logger = createLogger({
|
|
3
3
|
package: 'gen-ai-hub',
|
|
4
|
-
messageContext: 'openai-response'
|
|
4
|
+
messageContext: 'azure-openai-chat-completion-response'
|
|
5
5
|
});
|
|
6
6
|
/**
|
|
7
|
-
* OpenAI chat completion response.
|
|
7
|
+
* Azure OpenAI chat completion response.
|
|
8
8
|
*/
|
|
9
|
-
export class
|
|
9
|
+
export class AzureOpenAiChatCompletionResponse {
|
|
10
10
|
rawResponse;
|
|
11
11
|
/**
|
|
12
12
|
* The chat completion response.
|
|
@@ -33,7 +33,7 @@ export class OpenAiChatCompletionResponse {
|
|
|
33
33
|
return this.data.choices[choiceIndex]?.finish_reason;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Parses the
|
|
36
|
+
* Parses the Azure OpenAI response and returns the content.
|
|
37
37
|
* @param choiceIndex - The index of the choice to parse.
|
|
38
38
|
* @returns The message content.
|
|
39
39
|
*/
|
|
@@ -47,4 +47,4 @@ export class OpenAiChatCompletionResponse {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
//# sourceMappingURL=openai-response.js.map
|
|
50
|
+
//# sourceMappingURL=azure-openai-chat-completion-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-chat-completion-response.js","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-chat-completion-response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAMnD,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,uCAAuC;CACxD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,OAAO,iCAAiC;IAMhB;IAL5B;;OAEG;IACa,IAAI,CAAkC;IAEtD,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,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"}
|
package/dist/{openai/openai-embedding-client.d.ts → azure-openai/azure-openai-embedding-client.d.ts}
RENAMED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { type CustomRequestConfig
|
|
1
|
+
import { type CustomRequestConfig } from '@sap-ai-sdk/core';
|
|
2
2
|
import { type ModelDeployment } from '@sap-ai-sdk/ai-api/internal.js';
|
|
3
|
-
import
|
|
3
|
+
import { AzureOpenAiEmbeddingResponse } from './azure-openai-embedding-response.js';
|
|
4
|
+
import type { AzureOpenAiEmbeddingParameters } from './azure-openai-types.js';
|
|
5
|
+
import type { AzureOpenAiEmbeddingModel } from './model-types.js';
|
|
4
6
|
/**
|
|
5
|
-
* OpenAI client for embeddings.
|
|
7
|
+
* Azure OpenAI client for embeddings.
|
|
6
8
|
*/
|
|
7
|
-
export declare class
|
|
9
|
+
export declare class AzureOpenAiEmbeddingClient {
|
|
8
10
|
private modelDeployment;
|
|
9
11
|
/**
|
|
10
|
-
* Creates an instance of the OpenAI embedding client.
|
|
12
|
+
* Creates an instance of the Azure OpenAI embedding client.
|
|
11
13
|
* @param modelDeployment - This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.
|
|
12
14
|
*/
|
|
13
15
|
constructor(modelDeployment: ModelDeployment<AzureOpenAiEmbeddingModel>);
|
|
@@ -17,6 +19,6 @@ export declare class OpenAiEmbeddingClient {
|
|
|
17
19
|
* @param requestConfig - The request configuration.
|
|
18
20
|
* @returns The completion result.
|
|
19
21
|
*/
|
|
20
|
-
run(data:
|
|
22
|
+
run(data: AzureOpenAiEmbeddingParameters, requestConfig?: CustomRequestConfig): Promise<AzureOpenAiEmbeddingResponse>;
|
|
21
23
|
}
|
|
22
|
-
//# sourceMappingURL=openai-embedding-client.d.ts.map
|
|
24
|
+
//# sourceMappingURL=azure-openai-embedding-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-embedding-client.d.ts","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-embedding-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAIlE;;GAEG;AACH,qBAAa,0BAA0B;IAOnC,OAAO,CAAC,eAAe;IANzB;;;OAGG;gBAGO,eAAe,EAAE,eAAe,CAAC,yBAAyB,CAAC;IAGrE;;;;;OAKG;IACG,GAAG,CACP,IAAI,EAAE,8BAA8B,EACpC,aAAa,CAAC,EAAE,mBAAmB,GAClC,OAAO,CAAC,4BAA4B,CAAC;CAYzC"}
|
package/dist/{openai/openai-embedding-client.js → azure-openai/azure-openai-embedding-client.js}
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { executeRequest } from '@sap-ai-sdk/core';
|
|
2
2
|
import { getDeploymentId } from '@sap-ai-sdk/ai-api/internal.js';
|
|
3
|
+
import { AzureOpenAiEmbeddingResponse } from './azure-openai-embedding-response.js';
|
|
3
4
|
const apiVersion = '2024-02-01';
|
|
4
5
|
/**
|
|
5
|
-
* OpenAI client for embeddings.
|
|
6
|
+
* Azure OpenAI client for embeddings.
|
|
6
7
|
*/
|
|
7
|
-
export class
|
|
8
|
+
export class AzureOpenAiEmbeddingClient {
|
|
8
9
|
modelDeployment;
|
|
9
10
|
/**
|
|
10
|
-
* Creates an instance of the OpenAI embedding client.
|
|
11
|
+
* Creates an instance of the Azure OpenAI embedding client.
|
|
11
12
|
* @param modelDeployment - This configuration is used to retrieve a deployment. Depending on the configuration use either the given deployment ID or the model name to retrieve matching deployments. If model and deployment ID are given, the model is verified against the deployment.
|
|
12
13
|
*/
|
|
13
14
|
constructor(modelDeployment) {
|
|
@@ -22,7 +23,7 @@ export class OpenAiEmbeddingClient {
|
|
|
22
23
|
async run(data, requestConfig) {
|
|
23
24
|
const deploymentId = await getDeploymentId(this.modelDeployment, 'azure-openai');
|
|
24
25
|
const response = await executeRequest({ url: `/inference/deployments/${deploymentId}/embeddings`, apiVersion }, data, requestConfig);
|
|
25
|
-
return response
|
|
26
|
+
return new AzureOpenAiEmbeddingResponse(response);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
//# sourceMappingURL=openai-embedding-client.js.map
|
|
29
|
+
//# sourceMappingURL=azure-openai-embedding-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-embedding-client.js","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-embedding-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EACL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAIpF,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAO3B;IANV;;;OAGG;IAEH,YACU,eAA2D;QAA3D,oBAAe,GAAf,eAAe,CAA4C;IAClE,CAAC;IAEJ;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,IAAoC,EACpC,aAAmC;QAEnC,MAAM,YAAY,GAAG,MAAM,eAAe,CACxC,IAAI,CAAC,eAAe,EACpB,cAAc,CACf,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,cAAc,CACnC,EAAE,GAAG,EAAE,0BAA0B,YAAY,aAAa,EAAE,UAAU,EAAE,EACxE,IAAI,EACJ,aAAa,CACd,CAAC;QACF,OAAO,IAAI,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HttpResponse } from '@sap-cloud-sdk/http-client';
|
|
2
|
+
import { AzureOpenAiEmbeddingOutput } from './azure-openai-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Azure OpenAI embedding response.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AzureOpenAiEmbeddingResponse {
|
|
7
|
+
readonly rawResponse: HttpResponse;
|
|
8
|
+
/**
|
|
9
|
+
* The embedding response.
|
|
10
|
+
*/
|
|
11
|
+
readonly data: AzureOpenAiEmbeddingOutput;
|
|
12
|
+
constructor(rawResponse: HttpResponse);
|
|
13
|
+
/**
|
|
14
|
+
* Parses the Azure OpenAI response and returns the embedding.
|
|
15
|
+
* @param dataIndex - The index of the data to parse.
|
|
16
|
+
* @returns The message content.
|
|
17
|
+
*/
|
|
18
|
+
getEmbedding(dataIndex?: number): number[] | undefined;
|
|
19
|
+
private logInvalidDataIndex;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=azure-openai-embedding-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-embedding-response.d.ts","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-embedding-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAOrE;;GAEG;AACH,qBAAa,4BAA4B;aAMX,WAAW,EAAE,YAAY;IALrD;;OAEG;IACH,SAAgB,IAAI,EAAE,0BAA0B,CAAC;gBAErB,WAAW,EAAE,YAAY;IAIrD;;;;OAIG;IACH,YAAY,CAAC,SAAS,SAAI,GAAG,MAAM,EAAE,GAAG,SAAS;IAKjD,OAAO,CAAC,mBAAmB;CAK5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createLogger } from '@sap-cloud-sdk/util';
|
|
2
|
+
const logger = createLogger({
|
|
3
|
+
package: 'gen-ai-hub',
|
|
4
|
+
messageContext: 'azure-openai-embedding-response'
|
|
5
|
+
});
|
|
6
|
+
/**
|
|
7
|
+
* Azure OpenAI embedding response.
|
|
8
|
+
*/
|
|
9
|
+
export class AzureOpenAiEmbeddingResponse {
|
|
10
|
+
rawResponse;
|
|
11
|
+
/**
|
|
12
|
+
* The embedding response.
|
|
13
|
+
*/
|
|
14
|
+
data;
|
|
15
|
+
constructor(rawResponse) {
|
|
16
|
+
this.rawResponse = rawResponse;
|
|
17
|
+
this.data = rawResponse.data;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parses the Azure OpenAI response and returns the embedding.
|
|
21
|
+
* @param dataIndex - The index of the data to parse.
|
|
22
|
+
* @returns The message content.
|
|
23
|
+
*/
|
|
24
|
+
getEmbedding(dataIndex = 0) {
|
|
25
|
+
this.logInvalidDataIndex(dataIndex);
|
|
26
|
+
return this.data.data[0]?.embedding;
|
|
27
|
+
}
|
|
28
|
+
logInvalidDataIndex(dataIndex) {
|
|
29
|
+
if (dataIndex < 0 || dataIndex >= this.data.data.length) {
|
|
30
|
+
logger.error(`Data index ${dataIndex} is out of bounds.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=azure-openai-embedding-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azure-openai-embedding-response.js","sourceRoot":"","sources":["../../src/azure-openai/azure-openai-embedding-response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,MAAM,GAAG,YAAY,CAAC;IAC1B,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,iCAAiC;CAClD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAMX;IAL5B;;OAEG;IACa,IAAI,CAA6B;IAEjD,YAA4B,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;QACnD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAS,GAAG,CAAC;QACxB,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;IACtC,CAAC;IAEO,mBAAmB,CAAC,SAAiB;QAC3C,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACxD,MAAM,CAAC,KAAK,CAAC,cAAc,SAAS,oBAAoB,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;CACF"}
|