@effect/ai-anthropic 4.0.0-beta.5 → 4.0.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/ai-anthropic",
3
- "version": "4.0.0-beta.5",
3
+ "version": "4.0.0-beta.7",
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.5"
46
+ "effect": "^4.0.0-beta.7"
47
47
  },
48
48
  "peerDependencies": {
49
- "effect": "^4.0.0-beta.5"
49
+ "effect": "^4.0.0-beta.7"
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 Base64 from "effect/encoding/Base64"
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: Base64.encode(part.data) } as const
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 : Base64.encode(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 : Base64.encode(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(options.tools, contentBlock.name, finalParams)
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
- providerExecuted: contentBlock.providerExecuted,
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)
package/src/Generated.ts CHANGED
@@ -9257,7 +9257,7 @@ export const make = (
9257
9257
  }))
9258
9258
  ),
9259
9259
  "messageBatchesDelete": (messageBatchId, options) =>
9260
- HttpClientRequest.del(`/v1/messages/batches/${messageBatchId}`).pipe(
9260
+ HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}`).pipe(
9261
9261
  HttpClientRequest.setHeaders({
9262
9262
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
9263
9263
  "x-api-key": options?.params?.["x-api-key"] ?? undefined
@@ -9343,7 +9343,7 @@ export const make = (
9343
9343
  }))
9344
9344
  ),
9345
9345
  "deleteFileV1FilesFileIdDelete": (fileId, options) =>
9346
- HttpClientRequest.del(`/v1/files/${fileId}`).pipe(
9346
+ HttpClientRequest.delete(`/v1/files/${fileId}`).pipe(
9347
9347
  HttpClientRequest.setHeaders({
9348
9348
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9349
9349
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
@@ -9420,7 +9420,7 @@ export const make = (
9420
9420
  }))
9421
9421
  ),
9422
9422
  "deleteSkillV1SkillsSkillIdDelete": (skillId, options) =>
9423
- HttpClientRequest.del(`/v1/skills/${skillId}`).pipe(
9423
+ HttpClientRequest.delete(`/v1/skills/${skillId}`).pipe(
9424
9424
  HttpClientRequest.setHeaders({
9425
9425
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9426
9426
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
@@ -9485,7 +9485,7 @@ export const make = (
9485
9485
  }))
9486
9486
  ),
9487
9487
  "deleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) =>
9488
- HttpClientRequest.del(`/v1/skills/${skillId}/versions/${version}`).pipe(
9488
+ HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}`).pipe(
9489
9489
  HttpClientRequest.setHeaders({
9490
9490
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9491
9491
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
@@ -9589,7 +9589,7 @@ export const make = (
9589
9589
  }))
9590
9590
  ),
9591
9591
  "betaMessageBatchesDelete": (messageBatchId, options) =>
9592
- HttpClientRequest.del(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe(
9592
+ HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe(
9593
9593
  HttpClientRequest.setHeaders({
9594
9594
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9595
9595
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
@@ -9683,7 +9683,7 @@ export const make = (
9683
9683
  }))
9684
9684
  ),
9685
9685
  "betaDeleteFileV1FilesFileIdDelete": (fileId, options) =>
9686
- HttpClientRequest.del(`/v1/files/${fileId}?beta=true`).pipe(
9686
+ HttpClientRequest.delete(`/v1/files/${fileId}?beta=true`).pipe(
9687
9687
  HttpClientRequest.setHeaders({
9688
9688
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9689
9689
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
@@ -9760,7 +9760,7 @@ export const make = (
9760
9760
  }))
9761
9761
  ),
9762
9762
  "betaDeleteSkillV1SkillsSkillIdDelete": (skillId, options) =>
9763
- HttpClientRequest.del(`/v1/skills/${skillId}?beta=true`).pipe(
9763
+ HttpClientRequest.delete(`/v1/skills/${skillId}?beta=true`).pipe(
9764
9764
  HttpClientRequest.setHeaders({
9765
9765
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9766
9766
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,
@@ -9825,7 +9825,7 @@ export const make = (
9825
9825
  }))
9826
9826
  ),
9827
9827
  "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) =>
9828
- HttpClientRequest.del(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe(
9828
+ HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe(
9829
9829
  HttpClientRequest.setHeaders({
9830
9830
  "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined,
9831
9831
  "anthropic-version": options?.params?.["anthropic-version"] ?? undefined,