@core-ai/anthropic 0.7.1 → 0.8.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/index.js +14 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11,11 +11,13 @@ import {
|
|
|
11
11
|
} from "@core-ai/core-ai";
|
|
12
12
|
|
|
13
13
|
// src/chat-adapter.ts
|
|
14
|
-
import { APIError } from "@anthropic-ai/sdk";
|
|
14
|
+
import { APIError, APIUserAbortError } from "@anthropic-ai/sdk";
|
|
15
15
|
import {
|
|
16
|
+
AbortedError,
|
|
16
17
|
asObject,
|
|
17
18
|
getProviderMetadata,
|
|
18
19
|
ProviderError,
|
|
20
|
+
ValidationError,
|
|
19
21
|
safeParseJsonObject,
|
|
20
22
|
zodSchemaToJsonSchema
|
|
21
23
|
} from "@core-ai/core-ai";
|
|
@@ -429,26 +431,30 @@ function validateAnthropicReasoningConfig(modelId, options, anthropicOptions) {
|
|
|
429
431
|
return;
|
|
430
432
|
}
|
|
431
433
|
if (options.temperature !== void 0) {
|
|
432
|
-
throw new
|
|
434
|
+
throw new ValidationError(
|
|
433
435
|
`Anthropic model "${modelId}" does not support temperature when reasoning is enabled`,
|
|
436
|
+
void 0,
|
|
434
437
|
"anthropic"
|
|
435
438
|
);
|
|
436
439
|
}
|
|
437
440
|
if (options.topP !== void 0 && (options.topP < 0.95 || options.topP > 1)) {
|
|
438
|
-
throw new
|
|
441
|
+
throw new ValidationError(
|
|
439
442
|
`Anthropic model "${modelId}" requires topP between 0.95 and 1 when reasoning is enabled`,
|
|
443
|
+
void 0,
|
|
440
444
|
"anthropic"
|
|
441
445
|
);
|
|
442
446
|
}
|
|
443
447
|
if (options.toolChoice && options.toolChoice !== "auto" && options.toolChoice !== "none") {
|
|
444
|
-
throw new
|
|
448
|
+
throw new ValidationError(
|
|
445
449
|
`Anthropic model "${modelId}" only supports toolChoice "auto" or "none" when reasoning is enabled`,
|
|
450
|
+
void 0,
|
|
446
451
|
"anthropic"
|
|
447
452
|
);
|
|
448
453
|
}
|
|
449
454
|
if (anthropicOptions?.topK !== void 0) {
|
|
450
|
-
throw new
|
|
455
|
+
throw new ValidationError(
|
|
451
456
|
`Anthropic model "${modelId}" does not support top_k when reasoning is enabled`,
|
|
457
|
+
void 0,
|
|
452
458
|
"anthropic"
|
|
453
459
|
);
|
|
454
460
|
}
|
|
@@ -759,6 +765,9 @@ function extractThinkingText(value) {
|
|
|
759
765
|
}).join("");
|
|
760
766
|
}
|
|
761
767
|
function wrapError(error) {
|
|
768
|
+
if (error instanceof APIUserAbortError || error instanceof Error && error.name === "AbortError") {
|
|
769
|
+
return new AbortedError(error, "anthropic");
|
|
770
|
+
}
|
|
762
771
|
if (error instanceof APIError) {
|
|
763
772
|
return new ProviderError(
|
|
764
773
|
error.message,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@core-ai/anthropic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Anthropic provider package for @core-ai/core-ai",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Omnifact (https://omnifact.ai)",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test:watch": "vitest"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@core-ai/core-ai": "^0.
|
|
45
|
+
"@core-ai/core-ai": "^0.8.0",
|
|
46
46
|
"@anthropic-ai/sdk": "^0.78.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|