@effect/ai-anthropic 0.23.0 → 4.0.0-beta.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.
Files changed (104) hide show
  1. package/dist/AnthropicClient.d.ts +196 -0
  2. package/dist/AnthropicClient.d.ts.map +1 -0
  3. package/dist/AnthropicClient.js +142 -0
  4. package/dist/AnthropicClient.js.map +1 -0
  5. package/dist/{dts/AnthropicConfig.d.ts → AnthropicConfig.d.ts} +9 -9
  6. package/dist/AnthropicConfig.d.ts.map +1 -0
  7. package/dist/{esm/AnthropicConfig.js → AnthropicConfig.js} +8 -5
  8. package/dist/AnthropicConfig.js.map +1 -0
  9. package/dist/AnthropicError.d.ts +102 -0
  10. package/dist/AnthropicError.d.ts.map +1 -0
  11. package/dist/AnthropicError.js +10 -0
  12. package/dist/AnthropicError.js.map +1 -0
  13. package/dist/AnthropicLanguageModel.d.ts +522 -0
  14. package/dist/AnthropicLanguageModel.d.ts.map +1 -0
  15. package/dist/AnthropicLanguageModel.js +2107 -0
  16. package/dist/AnthropicLanguageModel.js.map +1 -0
  17. package/dist/AnthropicTelemetry.d.ts +101 -0
  18. package/dist/AnthropicTelemetry.d.ts.map +1 -0
  19. package/dist/AnthropicTelemetry.js +35 -0
  20. package/dist/AnthropicTelemetry.js.map +1 -0
  21. package/dist/AnthropicTool.d.ts +2153 -0
  22. package/dist/AnthropicTool.d.ts.map +1 -0
  23. package/dist/AnthropicTool.js +1168 -0
  24. package/dist/AnthropicTool.js.map +1 -0
  25. package/dist/Generated.d.ts +25233 -0
  26. package/dist/Generated.d.ts.map +1 -0
  27. package/dist/Generated.js +7649 -0
  28. package/dist/Generated.js.map +1 -0
  29. package/dist/index.d.ts +53 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +54 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/internal/errors.d.ts +2 -0
  34. package/dist/internal/errors.d.ts.map +1 -0
  35. package/dist/internal/errors.js +344 -0
  36. package/dist/internal/errors.js.map +1 -0
  37. package/dist/{dts/internal → internal}/utilities.d.ts.map +1 -1
  38. package/dist/internal/utilities.js.map +1 -0
  39. package/package.json +45 -81
  40. package/src/AnthropicClient.ts +327 -683
  41. package/src/AnthropicConfig.ts +20 -34
  42. package/src/AnthropicError.ts +111 -0
  43. package/src/AnthropicLanguageModel.ts +2039 -993
  44. package/src/AnthropicTelemetry.ts +138 -0
  45. package/src/AnthropicTool.ts +1500 -475
  46. package/src/Generated.ts +9798 -6359
  47. package/src/index.ts +38 -6
  48. package/src/internal/errors.ts +368 -0
  49. package/src/internal/utilities.ts +1 -1
  50. package/AnthropicClient/package.json +0 -6
  51. package/AnthropicConfig/package.json +0 -6
  52. package/AnthropicLanguageModel/package.json +0 -6
  53. package/AnthropicTokenizer/package.json +0 -6
  54. package/AnthropicTool/package.json +0 -6
  55. package/Generated/package.json +0 -6
  56. package/README.md +0 -5
  57. package/dist/cjs/AnthropicClient.js +0 -344
  58. package/dist/cjs/AnthropicClient.js.map +0 -1
  59. package/dist/cjs/AnthropicConfig.js +0 -30
  60. package/dist/cjs/AnthropicConfig.js.map +0 -1
  61. package/dist/cjs/AnthropicLanguageModel.js +0 -1322
  62. package/dist/cjs/AnthropicLanguageModel.js.map +0 -1
  63. package/dist/cjs/AnthropicTokenizer.js +0 -52
  64. package/dist/cjs/AnthropicTokenizer.js.map +0 -1
  65. package/dist/cjs/AnthropicTool.js +0 -461
  66. package/dist/cjs/AnthropicTool.js.map +0 -1
  67. package/dist/cjs/Generated.js +0 -6578
  68. package/dist/cjs/Generated.js.map +0 -1
  69. package/dist/cjs/index.js +0 -20
  70. package/dist/cjs/index.js.map +0 -1
  71. package/dist/cjs/internal/utilities.js +0 -29
  72. package/dist/cjs/internal/utilities.js.map +0 -1
  73. package/dist/dts/AnthropicClient.d.ts +0 -730
  74. package/dist/dts/AnthropicClient.d.ts.map +0 -1
  75. package/dist/dts/AnthropicConfig.d.ts.map +0 -1
  76. package/dist/dts/AnthropicLanguageModel.d.ts +0 -304
  77. package/dist/dts/AnthropicLanguageModel.d.ts.map +0 -1
  78. package/dist/dts/AnthropicTokenizer.d.ts +0 -13
  79. package/dist/dts/AnthropicTokenizer.d.ts.map +0 -1
  80. package/dist/dts/AnthropicTool.d.ts +0 -548
  81. package/dist/dts/AnthropicTool.d.ts.map +0 -1
  82. package/dist/dts/Generated.d.ts +0 -12504
  83. package/dist/dts/Generated.d.ts.map +0 -1
  84. package/dist/dts/index.d.ts +0 -25
  85. package/dist/dts/index.d.ts.map +0 -1
  86. package/dist/esm/AnthropicClient.js +0 -317
  87. package/dist/esm/AnthropicClient.js.map +0 -1
  88. package/dist/esm/AnthropicConfig.js.map +0 -1
  89. package/dist/esm/AnthropicLanguageModel.js +0 -1309
  90. package/dist/esm/AnthropicLanguageModel.js.map +0 -1
  91. package/dist/esm/AnthropicTokenizer.js +0 -44
  92. package/dist/esm/AnthropicTokenizer.js.map +0 -1
  93. package/dist/esm/AnthropicTool.js +0 -452
  94. package/dist/esm/AnthropicTool.js.map +0 -1
  95. package/dist/esm/Generated.js +0 -6247
  96. package/dist/esm/Generated.js.map +0 -1
  97. package/dist/esm/index.js +0 -25
  98. package/dist/esm/index.js.map +0 -1
  99. package/dist/esm/internal/utilities.js.map +0 -1
  100. package/dist/esm/package.json +0 -4
  101. package/index/package.json +0 -6
  102. package/src/AnthropicTokenizer.ts +0 -59
  103. /package/dist/{dts/internal → internal}/utilities.d.ts +0 -0
  104. /package/dist/{esm/internal → internal}/utilities.js +0 -0
@@ -1,344 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.make = exports.layerConfig = exports.layer = exports.ThinkingContentBlockDelta = exports.TextContentBlockDelta = exports.SignatureContentBlockDelta = exports.ServerToolUsage = exports.PingEvent = exports.MessageStreamEvent = exports.MessageStopEvent = exports.MessageStartEvent = exports.MessageDeltaUsage = exports.MessageDeltaEvent = exports.MessageDelta = exports.InputJsonContentBlockDelta = exports.ErrorEvent = exports.ContentBlockStopEvent = exports.ContentBlockStartEvent = exports.ContentBlockDeltaEvent = exports.CitationsDelta = exports.AnthropicClient = void 0;
7
- var AiError = _interopRequireWildcard(require("@effect/ai/AiError"));
8
- var Sse = _interopRequireWildcard(require("@effect/experimental/Sse"));
9
- var Headers = _interopRequireWildcard(require("@effect/platform/Headers"));
10
- var HttpBody = _interopRequireWildcard(require("@effect/platform/HttpBody"));
11
- var HttpClient = _interopRequireWildcard(require("@effect/platform/HttpClient"));
12
- var HttpClientError = _interopRequireWildcard(require("@effect/platform/HttpClientError"));
13
- var HttpClientRequest = _interopRequireWildcard(require("@effect/platform/HttpClientRequest"));
14
- var Arr = _interopRequireWildcard(require("effect/Array"));
15
- var Chunk = _interopRequireWildcard(require("effect/Chunk"));
16
- var Config = _interopRequireWildcard(require("effect/Config"));
17
- var Context = _interopRequireWildcard(require("effect/Context"));
18
- var Effect = _interopRequireWildcard(require("effect/Effect"));
19
- var _Function = require("effect/Function");
20
- var Layer = _interopRequireWildcard(require("effect/Layer"));
21
- var Redacted = _interopRequireWildcard(require("effect/Redacted"));
22
- var Schema = _interopRequireWildcard(require("effect/Schema"));
23
- var Stream = _interopRequireWildcard(require("effect/Stream"));
24
- var _AnthropicConfig = require("./AnthropicConfig.js");
25
- var Generated = _interopRequireWildcard(require("./Generated.js"));
26
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
27
- /**
28
- * @since 1.0.0
29
- */
30
-
31
- /**
32
- * @since 1.0.0
33
- * @category Context
34
- */
35
- class AnthropicClient extends /*#__PURE__*/Context.Tag("@effect/ai-anthropic/AnthropicClient")() {}
36
- /**
37
- * @since 1.0.0
38
- * @category Constructors
39
- */
40
- exports.AnthropicClient = AnthropicClient;
41
- const make = exports.make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
42
- const apiKeyHeader = "x-api-key";
43
- yield* Effect.locallyScopedWith(Headers.currentRedactedNames, Arr.append(apiKeyHeader));
44
- const httpClient = (yield* HttpClient.HttpClient).pipe(HttpClient.mapRequest(request => request.pipe(HttpClientRequest.prependUrl(options.apiUrl ?? "https://api.anthropic.com"), options.apiKey ? HttpClientRequest.setHeader(apiKeyHeader, Redacted.value(options.apiKey)) : _Function.identity, HttpClientRequest.setHeader("anthropic-version", options.anthropicVersion ?? "2023-06-01"), HttpClientRequest.acceptJson)), options.transformClient ? options.transformClient : _Function.identity);
45
- const httpClientOk = HttpClient.filterStatusOk(httpClient);
46
- const client = Generated.make(httpClient, {
47
- transformClient: client => _AnthropicConfig.AnthropicConfig.getOrUndefined.pipe(Effect.map(config => config?.transformClient ? config.transformClient(client) : client))
48
- });
49
- const streamRequest = (request, schema) => {
50
- const decodeEvents = Schema.decode(Schema.ChunkFromSelf(Schema.parseJson(schema)));
51
- return httpClientOk.execute(request).pipe(Effect.map(r => r.stream), Stream.unwrapScoped, Stream.decodeText(), Stream.pipeThroughChannel(Sse.makeChannel()), Stream.mapChunksEffect(chunk => decodeEvents(Chunk.map(chunk, event => event.data))), Stream.catchTags({
52
- RequestError: error => AiError.HttpRequestError.fromRequestError({
53
- module: "AnthropicClient",
54
- method: "streamRequest",
55
- error
56
- }),
57
- ResponseError: error => AiError.HttpResponseError.fromResponseError({
58
- module: "AnthropicClient",
59
- method: "streamRequest",
60
- error
61
- }),
62
- ParseError: error => AiError.MalformedOutput.fromParseError({
63
- module: "AnthropicClient",
64
- method: "streamRequest",
65
- error
66
- })
67
- }));
68
- };
69
- const createMessage = Effect.fnUntraced(function* (options) {
70
- return yield* client.betaMessagesPost(options).pipe(Effect.catchTags({
71
- RequestError: error => AiError.HttpRequestError.fromRequestError({
72
- module: "AnthropicClient",
73
- method: "createMessage",
74
- error
75
- }),
76
- ResponseError: error => AiError.HttpResponseError.fromResponseError({
77
- module: "AnthropicClient",
78
- method: "createMessage",
79
- error
80
- }),
81
- BetaErrorResponse: error => AiError.HttpResponseError.fromResponseError({
82
- module: "AnthropicClient",
83
- method: "createMessage",
84
- error: new HttpClientError.ResponseError({
85
- reason: "StatusCode",
86
- request: error.request,
87
- response: error.response
88
- })
89
- }),
90
- ParseError: error => AiError.MalformedOutput.fromParseError({
91
- module: "AnthropicClient",
92
- method: "createMessage",
93
- error
94
- })
95
- }));
96
- });
97
- const createMessageStream = options => {
98
- const request = HttpClientRequest.post("/v1/messages", {
99
- headers: Headers.fromInput({
100
- "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined
101
- }),
102
- body: HttpBody.unsafeJson({
103
- ...options.payload,
104
- stream: true
105
- })
106
- });
107
- return streamRequest(request, MessageStreamEvent).pipe(Stream.takeUntil(event => event.type === "message_stop"));
108
- };
109
- return AnthropicClient.of({
110
- client,
111
- streamRequest,
112
- createMessage,
113
- createMessageStream
114
- });
115
- });
116
- // =============================================================================
117
- // Message Stream Schema
118
- // =============================================================================
119
- /**
120
- * @since 1.0.0
121
- * @category Schemas
122
- */
123
- class PingEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/PingEvent")({
124
- type: /*#__PURE__*/Schema.Literal("ping")
125
- }) {}
126
- /**
127
- * @since 1.0.0
128
- * @category Schemas
129
- */
130
- exports.PingEvent = PingEvent;
131
- class ErrorEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/ErrorEvent")({
132
- type: /*#__PURE__*/Schema.Literal("error"),
133
- error: /*#__PURE__*/Schema.Struct({
134
- type: /*#__PURE__*/Schema.Literal("invalid_request_error", "authentication_error", "permission_error", "not_found_error", "request_too_large", "rate_limit_error", "api_error", "overloaded_error"),
135
- message: Schema.String
136
- })
137
- }) {}
138
- /**
139
- * @since 1.0.0
140
- * @category Schemas
141
- */
142
- exports.ErrorEvent = ErrorEvent;
143
- class MessageStartEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/MessageStartEvent")({
144
- type: /*#__PURE__*/Schema.Literal("message_start"),
145
- message: Generated.BetaMessage
146
- }) {}
147
- /**
148
- * @since 1.0.0
149
- * @category Schemas
150
- */
151
- exports.MessageStartEvent = MessageStartEvent;
152
- class ServerToolUsage extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/ServerToolUsage")({
153
- /**
154
- * The number of web search tool requests.
155
- */
156
- web_search_requests: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0))), {
157
- default: () => 0
158
- })
159
- }) {}
160
- /**
161
- * @since 1.0.0
162
- * @category Schemas
163
- */
164
- exports.ServerToolUsage = ServerToolUsage;
165
- class MessageDelta extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/MessageDelta")({
166
- stop_reason: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Literal("end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal")), {
167
- default: () => null
168
- }),
169
- stop_sequence: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(Schema.String), {
170
- default: () => null
171
- })
172
- }) {}
173
- /**
174
- * @since 1.0.0
175
- * @category Schemas
176
- */
177
- exports.MessageDelta = MessageDelta;
178
- class MessageDeltaUsage extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/MessageDeltaUsage")({
179
- /**
180
- * The cumulative number of input tokens which were used.
181
- */
182
- input_tokens: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0))), {
183
- default: () => null
184
- }),
185
- /**
186
- * The cumulative number of output tokens which were used.
187
- */
188
- output_tokens: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0))), {
189
- default: () => null
190
- }),
191
- /**
192
- * The cumulative number of input tokens used to create the cache entry.
193
- */
194
- cache_creation_input_tokens: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0))), {
195
- default: () => null
196
- }),
197
- /**
198
- * The cumulative number of input tokens read from the cache.
199
- */
200
- cache_read_input_tokens: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(/*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.greaterThanOrEqualTo(0))), {
201
- default: () => null
202
- }),
203
- /**
204
- * The number of server tool requests.
205
- */
206
- server_tool_use: /*#__PURE__*/Schema.optionalWith(/*#__PURE__*/Schema.NullOr(ServerToolUsage), {
207
- default: () => null
208
- })
209
- }) {}
210
- /**
211
- * @since 1.0.0
212
- * @category Schemas
213
- */
214
- exports.MessageDeltaUsage = MessageDeltaUsage;
215
- class MessageDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/MessageDeltaEvent")({
216
- type: /*#__PURE__*/Schema.Literal("message_delta"),
217
- delta: MessageDelta,
218
- /**
219
- * Billing and rate-limit usage.
220
- *
221
- * Anthropic's API bills and rate-limits by token counts, as tokens represent
222
- * the underlying cost to our systems.
223
- *
224
- * Under the hood, the API transforms requests into a format suitable for the
225
- * model. The model's output then goes through a parsing stage before becoming
226
- * an API response. As a result, the token counts in `usage` will not match
227
- * one-to-one with the exact visible content of an API request or response.
228
- *
229
- * For example, `output_tokens` will be non-zero, even for an empty string
230
- * response from Claude.\n\nTotal input tokens in a request is the summation
231
- * of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.
232
- */
233
- usage: MessageDeltaUsage
234
- }) {}
235
- /**
236
- * @since 1.0.0
237
- * @category Schemas
238
- */
239
- exports.MessageDeltaEvent = MessageDeltaEvent;
240
- class MessageStopEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/MessageStopEvent")({
241
- type: /*#__PURE__*/Schema.Literal("message_stop")
242
- }) {}
243
- /**
244
- * @since 1.0.0
245
- * @category Schemas
246
- */
247
- exports.MessageStopEvent = MessageStopEvent;
248
- class ContentBlockStartEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/ContentBlockStartEvent")({
249
- type: /*#__PURE__*/Schema.Literal("content_block_start"),
250
- index: Schema.Int,
251
- content_block: Generated.BetaContentBlock
252
- }) {}
253
- /**
254
- * @since 1.0.0
255
- * @category Schemas
256
- */
257
- exports.ContentBlockStartEvent = ContentBlockStartEvent;
258
- class CitationsDelta extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/CitationsDelta")({
259
- type: /*#__PURE__*/Schema.Literal("citations_delta"),
260
- citation: /*#__PURE__*/Schema.Union(Generated.BetaResponseCharLocationCitation, Generated.BetaResponsePageLocationCitation, Generated.BetaResponseContentBlockLocationCitation, Generated.BetaResponseWebSearchResultLocationCitation, Generated.BetaResponseSearchResultLocationCitation)
261
- }) {}
262
- /**
263
- * @since 1.0.0
264
- * @category Schemas
265
- */
266
- exports.CitationsDelta = CitationsDelta;
267
- class InputJsonContentBlockDelta extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/InputJsonContentBlockDelta")({
268
- type: /*#__PURE__*/Schema.Literal("input_json_delta"),
269
- partial_json: Schema.String
270
- }) {}
271
- /**
272
- * @since 1.0.0
273
- * @category Schemas
274
- */
275
- exports.InputJsonContentBlockDelta = InputJsonContentBlockDelta;
276
- class SignatureContentBlockDelta extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/SignatureContentBlockDelta")({
277
- type: /*#__PURE__*/Schema.Literal("signature_delta"),
278
- signature: Schema.String
279
- }) {}
280
- /**
281
- * @since 1.0.0
282
- * @category Schemas
283
- */
284
- exports.SignatureContentBlockDelta = SignatureContentBlockDelta;
285
- class TextContentBlockDelta extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/TextContentBlockDelta")({
286
- type: /*#__PURE__*/Schema.Literal("text_delta"),
287
- text: Schema.String
288
- }) {}
289
- /**
290
- * @since 1.0.0
291
- * @category Schemas
292
- */
293
- exports.TextContentBlockDelta = TextContentBlockDelta;
294
- class ThinkingContentBlockDelta extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/ThinkingContentBlockDelta")({
295
- type: /*#__PURE__*/Schema.Literal("thinking_delta"),
296
- thinking: Schema.String
297
- }) {}
298
- /**
299
- * @since 1.0.0
300
- * @category Schemas
301
- */
302
- exports.ThinkingContentBlockDelta = ThinkingContentBlockDelta;
303
- class ContentBlockDeltaEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/ContentBlockDeltaEvent")({
304
- type: /*#__PURE__*/Schema.Literal("content_block_delta"),
305
- index: Schema.Int,
306
- delta: /*#__PURE__*/Schema.Union(CitationsDelta, InputJsonContentBlockDelta, SignatureContentBlockDelta, TextContentBlockDelta, ThinkingContentBlockDelta)
307
- }) {}
308
- /**
309
- * @since 1.0.0
310
- * @category Schemas
311
- */
312
- exports.ContentBlockDeltaEvent = ContentBlockDeltaEvent;
313
- class ContentBlockStopEvent extends /*#__PURE__*/Schema.Class("@effect/ai-anthropic/ContentBlockStopEvent")({
314
- type: /*#__PURE__*/Schema.Literal("content_block_stop"),
315
- index: Schema.Int
316
- }) {}
317
- /**
318
- * @since 1.0.0
319
- * @category Schemas
320
- */
321
- exports.ContentBlockStopEvent = ContentBlockStopEvent;
322
- const MessageStreamEvent = exports.MessageStreamEvent = /*#__PURE__*/Schema.Union(PingEvent, ErrorEvent, MessageStartEvent, MessageDeltaEvent, MessageStopEvent, ContentBlockStartEvent, ContentBlockDeltaEvent, ContentBlockStopEvent);
323
- /**
324
- * @since 1.0.0
325
- * @category Layers
326
- */
327
- const layer = options => Layer.scoped(AnthropicClient, make(options));
328
- /**
329
- * @since 1.0.0
330
- * @category Layers
331
- */
332
- exports.layer = layer;
333
- const layerConfig = options => {
334
- const {
335
- transformClient,
336
- ...configs
337
- } = options;
338
- return Config.all(configs).pipe(Effect.flatMap(configs => make({
339
- ...configs,
340
- transformClient
341
- })), Layer.scoped(AnthropicClient));
342
- };
343
- exports.layerConfig = layerConfig;
344
- //# sourceMappingURL=AnthropicClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnthropicClient.js","names":["AiError","_interopRequireWildcard","require","Sse","Headers","HttpBody","HttpClient","HttpClientError","HttpClientRequest","Arr","Chunk","Config","Context","Effect","_Function","Layer","Redacted","Schema","Stream","_AnthropicConfig","Generated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AnthropicClient","Tag","exports","make","fnUntraced","options","apiKeyHeader","locallyScopedWith","currentRedactedNames","append","httpClient","pipe","mapRequest","request","prependUrl","apiUrl","apiKey","setHeader","value","identity","anthropicVersion","acceptJson","transformClient","httpClientOk","filterStatusOk","client","AnthropicConfig","getOrUndefined","map","config","streamRequest","schema","decodeEvents","decode","ChunkFromSelf","parseJson","execute","stream","unwrapScoped","decodeText","pipeThroughChannel","makeChannel","mapChunksEffect","chunk","event","data","catchTags","RequestError","error","HttpRequestError","fromRequestError","module","method","ResponseError","HttpResponseError","fromResponseError","ParseError","MalformedOutput","fromParseError","createMessage","betaMessagesPost","BetaErrorResponse","reason","response","createMessageStream","post","headers","fromInput","params","undefined","body","unsafeJson","payload","MessageStreamEvent","takeUntil","type","of","PingEvent","Class","Literal","ErrorEvent","Struct","message","String","MessageStartEvent","BetaMessage","ServerToolUsage","web_search_requests","optionalWith","NullOr","Int","greaterThanOrEqualTo","MessageDelta","stop_reason","stop_sequence","MessageDeltaUsage","input_tokens","output_tokens","cache_creation_input_tokens","cache_read_input_tokens","server_tool_use","MessageDeltaEvent","delta","usage","MessageStopEvent","ContentBlockStartEvent","index","content_block","BetaContentBlock","CitationsDelta","citation","Union","BetaResponseCharLocationCitation","BetaResponsePageLocationCitation","BetaResponseContentBlockLocationCitation","BetaResponseWebSearchResultLocationCitation","BetaResponseSearchResultLocationCitation","InputJsonContentBlockDelta","partial_json","SignatureContentBlockDelta","signature","TextContentBlockDelta","text","ThinkingContentBlockDelta","thinking","ContentBlockDeltaEvent","ContentBlockStopEvent","layer","scoped","layerConfig","configs","all","flatMap"],"sources":["../../src/AnthropicClient.ts"],"sourcesContent":[null],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,iBAAA,GAAAP,uBAAA,CAAAC,OAAA;AACA,IAAAO,GAAA,GAAAR,uBAAA,CAAAC,OAAA;AACA,IAAAQ,KAAA,GAAAT,uBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAV,uBAAA,CAAAC,OAAA;AAEA,IAAAU,OAAA,GAAAX,uBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAZ,uBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,KAAA,GAAAd,uBAAA,CAAAC,OAAA;AACA,IAAAc,QAAA,GAAAf,uBAAA,CAAAC,OAAA;AACA,IAAAe,MAAA,GAAAhB,uBAAA,CAAAC,OAAA;AAEA,IAAAgB,MAAA,GAAAjB,uBAAA,CAAAC,OAAA;AACA,IAAAiB,gBAAA,GAAAjB,OAAA;AACA,IAAAkB,SAAA,GAAAnB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AAEG,IAAI,CAACE,OAAO,CAAC,CAAC;AAE9G;;;;AAAAH,OAAA,CAAA6H,KAAA,GAAAA,KAAA;AAIO,MAAME,WAAW,GAAI5H,OAwE3B,IAAsE;EACrE,MAAM;IAAEiB,eAAe;IAAE,GAAG4G;EAAO,CAAE,GAAG7H,OAAO;EAC/C,OAAOlC,MAAM,CAACgK,GAAG,CAACD,OAAO,CAAC,CAACvH,IAAI,CAC7BtC,MAAM,CAAC+J,OAAO,CAAEF,OAAO,IAAK/H,IAAI,CAAC;IAAE,GAAG+H,OAAO;IAAE5G;EAAe,CAAE,CAAC,CAAC,EAClE/C,KAAK,CAACyJ,MAAM,CAAChI,eAAe,CAAC,CAC9B;AACH,CAAC;AAAAE,OAAA,CAAA+H,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.withClientTransform = exports.AnthropicConfig = void 0;
7
- var Context = _interopRequireWildcard(require("effect/Context"));
8
- var Effect = _interopRequireWildcard(require("effect/Effect"));
9
- var _Function = require("effect/Function");
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
- /**
12
- * @since 1.0.0
13
- * @category Context
14
- */
15
- class AnthropicConfig extends /*#__PURE__*/Context.Tag("@effect/ai-anthropic/AnthropicConfig")() {
16
- /**
17
- * @since 1.0.0
18
- */
19
- static getOrUndefined = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.context(), context => context.unsafeMap.get(AnthropicConfig.key));
20
- }
21
- /**
22
- * @since 1.0.0
23
- * @category Configuration
24
- */
25
- exports.AnthropicConfig = AnthropicConfig;
26
- const withClientTransform = exports.withClientTransform = /*#__PURE__*/(0, _Function.dual)(2, (self, transformClient) => Effect.flatMap(AnthropicConfig.getOrUndefined, config => Effect.provideService(self, AnthropicConfig, {
27
- ...config,
28
- transformClient
29
- })));
30
- //# sourceMappingURL=AnthropicConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnthropicConfig.js","names":["Context","_interopRequireWildcard","require","Effect","_Function","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AnthropicConfig","Tag","getOrUndefined","map","context","unsafeMap","key","exports","withClientTransform","dual","self","transformClient","flatMap","config","provideService"],"sources":["../../src/AnthropicConfig.ts"],"sourcesContent":[null],"mappings":";;;;;;AAIA,IAAAA,OAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAsC,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAA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