@llmops/gateway 0.2.8 → 0.2.9
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.cjs +16 -12
- package/dist/index.mjs +16 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10375,7 +10375,7 @@ const retryRequest = async (url, options, retryCount, statusCodesToRetry, timeou
|
|
|
10375
10375
|
|
|
10376
10376
|
//#endregion
|
|
10377
10377
|
//#region package.json
|
|
10378
|
-
var version = "0.2.
|
|
10378
|
+
var version = "0.2.9";
|
|
10379
10379
|
|
|
10380
10380
|
//#endregion
|
|
10381
10381
|
//#region src/providers/bytez/api.ts
|
|
@@ -31103,9 +31103,8 @@ var ResponseService = class {
|
|
|
31103
31103
|
finalMappedResponse = response;
|
|
31104
31104
|
originalResponseJSON = originalResponseJson;
|
|
31105
31105
|
} else ({response: finalMappedResponse, originalResponseJson: originalResponseJSON, responseJson: responseJson} = await this.getResponse(response, responseTransformer, cache.isCacheHit));
|
|
31106
|
-
this.updateHeaders(finalMappedResponse, cache.cacheStatus, retryAttempt);
|
|
31107
31106
|
return {
|
|
31108
|
-
response: finalMappedResponse,
|
|
31107
|
+
response: this.updateHeaders(finalMappedResponse, cache.cacheStatus, retryAttempt),
|
|
31109
31108
|
responseJson,
|
|
31110
31109
|
originalResponseJson: originalResponseJSON
|
|
31111
31110
|
};
|
|
@@ -31115,17 +31114,22 @@ var ResponseService = class {
|
|
|
31115
31114
|
return await responseHandler(this.context.honoContext, response, this.context.isStreaming, this.context.providerOption, responseTransformer, url, isCacheHit, this.context.params, this.context.strictOpenAiCompliance, this.context.honoContext.req.url, this.hooksService.areSyncHooksAvailable, this.hooksService.hookSpan?.id);
|
|
31116
31115
|
}
|
|
31117
31116
|
updateHeaders(response, cacheStatus, retryAttempt) {
|
|
31118
|
-
response.headers
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
if (
|
|
31117
|
+
const headers = new Headers(response.headers);
|
|
31118
|
+
headers.append(RESPONSE_HEADER_KEYS.LAST_USED_OPTION_INDEX, this.context.index.toString());
|
|
31119
|
+
headers.append(RESPONSE_HEADER_KEYS.TRACE_ID, this.context.traceId);
|
|
31120
|
+
headers.append(RESPONSE_HEADER_KEYS.RETRY_ATTEMPT_COUNT, retryAttempt.toString());
|
|
31121
|
+
if (cacheStatus) headers.append(RESPONSE_HEADER_KEYS.CACHE_STATUS, cacheStatus);
|
|
31122
|
+
if (this.context.provider && this.context.provider !== POWERED_BY) headers.append(HEADER_KEYS.PROVIDER, this.context.provider);
|
|
31123
31123
|
if ((0, hono_adapter.getRuntimeKey)() == "node") {
|
|
31124
|
-
|
|
31125
|
-
|
|
31124
|
+
headers.delete("content-encoding");
|
|
31125
|
+
headers.delete("transfer-encoding");
|
|
31126
31126
|
}
|
|
31127
|
-
|
|
31128
|
-
return response
|
|
31127
|
+
headers.delete("content-length");
|
|
31128
|
+
return new Response(response.body, {
|
|
31129
|
+
status: response.status,
|
|
31130
|
+
statusText: response.statusText,
|
|
31131
|
+
headers
|
|
31132
|
+
});
|
|
31129
31133
|
}
|
|
31130
31134
|
};
|
|
31131
31135
|
|
package/dist/index.mjs
CHANGED
|
@@ -10348,7 +10348,7 @@ const retryRequest = async (url, options, retryCount, statusCodesToRetry, timeou
|
|
|
10348
10348
|
|
|
10349
10349
|
//#endregion
|
|
10350
10350
|
//#region package.json
|
|
10351
|
-
var version = "0.2.
|
|
10351
|
+
var version = "0.2.9";
|
|
10352
10352
|
|
|
10353
10353
|
//#endregion
|
|
10354
10354
|
//#region src/providers/bytez/api.ts
|
|
@@ -31076,9 +31076,8 @@ var ResponseService = class {
|
|
|
31076
31076
|
finalMappedResponse = response;
|
|
31077
31077
|
originalResponseJSON = originalResponseJson;
|
|
31078
31078
|
} else ({response: finalMappedResponse, originalResponseJson: originalResponseJSON, responseJson: responseJson} = await this.getResponse(response, responseTransformer, cache.isCacheHit));
|
|
31079
|
-
this.updateHeaders(finalMappedResponse, cache.cacheStatus, retryAttempt);
|
|
31080
31079
|
return {
|
|
31081
|
-
response: finalMappedResponse,
|
|
31080
|
+
response: this.updateHeaders(finalMappedResponse, cache.cacheStatus, retryAttempt),
|
|
31082
31081
|
responseJson,
|
|
31083
31082
|
originalResponseJson: originalResponseJSON
|
|
31084
31083
|
};
|
|
@@ -31088,17 +31087,22 @@ var ResponseService = class {
|
|
|
31088
31087
|
return await responseHandler(this.context.honoContext, response, this.context.isStreaming, this.context.providerOption, responseTransformer, url, isCacheHit, this.context.params, this.context.strictOpenAiCompliance, this.context.honoContext.req.url, this.hooksService.areSyncHooksAvailable, this.hooksService.hookSpan?.id);
|
|
31089
31088
|
}
|
|
31090
31089
|
updateHeaders(response, cacheStatus, retryAttempt) {
|
|
31091
|
-
response.headers
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
if (
|
|
31090
|
+
const headers = new Headers(response.headers);
|
|
31091
|
+
headers.append(RESPONSE_HEADER_KEYS.LAST_USED_OPTION_INDEX, this.context.index.toString());
|
|
31092
|
+
headers.append(RESPONSE_HEADER_KEYS.TRACE_ID, this.context.traceId);
|
|
31093
|
+
headers.append(RESPONSE_HEADER_KEYS.RETRY_ATTEMPT_COUNT, retryAttempt.toString());
|
|
31094
|
+
if (cacheStatus) headers.append(RESPONSE_HEADER_KEYS.CACHE_STATUS, cacheStatus);
|
|
31095
|
+
if (this.context.provider && this.context.provider !== POWERED_BY) headers.append(HEADER_KEYS.PROVIDER, this.context.provider);
|
|
31096
31096
|
if (getRuntimeKey() == "node") {
|
|
31097
|
-
|
|
31098
|
-
|
|
31097
|
+
headers.delete("content-encoding");
|
|
31098
|
+
headers.delete("transfer-encoding");
|
|
31099
31099
|
}
|
|
31100
|
-
|
|
31101
|
-
return response
|
|
31100
|
+
headers.delete("content-length");
|
|
31101
|
+
return new Response(response.body, {
|
|
31102
|
+
status: response.status,
|
|
31103
|
+
statusText: response.statusText,
|
|
31104
|
+
headers
|
|
31105
|
+
});
|
|
31102
31106
|
}
|
|
31103
31107
|
};
|
|
31104
31108
|
|