@adobe/spacecat-shared-gpt-client 1.5.14 → 1.5.16
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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/clients/firefall-client.js +3 -4
- package/src/clients/genvar-client.js +4 -2
- package/src/utils.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-gpt-client-v1.5.16](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.5.15...@adobe/spacecat-shared-gpt-client-v1.5.16) (2025-07-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([#845](https://github.com/adobe/spacecat-shared/issues/845)) ([23bd3a2](https://github.com/adobe/spacecat-shared/commit/23bd3a2235686480cb89d6379276d9ed000baea3))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-gpt-client-v1.5.15](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.5.14...@adobe/spacecat-shared-gpt-client-v1.5.15) (2025-06-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* sanitize headers before logging ([#810](https://github.com/adobe/spacecat-shared/issues/810)) ([775168f](https://github.com/adobe/spacecat-shared/commit/775168fa013c615c53ae936805e81c42a6c349c2))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-gpt-client-v1.5.14](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.5.13...@adobe/spacecat-shared-gpt-client-v1.5.14) (2025-05-31)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-gpt-client",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.16",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - GPT Client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@adobe/spacecat-shared-utils": "1.26.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"chai": "5.2.
|
|
43
|
+
"chai": "5.2.1",
|
|
44
44
|
"chai-as-promised": "8.0.1",
|
|
45
45
|
"nock": "14.0.5",
|
|
46
46
|
"sinon": "20.0.0",
|
|
@@ -14,7 +14,7 @@ import { createUrl } from '@adobe/fetch';
|
|
|
14
14
|
import { ImsClient } from '@adobe/spacecat-shared-ims-client';
|
|
15
15
|
import { hasText, isObject, isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
16
16
|
|
|
17
|
-
import { fetch as httpFetch } from '../utils.js';
|
|
17
|
+
import { fetch as httpFetch, sanitizeHeaders } from '../utils.js';
|
|
18
18
|
|
|
19
19
|
const USER_ROLE_IMAGE_URL_TYPE = 'image_url';
|
|
20
20
|
const USER_ROLE_TEXT_TYPE = 'text';
|
|
@@ -125,7 +125,7 @@ export default class FirefallClient {
|
|
|
125
125
|
'x-gw-ims-org-id': this.config.imsOrg,
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
this.log.info(`
|
|
128
|
+
this.log.info(`[Firefall API Call]]: ${url}, Headers: ${JSON.stringify(sanitizeHeaders(headers))}`);
|
|
129
129
|
|
|
130
130
|
const response = await httpFetch(url, {
|
|
131
131
|
method: 'POST',
|
|
@@ -158,7 +158,7 @@ export default class FirefallClient {
|
|
|
158
158
|
'x-gw-ims-org-id': this.config.imsOrg,
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
this.log.info(`URL: ${url}, Headers: ${JSON.stringify(headers)}`);
|
|
161
|
+
this.log.info(`URL: ${url}, Headers: ${JSON.stringify(sanitizeHeaders(headers))}`);
|
|
162
162
|
|
|
163
163
|
const response = await httpFetch(
|
|
164
164
|
createUrl(url),
|
|
@@ -314,7 +314,6 @@ export default class FirefallClient {
|
|
|
314
314
|
const result = output.capability_response.generations[0][0];
|
|
315
315
|
|
|
316
316
|
this.log.info(`Generation Info: ${JSON.stringify(result.generation_info)}`);
|
|
317
|
-
this.log.info(`LLM Info: ${JSON.stringify(output.capability_response.llm_output)}`);
|
|
318
317
|
|
|
319
318
|
return result.text;
|
|
320
319
|
} catch (error) {
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
tracingFetch,
|
|
19
19
|
} from '@adobe/spacecat-shared-utils';
|
|
20
20
|
|
|
21
|
+
import { sanitizeHeaders } from '../utils.js';
|
|
22
|
+
|
|
21
23
|
export default class GenvarClient {
|
|
22
24
|
static createFrom(context) {
|
|
23
25
|
const { log = console } = context;
|
|
@@ -84,7 +86,7 @@ export default class GenvarClient {
|
|
|
84
86
|
'x-gw-ims-org-id': this.config.imsOrg,
|
|
85
87
|
};
|
|
86
88
|
|
|
87
|
-
this.log.info(`[Genvar API Call] URL: ${url}, Headers: ${JSON.stringify(
|
|
89
|
+
this.log.info(`[Genvar API Call] URL: ${url}, Headers: ${JSON.stringify(sanitizeHeaders(headers))}`);
|
|
88
90
|
|
|
89
91
|
let response;
|
|
90
92
|
let responseJsonObj;
|
|
@@ -121,7 +123,7 @@ export default class GenvarClient {
|
|
|
121
123
|
'x-gw-ims-org-id': this.config.imsOrg,
|
|
122
124
|
};
|
|
123
125
|
|
|
124
|
-
this.log.info(`[Genvar API Call] URL: ${url}, Headers: ${JSON.stringify(
|
|
126
|
+
this.log.info(`[Genvar API Call] URL: ${url}, Headers: ${JSON.stringify(sanitizeHeaders(headers))}`);
|
|
125
127
|
|
|
126
128
|
let response;
|
|
127
129
|
try {
|
package/src/utils.js
CHANGED
|
@@ -16,3 +16,11 @@ import { context as h2, h1 } from '@adobe/fetch';
|
|
|
16
16
|
export const { fetch } = process.env.HELIX_FETCH_FORCE_HTTP1
|
|
17
17
|
? h1()
|
|
18
18
|
: h2();
|
|
19
|
+
|
|
20
|
+
export function sanitizeHeaders(headers) {
|
|
21
|
+
return {
|
|
22
|
+
...headers,
|
|
23
|
+
...(headers.Authorization && { Authorization: '***' }),
|
|
24
|
+
...(headers['x-api-key'] && { 'x-api-key': '****' }),
|
|
25
|
+
};
|
|
26
|
+
}
|