@slopus/happy-providers 0.0.6 → 0.0.7
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/VENDOR_ANTHROPIC_BEDROCK.md +10 -7
- package/dist/vendors/bedrock/errors/anthropicBedrockErrors.d.ts.map +1 -1
- package/dist/vendors/bedrock/errors/anthropicBedrockErrors.js +11 -8
- package/dist/vendors/bedrock/errors/anthropicBedrockErrors.js.map +1 -1
- package/dist/vendors/bedrock/impl/anthropicBedrockRetry.d.ts +22 -4
- package/dist/vendors/bedrock/impl/anthropicBedrockRetry.d.ts.map +1 -1
- package/dist/vendors/bedrock/impl/anthropicBedrockRetry.js +97 -17
- package/dist/vendors/bedrock/impl/anthropicBedrockRetry.js.map +1 -1
- package/package.json +1 -1
|
@@ -57,13 +57,16 @@ It also emits opaque ordered response items so interleaved thinking, text, and t
|
|
|
57
57
|
be persisted and replayed without reordering.
|
|
58
58
|
|
|
59
59
|
The SDK's hidden retries are disabled. The provider performs Claude-compatible retryable
|
|
60
|
-
connection, 408, 409, 429, and 5xx retries itself and emits `retrying` events.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
connection, 408, 409, 429, and 5xx retries itself and emits `retrying` events. Failures the
|
|
61
|
+
server delivers on an open stream carry no HTTP status and are mapped onto the status they are
|
|
62
|
+
documented to be equivalent to, then follow the same policy. There are two such shapes: an
|
|
63
|
+
Anthropic SSE `error` event, which the SDK throws as an APIError without a status — `api_error`
|
|
64
|
+
maps to 500, `overloaded_error` to 529 — and an AWS Bedrock Runtime eventstream exception, which
|
|
65
|
+
the SDK's smithy layer throws as an AWS ServiceException — `InternalServerException` maps to 500,
|
|
66
|
+
`ThrottlingException` to 429, and so on. After stream content has begun, only dropped connections
|
|
67
|
+
and retryable mid-stream failures are replayed, through the `block_reset` rollback so no visible
|
|
68
|
+
output is duplicated; a stream that produced compaction output is never replayed because
|
|
69
|
+
compaction is stateful on the server.
|
|
67
70
|
|
|
68
71
|
`compact()` always uses Bedrock's native server-side compaction with the `compact-2026-01-12`
|
|
69
72
|
beta and `compact_20260112` context-management edit. It pauses at the native compaction boundary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropicBedrockErrors.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/errors/anthropicBedrockErrors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropicBedrockErrors.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/errors/anthropicBedrockErrors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQrF;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAa3E;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAsB9E;AAED,wBAAgB,qCAAqC,CACjD,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,GACjB,oBAAoB,CAmCtB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIError } from "@anthropic-ai/sdk/error";
|
|
2
2
|
import { extractProviderErrorDiagnostics, extractProviderRetryResetAt, } from "../../../core/extractProviderErrorDiagnostics.js";
|
|
3
|
-
import { anthropicBedrockStreamErrorDetails, isAnthropicBedrockConnectionFailure, resolveAnthropicBedrockErrorStatus, } from "../../../vendors/bedrock/impl/anthropicBedrockRetry.js";
|
|
3
|
+
import { anthropicBedrockRuntimeExceptionDetails, anthropicBedrockStreamErrorDetails, isAnthropicBedrockConnectionFailure, resolveAnthropicBedrockErrorStatus, } from "../../../vendors/bedrock/impl/anthropicBedrockRetry.js";
|
|
4
4
|
/**
|
|
5
5
|
* Surfaced errors must read like a sentence. Raw transport failures such as undici's
|
|
6
6
|
* "terminated" get a human message, and a mid-stream error event's message is lifted out of
|
|
@@ -16,6 +16,9 @@ export function describeAnthropicBedrockErrorMessage(error) {
|
|
|
16
16
|
? "Anthropic Bedrock reported an error while streaming the response."
|
|
17
17
|
: `Anthropic Bedrock reported an error while streaming the response: ${stream.message}.`;
|
|
18
18
|
}
|
|
19
|
+
const runtimeException = anthropicBedrockRuntimeExceptionDetails(error);
|
|
20
|
+
if (runtimeException?.message !== undefined)
|
|
21
|
+
return runtimeException.message;
|
|
19
22
|
return error instanceof Error ? error.message : String(error);
|
|
20
23
|
}
|
|
21
24
|
export function classifyAnthropicBedrockError(error) {
|
|
@@ -32,20 +35,20 @@ export function classifyAnthropicBedrockError(error) {
|
|
|
32
35
|
message.includes("payment required")) {
|
|
33
36
|
return "billing_error";
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return "internal_error";
|
|
41
|
-
}
|
|
38
|
+
const status = resolveAnthropicBedrockErrorStatus(error);
|
|
39
|
+
if (status === 402)
|
|
40
|
+
return "billing_error";
|
|
41
|
+
if (status !== undefined && status >= 500)
|
|
42
|
+
return "internal_error";
|
|
42
43
|
return "unknown";
|
|
43
44
|
}
|
|
44
45
|
export function classifyAnthropicBedrockProviderError(error, attempts) {
|
|
45
46
|
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
+
const runtimeException = anthropicBedrockRuntimeExceptionDetails(error);
|
|
46
48
|
const diagnostics = extractProviderErrorDiagnostics(error, {
|
|
47
49
|
attempts: Math.max(1, attempts),
|
|
48
50
|
upstreamMessage: message,
|
|
51
|
+
...(runtimeException === undefined ? {} : { errorType: runtimeException.name }),
|
|
49
52
|
});
|
|
50
53
|
const status = diagnostics?.status ?? resolveAnthropicBedrockErrorStatus(error);
|
|
51
54
|
const kind = classifyAnthropicBedrockError(error);
|
|
@@ -1 +1 @@
|
|
|
1
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CAAC;QACC,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IACD,IACI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAClC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACvC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EACtC,CAAC;QACC,OAAO,eAAe,CAAC;IAC3B,CAAC;IACD,
|
|
1
|
+
{"version":3,"file":"anthropicBedrockErrors.js","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/errors/anthropicBedrockErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EACH,+BAA+B,EAC/B,2BAA2B,GAC9B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACH,uCAAuC,EACvC,kCAAkC,EAClC,mCAAmC,EACnC,kCAAkC,GACrC,MAAM,iDAAiD,CAAC;AAEzD;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,KAAc;IAC/D,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC,IAAI,mCAAmC,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7E,OAAO,oFAAoF,CAAC;IAChG,CAAC;IACD,MAAM,MAAM,GAAG,kCAAkC,CAAC,KAAK,CAAC,CAAC;IACzD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,OAAO,KAAK,SAAS;YAC/B,CAAC,CAAC,mEAAmE;YACrE,CAAC,CAAC,qEAAqE,MAAM,CAAC,OAAO,GAAG,CAAC;IACjG,CAAC;IACD,MAAM,gBAAgB,GAAG,uCAAuC,CAAC,KAAK,CAAC,CAAC;IACxE,IAAI,gBAAgB,EAAE,OAAO,KAAK,SAAS;QAAE,OAAO,gBAAgB,CAAC,OAAO,CAAC;IAC7E,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAA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AAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;SACxD,CAAC;IACN,CAAC;IACD,OAAO;QACH,IAAI;QACJ,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;KACxD,CAAC;AACN,CAAC"}
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
export declare function shouldRetryAnthropicBedrock(error: unknown, failedAttempts: number, maxRetries: number): boolean;
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The error's HTTP status, or the documented equivalent for a mid-stream SSE error event or an
|
|
4
|
+
* AWS Bedrock eventstream exception.
|
|
5
|
+
*/
|
|
3
6
|
export declare function resolveAnthropicBedrockErrorStatus(error: unknown): number | undefined;
|
|
4
7
|
/**
|
|
5
|
-
* Recognizes a retryable
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Recognizes a retryable error delivered on an already-open response stream: an Anthropic SSE
|
|
9
|
+
* `error` event such as api_error or overloaded_error, or an AWS Bedrock eventstream exception.
|
|
10
|
+
* Unlike HTTP-level failures these can interrupt a response that already produced content, so
|
|
11
|
+
* the session replays them through its block_reset rollback.
|
|
8
12
|
*/
|
|
9
13
|
export declare function isRetryableAnthropicBedrockStreamError(error: unknown): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Parses an AWS Bedrock Runtime exception thrown out of the eventstream, if that is what it is,
|
|
16
|
+
* resolving the HTTP status AWS's schema assigns its name. Both thrown shapes are recognized: a
|
|
17
|
+
* modeled ServiceException by its `$fault`, and an unmodeled bare Error by its camelCase Bedrock
|
|
18
|
+
* exception name. ModelStreamErrorException relays the upstream model's own failure and carries
|
|
19
|
+
* that status; AWS documents it as retryable, so a missing original status is treated as a
|
|
20
|
+
* server error. An unrecognized name counts as a server error only when smithy itself attributed
|
|
21
|
+
* the fault to the server, evidenced by the `$metadata` every deserialized exception carries.
|
|
22
|
+
*/
|
|
23
|
+
export declare function anthropicBedrockRuntimeExceptionDetails(error: unknown): {
|
|
24
|
+
name: string;
|
|
25
|
+
status: number | undefined;
|
|
26
|
+
message: string | undefined;
|
|
27
|
+
} | undefined;
|
|
10
28
|
/**
|
|
11
29
|
* Parses the SSE `error` event body out of an APIError the SDK threw mid-stream. Such an error
|
|
12
30
|
* has no HTTP status; its body is `{"type":"error","error":{"type":...,"message":...}}`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropicBedrockRetry.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/impl/anthropicBedrockRetry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"anthropicBedrockRetry.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/impl/anthropicBedrockRetry.ts"],"names":[],"mappings":"AAwEA,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,GACnB,OAAO,CAKT;AAWD;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOrF;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,uCAAuC,CACnD,KAAK,EAAE,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,CAyBvF;AAoBD;;;GAGG;AACH,wBAAgB,kCAAkC,CAC9C,KAAK,EAAE,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,CAgB3D;AAED,mGAAmG;AACnG,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS3E;AAsBD,wBAAgB,iCAAiC,CAC7C,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM,EACtB,GAAG,GAAE,MAAM,MAAiB,GAC7B,MAAM,CAeR;AAED,wBAAgB,4BAA4B,CACxC,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACnB,MAAM,CAUR"}
|
|
@@ -42,6 +42,27 @@ const ERROR_TYPE_STATUS = {
|
|
|
42
42
|
api_error: 500,
|
|
43
43
|
overloaded_error: 529,
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* AWS Bedrock Runtime's documented exceptions and the HTTP statuses its schema assigns them. A
|
|
47
|
+
* mid-stream failure arrives as an eventstream exception carrying no HTTP status, because the
|
|
48
|
+
* stream itself was an HTTP 200, so retry and classification map the name back onto the status.
|
|
49
|
+
* The SDK's smithy layer throws the members its deserializer models as AWS ServiceExceptions —
|
|
50
|
+
* plain Errors carrying `$fault` and a PascalCase name — and every other member as a bare Error
|
|
51
|
+
* whose name is the camelCase `:exception-type` header and whose message is the raw JSON body.
|
|
52
|
+
*/
|
|
53
|
+
const BEDROCK_EXCEPTION_STATUS = {
|
|
54
|
+
AccessDeniedException: 403,
|
|
55
|
+
ConflictException: 400,
|
|
56
|
+
InternalServerException: 500,
|
|
57
|
+
ModelErrorException: 424,
|
|
58
|
+
ModelNotReadyException: 429,
|
|
59
|
+
ModelTimeoutException: 408,
|
|
60
|
+
ResourceNotFoundException: 404,
|
|
61
|
+
ServiceQuotaExceededException: 400,
|
|
62
|
+
ServiceUnavailableException: 503,
|
|
63
|
+
ThrottlingException: 429,
|
|
64
|
+
ValidationException: 400,
|
|
65
|
+
};
|
|
45
66
|
export function shouldRetryAnthropicBedrock(error, failedAttempts, maxRetries) {
|
|
46
67
|
if (failedAttempts > maxRetries)
|
|
47
68
|
return false;
|
|
@@ -49,8 +70,6 @@ export function shouldRetryAnthropicBedrock(error, failedAttempts, maxRetries) {
|
|
|
49
70
|
return true;
|
|
50
71
|
if (isAnthropicBedrockConnectionFailure(error))
|
|
51
72
|
return true;
|
|
52
|
-
if (!(error instanceof APIError))
|
|
53
|
-
return false;
|
|
54
73
|
return isRetryableAnthropicBedrockStatus(resolveAnthropicBedrockErrorStatus(error));
|
|
55
74
|
}
|
|
56
75
|
function isRetryableAnthropicBedrockStatus(status) {
|
|
@@ -59,25 +78,85 @@ function isRetryableAnthropicBedrockStatus(status) {
|
|
|
59
78
|
status === 429 ||
|
|
60
79
|
(status !== undefined && status >= 500));
|
|
61
80
|
}
|
|
62
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* The error's HTTP status, or the documented equivalent for a mid-stream SSE error event or an
|
|
83
|
+
* AWS Bedrock eventstream exception.
|
|
84
|
+
*/
|
|
63
85
|
export function resolveAnthropicBedrockErrorStatus(error) {
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
if (error instanceof APIError) {
|
|
87
|
+
if (error.status !== undefined)
|
|
88
|
+
return error.status;
|
|
89
|
+
const details = anthropicBedrockStreamErrorDetails(error);
|
|
90
|
+
return details === undefined ? undefined : ERROR_TYPE_STATUS[details.type];
|
|
91
|
+
}
|
|
92
|
+
return anthropicBedrockRuntimeExceptionDetails(error)?.status;
|
|
70
93
|
}
|
|
71
94
|
/**
|
|
72
|
-
* Recognizes a retryable
|
|
73
|
-
*
|
|
74
|
-
*
|
|
95
|
+
* Recognizes a retryable error delivered on an already-open response stream: an Anthropic SSE
|
|
96
|
+
* `error` event such as api_error or overloaded_error, or an AWS Bedrock eventstream exception.
|
|
97
|
+
* Unlike HTTP-level failures these can interrupt a response that already produced content, so
|
|
98
|
+
* the session replays them through its block_reset rollback.
|
|
75
99
|
*/
|
|
76
100
|
export function isRetryableAnthropicBedrockStreamError(error) {
|
|
77
101
|
const details = anthropicBedrockStreamErrorDetails(error);
|
|
78
|
-
if (details
|
|
79
|
-
return
|
|
80
|
-
|
|
102
|
+
if (details !== undefined) {
|
|
103
|
+
return isRetryableAnthropicBedrockStatus(ERROR_TYPE_STATUS[details.type]);
|
|
104
|
+
}
|
|
105
|
+
return isRetryableAnthropicBedrockStatus(anthropicBedrockRuntimeExceptionDetails(error)?.status);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Parses an AWS Bedrock Runtime exception thrown out of the eventstream, if that is what it is,
|
|
109
|
+
* resolving the HTTP status AWS's schema assigns its name. Both thrown shapes are recognized: a
|
|
110
|
+
* modeled ServiceException by its `$fault`, and an unmodeled bare Error by its camelCase Bedrock
|
|
111
|
+
* exception name. ModelStreamErrorException relays the upstream model's own failure and carries
|
|
112
|
+
* that status; AWS documents it as retryable, so a missing original status is treated as a
|
|
113
|
+
* server error. An unrecognized name counts as a server error only when smithy itself attributed
|
|
114
|
+
* the fault to the server, evidenced by the `$metadata` every deserialized exception carries.
|
|
115
|
+
*/
|
|
116
|
+
export function anthropicBedrockRuntimeExceptionDetails(error) {
|
|
117
|
+
if (!(error instanceof Error))
|
|
118
|
+
return undefined;
|
|
119
|
+
const record = error;
|
|
120
|
+
const decorated = (record.$fault === "client" || record.$fault === "server") &&
|
|
121
|
+
typeof record.$metadata === "object" &&
|
|
122
|
+
record.$metadata !== null;
|
|
123
|
+
const name = error.name.charAt(0).toUpperCase() + error.name.slice(1);
|
|
124
|
+
const mapped = BEDROCK_EXCEPTION_STATUS[name];
|
|
125
|
+
const known = typeof mapped === "number" || name === "ModelStreamErrorException";
|
|
126
|
+
if (!known && !decorated)
|
|
127
|
+
return undefined;
|
|
128
|
+
const message = extractBedrockExceptionMessage(error.message);
|
|
129
|
+
if (name === "ModelStreamErrorException") {
|
|
130
|
+
return {
|
|
131
|
+
name,
|
|
132
|
+
status: typeof record.originalStatusCode === "number" ? record.originalStatusCode : 500,
|
|
133
|
+
message,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (typeof mapped === "number")
|
|
137
|
+
return { name, status: mapped, message };
|
|
138
|
+
return { name, status: record.$fault === "server" ? 500 : undefined, message };
|
|
139
|
+
}
|
|
140
|
+
/** The unmodeled eventstream throw carries the raw JSON body as its message; lift the text out. */
|
|
141
|
+
function extractBedrockExceptionMessage(raw) {
|
|
142
|
+
if (raw.length === 0)
|
|
143
|
+
return undefined;
|
|
144
|
+
if (!raw.startsWith("{"))
|
|
145
|
+
return raw;
|
|
146
|
+
try {
|
|
147
|
+
const parsed = JSON.parse(raw);
|
|
148
|
+
const record = typeof parsed === "object" && parsed !== null
|
|
149
|
+
? parsed
|
|
150
|
+
: undefined;
|
|
151
|
+
if (typeof record?.message === "string")
|
|
152
|
+
return record.message;
|
|
153
|
+
if (typeof record?.Message === "string")
|
|
154
|
+
return record.Message;
|
|
155
|
+
return raw;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return raw;
|
|
159
|
+
}
|
|
81
160
|
}
|
|
82
161
|
/**
|
|
83
162
|
* Parses the SSE `error` event body out of an APIError the SDK threw mid-stream. Such an error
|
|
@@ -171,8 +250,9 @@ export function describeAnthropicBedrockRetry(error, failedAttempts, delay, maxR
|
|
|
171
250
|
return error.message;
|
|
172
251
|
const status = error instanceof APIError && error.status !== undefined
|
|
173
252
|
? `HTTP ${error.status}`
|
|
174
|
-
: anthropicBedrockStreamErrorDetails(error) !== undefined
|
|
175
|
-
|
|
253
|
+
: anthropicBedrockStreamErrorDetails(error) !== undefined ||
|
|
254
|
+
anthropicBedrockRuntimeExceptionDetails(error) !== undefined
|
|
255
|
+
? "error during the response stream"
|
|
176
256
|
: "connection failure";
|
|
177
257
|
return `Anthropic Bedrock ${status}; retrying in ${formatDelay(delay)}, attempt ${failedAttempts} of ${maxRetries}.`;
|
|
178
258
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropicBedrockRetry.js","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/impl/anthropicBedrockRetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,YAAY,GAAG,MAAM,CAAC;AAE5B,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACrC,WAAW;IACX,cAAc;IACd,cAAc;IACd,YAAY;IACZ,cAAc;IACd,UAAU;IACV,aAAa;IACb,WAAW;IACX,OAAO;IACP,WAAW;IACX,sBAAsB;IACtB,yBAAyB;IACzB,yBAAyB;IACzB,gBAAgB;CACnB,CAAC,CAAC;AAEH,MAAM,2BAA2B,GAAG;IAChC,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;CACxB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAA2B;IAC9C,qBAAqB,EAAE,GAAG;IAC1B,oBAAoB,EAAE,GAAG;IACzB,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,GAAG;IACrB,eAAe,EAAE,GAAG;IACpB,gBAAgB,EAAE,GAAG;IACrB,aAAa,EAAE,GAAG;IAClB,SAAS,EAAE,GAAG;IACd,gBAAgB,EAAE,GAAG;CACxB,CAAC;AAEF,MAAM,UAAU,2BAA2B,CACvC,KAAc,EACd,cAAsB,EACtB,UAAkB;IAElB,IAAI,cAAc,GAAG,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,oBAAoB,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,mCAAmC,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5D,
|
|
1
|
+
{"version":3,"file":"anthropicBedrockRetry.js","sourceRoot":"","sources":["../../../../sources/vendors/bedrock/impl/anthropicBedrockRetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,YAAY,GAAG,MAAM,CAAC;AAE5B,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACrC,WAAW;IACX,cAAc;IACd,cAAc;IACd,YAAY;IACZ,cAAc;IACd,UAAU;IACV,aAAa;IACb,WAAW;IACX,OAAO;IACP,WAAW;IACX,sBAAsB;IACtB,yBAAyB;IACzB,yBAAyB;IACzB,gBAAgB;CACnB,CAAC,CAAC;AAEH,MAAM,2BAA2B,GAAG;IAChC,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;CACxB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAA2B;IAC9C,qBAAqB,EAAE,GAAG;IAC1B,oBAAoB,EAAE,GAAG;IACzB,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,GAAG;IACrB,eAAe,EAAE,GAAG;IACpB,gBAAgB,EAAE,GAAG;IACrB,aAAa,EAAE,GAAG;IAClB,SAAS,EAAE,GAAG;IACd,gBAAgB,EAAE,GAAG;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAA2B;IACrD,qBAAqB,EAAE,GAAG;IAC1B,iBAAiB,EAAE,GAAG;IACtB,uBAAuB,EAAE,GAAG;IAC5B,mBAAmB,EAAE,GAAG;IACxB,sBAAsB,EAAE,GAAG;IAC3B,qBAAqB,EAAE,GAAG;IAC1B,yBAAyB,EAAE,GAAG;IAC9B,6BAA6B,EAAE,GAAG;IAClC,2BAA2B,EAAE,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