@effect/ai-anthropic 4.0.0-beta.4 → 4.0.0-beta.6
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/AnthropicLanguageModel.js +8 -6
- package/dist/AnthropicLanguageModel.js.map +1 -1
- package/dist/AnthropicTool.d.ts +15 -15
- package/dist/Generated.d.ts +1018 -1018
- package/package.json +3 -3
- package/src/AnthropicLanguageModel.ts +12 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/ai-anthropic",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An Anthropic provider integration for Effect AI SDK",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"provenance": true
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"effect": "^4.0.0-beta.
|
|
46
|
+
"effect": "^4.0.0-beta.6"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"effect": "^4.0.0-beta.
|
|
49
|
+
"effect": "^4.0.0-beta.6"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"codegen": "effect-utils codegen",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Arr from "effect/Array"
|
|
6
6
|
import * as DateTime from "effect/DateTime"
|
|
7
7
|
import * as Effect from "effect/Effect"
|
|
8
|
-
import * as
|
|
8
|
+
import * as Encoding from "effect/Encoding"
|
|
9
9
|
import { dual } from "effect/Function"
|
|
10
10
|
import * as Layer from "effect/Layer"
|
|
11
11
|
import * as Predicate from "effect/Predicate"
|
|
@@ -624,7 +624,7 @@ const prepareMessages = Effect.fnUntraced(
|
|
|
624
624
|
|
|
625
625
|
const source = isUrlData(part.data)
|
|
626
626
|
? { type: "url", url: getUrlString(part.data) } as const
|
|
627
|
-
: { type: "base64", media_type: mediaType, data:
|
|
627
|
+
: { type: "base64", media_type: mediaType, data: Encoding.encodeBase64(part.data) } as const
|
|
628
628
|
|
|
629
629
|
content.push({ type: "image", source, cache_control: cacheControl })
|
|
630
630
|
} else if (part.mediaType === "application/pdf" || part.mediaType === "text/plain") {
|
|
@@ -642,12 +642,12 @@ const prepareMessages = Effect.fnUntraced(
|
|
|
642
642
|
? {
|
|
643
643
|
type: "base64",
|
|
644
644
|
media_type: "application/pdf",
|
|
645
|
-
data: typeof part.data === "string" ? part.data :
|
|
645
|
+
data: typeof part.data === "string" ? part.data : Encoding.encodeBase64(part.data)
|
|
646
646
|
} as const
|
|
647
647
|
: {
|
|
648
648
|
type: "text",
|
|
649
649
|
media_type: "text/plain",
|
|
650
|
-
data: typeof part.data === "string" ? part.data :
|
|
650
|
+
data: typeof part.data === "string" ? part.data : Encoding.encodeBase64(part.data)
|
|
651
651
|
} as const
|
|
652
652
|
|
|
653
653
|
content.push({
|
|
@@ -2380,14 +2380,20 @@ const makeStreamResponse = Effect.fnUntraced(
|
|
|
2380
2380
|
|
|
2381
2381
|
const params = contentBlock.providerExecuted === true
|
|
2382
2382
|
? finalParams
|
|
2383
|
-
: transformToolCallParams(
|
|
2383
|
+
: yield* transformToolCallParams(
|
|
2384
|
+
options.tools,
|
|
2385
|
+
contentBlock.name,
|
|
2386
|
+
Tool.unsafeSecureJsonParse(finalParams)
|
|
2387
|
+
)
|
|
2384
2388
|
|
|
2385
2389
|
parts.push({
|
|
2386
2390
|
type: "tool-call",
|
|
2387
2391
|
id: contentBlock.id,
|
|
2388
2392
|
name: contentBlock.name,
|
|
2389
2393
|
params,
|
|
2390
|
-
|
|
2394
|
+
...(Predicate.isNotUndefined(contentBlock.providerExecuted)
|
|
2395
|
+
? { providerExecuted: contentBlock.providerExecuted }
|
|
2396
|
+
: undefined),
|
|
2391
2397
|
...(Predicate.isNotUndefined(contentBlock.caller)
|
|
2392
2398
|
? { metadata: { anthropic: { caller: contentBlock.caller } } }
|
|
2393
2399
|
: undefined)
|