@velum-labs/routekit-gateway 1.0.1 → 1.0.2
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.
|
@@ -179,7 +179,9 @@ export function handleResponses(backend, body, modelCallId, signal, backendOptio
|
|
|
179
179
|
const upstream = yield* backend.chat(chat, signal, requestOptions);
|
|
180
180
|
if (!upstream.ok) {
|
|
181
181
|
const detail = yield* gatewayTryPromise(() => upstream.text());
|
|
182
|
-
return jsonResponse(upstream.status, {
|
|
182
|
+
return jsonResponse(upstream.status, {
|
|
183
|
+
error: unwrapUpstreamError(detail, { preserveMetadata: true })
|
|
184
|
+
});
|
|
183
185
|
}
|
|
184
186
|
if (executor !== undefined) {
|
|
185
187
|
const loopOptions = {
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
* `invalid_request_error` from the backend must stay an
|
|
9
9
|
* `invalid_request_error` on the door.
|
|
10
10
|
*/
|
|
11
|
-
export declare function unwrapUpstreamError(detail: string
|
|
11
|
+
export declare function unwrapUpstreamError(detail: string, options?: {
|
|
12
|
+
readonly preserveMetadata?: boolean;
|
|
13
|
+
}): {
|
|
12
14
|
type: string;
|
|
13
15
|
message: string;
|
|
16
|
+
code?: string;
|
|
17
|
+
param?: string;
|
|
14
18
|
};
|
|
@@ -8,13 +8,23 @@
|
|
|
8
8
|
* `invalid_request_error` from the backend must stay an
|
|
9
9
|
* `invalid_request_error` on the door.
|
|
10
10
|
*/
|
|
11
|
-
export function unwrapUpstreamError(detail) {
|
|
11
|
+
export function unwrapUpstreamError(detail, options = {}) {
|
|
12
12
|
try {
|
|
13
13
|
const parsed = JSON.parse(detail);
|
|
14
14
|
if (typeof parsed.error?.message === "string") {
|
|
15
15
|
return {
|
|
16
16
|
type: typeof parsed.error.type === "string" ? parsed.error.type : "api_error",
|
|
17
|
-
message: parsed.error.message
|
|
17
|
+
message: parsed.error.message,
|
|
18
|
+
...(options.preserveMetadata === true &&
|
|
19
|
+
typeof parsed.error.code === "string" &&
|
|
20
|
+
parsed.error.code.length > 0
|
|
21
|
+
? { code: parsed.error.code }
|
|
22
|
+
: {}),
|
|
23
|
+
...(options.preserveMetadata === true &&
|
|
24
|
+
typeof parsed.error.param === "string" &&
|
|
25
|
+
parsed.error.param.length > 0
|
|
26
|
+
? { param: parsed.error.param }
|
|
27
|
+
: {})
|
|
18
28
|
};
|
|
19
29
|
}
|
|
20
30
|
}
|
package/dist/routing/router.js
CHANGED
|
@@ -332,6 +332,7 @@ export class RoutingBackend {
|
|
|
332
332
|
error: {
|
|
333
333
|
type: "invalid_request_error",
|
|
334
334
|
code: "unsupported_reasoning_control",
|
|
335
|
+
param: requestedSelection.mode === "effort" ? "reasoning.effort" : "reasoning",
|
|
335
336
|
message: selection
|
|
336
337
|
}
|
|
337
338
|
}, { status: 400 }));
|
|
@@ -422,6 +423,7 @@ export class RoutingBackend {
|
|
|
422
423
|
error: {
|
|
423
424
|
type: "invalid_request_error",
|
|
424
425
|
code: "unsupported_reasoning_control",
|
|
426
|
+
param: requestedSelection.mode === "effort" ? "reasoning.effort" : "reasoning",
|
|
425
427
|
message: selection
|
|
426
428
|
}
|
|
427
429
|
}, { status: 400 }));
|
|
@@ -320,7 +320,9 @@ test("Responses routes discovered Claude efforts to adaptive Anthropic egress",
|
|
|
320
320
|
})
|
|
321
321
|
});
|
|
322
322
|
assert.equal(unsupported.status, 400);
|
|
323
|
-
|
|
323
|
+
const error = (await unsupported.json());
|
|
324
|
+
assert.equal(error.error?.param, "reasoning.effort");
|
|
325
|
+
assert.equal(error.error?.message, 'reasoning effort "max" is not supported by model "claude-code/claude-fable-5"');
|
|
324
326
|
assert.equal(requests.length, 1);
|
|
325
327
|
}
|
|
326
328
|
finally {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velum-labs/routekit-gateway",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/velum-labs/routekit.git",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@aws-sdk/client-bedrock": "3.1095.0",
|
|
46
46
|
"@aws-sdk/client-bedrock-runtime": "3.1095.0",
|
|
47
47
|
"effect": "4.0.0-rc.108",
|
|
48
|
-
"@velum-labs/routekit-config-core": "1.0.
|
|
49
|
-
"@velum-labs/routekit-contracts": "1.0.
|
|
50
|
-
"@velum-labs/routekit-eval-
|
|
51
|
-
"@velum-labs/routekit-
|
|
52
|
-
"@velum-labs/routekit-
|
|
53
|
-
"@velum-labs/routekit-runtime": "1.0.
|
|
48
|
+
"@velum-labs/routekit-config-core": "1.0.2",
|
|
49
|
+
"@velum-labs/routekit-contracts": "1.0.2",
|
|
50
|
+
"@velum-labs/routekit-eval-contracts": "1.0.2",
|
|
51
|
+
"@velum-labs/routekit-eval-core": "1.0.2",
|
|
52
|
+
"@velum-labs/routekit-registry": "1.0.2",
|
|
53
|
+
"@velum-labs/routekit-runtime": "1.0.2"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|
|
56
56
|
"routekit",
|