@effect/ai-anthropic 4.0.0-beta.69 → 4.0.0-beta.70

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.
@@ -17,8 +17,7 @@ import * as Telemetry from "effect/unstable/ai/Telemetry"
17
17
  * The attributes used to describe telemetry in the context of Generative
18
18
  * Artificial Intelligence (GenAI) Models requests and responses.
19
19
  *
20
- * {@see https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/}
21
- *
20
+ * @see https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/
22
21
  * @category models
23
22
  * @since 4.0.0
24
23
  */
@@ -101,7 +100,9 @@ const addAnthropicResponseAttributes = Telemetry.addSpanAttributes("gen_ai.anthr
101
100
  * Applies the specified Anthropic GenAI telemetry attributes to the provided
102
101
  * `Span`.
103
102
  *
104
- * **NOTE**: This method will mutate the `Span` **in-place**.
103
+ * **Gotchas**
104
+ *
105
+ * This method mutates the `Span` in place.
105
106
  *
106
107
  * @category utils
107
108
  * @since 4.0.0
@@ -111,7 +112,9 @@ export const addGenAIAnnotations: {
111
112
  * Applies the specified Anthropic GenAI telemetry attributes to the provided
112
113
  * `Span`.
113
114
  *
114
- * **NOTE**: This method will mutate the `Span` **in-place**.
115
+ * **Gotchas**
116
+ *
117
+ * This method mutates the `Span` in place.
115
118
  *
116
119
  * @category utils
117
120
  * @since 4.0.0
@@ -121,7 +124,9 @@ export const addGenAIAnnotations: {
121
124
  * Applies the specified Anthropic GenAI telemetry attributes to the provided
122
125
  * `Span`.
123
126
  *
124
- * **NOTE**: This method will mutate the `Span` **in-place**.
127
+ * **Gotchas**
128
+ *
129
+ * This method mutates the `Span` in place.
125
130
  *
126
131
  * @category utils
127
132
  * @since 4.0.0
@@ -41,6 +41,8 @@ export type AnthropicTool =
41
41
  /**
42
42
  * Anthropic Bash tool (2024-10-22 version).
43
43
  *
44
+ * **Details**
45
+ *
44
46
  * Allows the model to execute bash commands in a sandboxed environment.
45
47
  * Requires the "computer-use-2024-10-22" beta header.
46
48
  *
@@ -62,6 +64,8 @@ export const Bash_20241022 = Tool.providerDefined({
62
64
  /**
63
65
  * Anthropic Bash tool (2025-01-24 version).
64
66
  *
67
+ * **Details**
68
+ *
65
69
  * Allows the model to execute bash commands in a sandboxed environment.
66
70
  * Requires the "computer-use-2025-01-24" beta header.
67
71
  *
@@ -247,6 +251,8 @@ export type CodeExecution_20250825_Parameters = typeof CodeExecution_20250825_Pa
247
251
  /**
248
252
  * Anthropic Code Execution tool (2025-05-22 version).
249
253
  *
254
+ * **Details**
255
+ *
250
256
  * Allows the model to execute code in a sandboxed environment with support
251
257
  * for multiple execution types including programmatic tool calls, bash
252
258
  * execution, and text editor operations.
@@ -266,6 +272,8 @@ export const CodeExecution_20250522 = Tool.providerDefined({
266
272
  /**
267
273
  * Anthropic Code Execution tool (2025-08-25 version).
268
274
  *
275
+ * **Details**
276
+ *
269
277
  * Allows the model to execute code in a sandboxed environment.
270
278
  *
271
279
  * @category Code Execution
@@ -579,7 +587,9 @@ export type ComputerUseLeftClickDragAction = typeof ComputerUseLeftClickDragActi
579
587
  /**
580
588
  * Press the left mouse button down (without releasing).
581
589
  *
582
- * Used for fine-grained click control.
590
+ * **When to use**
591
+ *
592
+ * Use this for fine-grained click control.
583
593
  *
584
594
  * @category Computer Use
585
595
  * @since 4.0.0
@@ -603,7 +613,9 @@ export type ComputerUseLeftMouseDownAction = typeof ComputerUseLeftMouseDownActi
603
613
  /**
604
614
  * Release the left mouse button.
605
615
  *
606
- * Used for fine-grained click control.
616
+ * **When to use**
617
+ *
618
+ * Use this for fine-grained click control.
607
619
  *
608
620
  * @category Computer Use
609
621
  * @since 4.0.0
@@ -762,6 +774,8 @@ const ComputerUse_20250124_Actions = Schema.Union([
762
774
  /**
763
775
  * Zoom into a specific region of the screen at full resolution.
764
776
  *
777
+ * **Details**
778
+ *
765
779
  * Requires `enableZoom: true` in the tool definition.
766
780
  *
767
781
  * @category Computer Use
@@ -778,7 +792,8 @@ export const ComputerUseZoomAction = Schema.Struct({
778
792
  /**
779
793
  * Computer-use action payload for zooming into a specific screen region.
780
794
  *
781
- * **Notes**
795
+ * **Details**
796
+ *
782
797
  * The enclosing computer-use tool must be configured with `enableZoom: true`.
783
798
  *
784
799
  * @category Computer Use
@@ -798,8 +813,9 @@ const ComputerUse_20251124_Actions = Schema.Union([
798
813
  /**
799
814
  * Computer use tool for Claude 3.5 Sonnet v2 (deprecated).
800
815
  *
801
- * Requires the "computer-use-2024-10-22" beta header.
816
+ * **Details**
802
817
  *
818
+ * Requires the "computer-use-2024-10-22" beta header.
803
819
  * Basic actions only: screenshot, left_click, type, key, mouse_move.
804
820
  *
805
821
  * @category Computer Use
@@ -818,8 +834,9 @@ export const ComputerUse_20241022 = Tool.providerDefined({
818
834
  /**
819
835
  * Computer use tool for Claude 4 models and Claude Sonnet 3.7.
820
836
  *
821
- * Requires the "computer-use-2025-01-24" beta header.
837
+ * **Details**
822
838
  *
839
+ * Requires the "computer-use-2025-01-24" beta header.
823
840
  * Includes basic actions plus enhanced actions: scroll, left_click_drag,
824
841
  * right_click, middle_click, double_click, triple_click, left_mouse_down,
825
842
  * left_mouse_up, hold_key, wait.
@@ -840,8 +857,9 @@ export const ComputerUse_20250124 = Tool.providerDefined({
840
857
  /**
841
858
  * Computer use tool for Claude Opus 4.5 only.
842
859
  *
843
- * Requires the "computer-use-2025-11-24" beta header.
860
+ * **Details**
844
861
  *
862
+ * Requires the "computer-use-2025-11-24" beta header.
845
863
  * Includes all actions from computer_20250124 plus the zoom action for
846
864
  * detailed screen region inspection. Requires `enableZoom: true` in args.
847
865
  *
@@ -869,10 +887,11 @@ export const ComputerUse_20251124 = Tool.providerDefined({
869
887
  /**
870
888
  * A `[start, end]` line range for viewing file contents.
871
889
  *
872
- * Lines are 1-indexed. Use -1 for end to read to end of file:
890
+ * **Details**
873
891
  *
874
- * - `[1, 50]`: View lines 1-50
875
- * - `[100, -1]`: View from line 100 to end of file
892
+ * Lines are 1-indexed. Use -1 for end to read to the end of the file. For
893
+ * example, `[1, 50]` views lines 1-50 and `[100, -1]` views from line 100 to
894
+ * the end of the file.
876
895
  *
877
896
  * @category Memory
878
897
  * @since 4.0.0
@@ -1056,6 +1075,8 @@ const Memory_20250818_Commands = Schema.Union([
1056
1075
  /**
1057
1076
  * Memory tool for persistent file operations across conversations.
1058
1077
  *
1078
+ * **Details**
1079
+ *
1059
1080
  * Provides commands for creating, viewing, editing, renaming, and deleting
1060
1081
  * files within the model's memory space.
1061
1082
  *
@@ -1081,8 +1102,10 @@ export const Memory_20250818 = Tool.providerDefined({
1081
1102
  /**
1082
1103
  * View the contents of a file or list directory contents.
1083
1104
  *
1084
- * When used on a file: Returns the file contents, optionally limited to a line range.
1085
- * When used on a directory: Lists all files and subdirectories.
1105
+ * **Details**
1106
+ *
1107
+ * When used on a file, returns the file contents, optionally limited to a line
1108
+ * range. When used on a directory, lists all files and subdirectories.
1086
1109
  *
1087
1110
  * @category Text Editor
1088
1111
  * @since 4.0.0
@@ -1110,7 +1133,9 @@ export type TextEditorViewCommand = typeof TextEditorViewCommand.Type
1110
1133
  /**
1111
1134
  * Create a new file with specified content.
1112
1135
  *
1113
- * Will fail if the file already exists. Parent directories must exist.
1136
+ * **Gotchas**
1137
+ *
1138
+ * Fails if the file already exists. Parent directories must exist.
1114
1139
  *
1115
1140
  * @category Text Editor
1116
1141
  * @since 4.0.0
@@ -1129,7 +1154,8 @@ export const TextEditorCreateCommand = Schema.Struct({
1129
1154
  /**
1130
1155
  * Text editor command payload for creating a new file with the specified content.
1131
1156
  *
1132
- * **Notes**
1157
+ * **Gotchas**
1158
+ *
1133
1159
  * The command fails if the file already exists or if parent directories are missing.
1134
1160
  *
1135
1161
  * @category Text Editor
@@ -1140,6 +1166,8 @@ export type TextEditorCreateCommand = typeof TextEditorCreateCommand.Type
1140
1166
  /**
1141
1167
  * Replace a specific string in a file with a new string.
1142
1168
  *
1169
+ * **Gotchas**
1170
+ *
1143
1171
  * The `old_str` must match exactly (including whitespace and indentation)
1144
1172
  * and must be unique in the file.
1145
1173
  *
@@ -1172,6 +1200,8 @@ export type TextEditorStrReplaceCommand = typeof TextEditorStrReplaceCommand.Typ
1172
1200
  /**
1173
1201
  * Insert text at a specific line number in a file.
1174
1202
  *
1203
+ * **Details**
1204
+ *
1175
1205
  * Inserts the new text AFTER the specified line number.
1176
1206
  *
1177
1207
  * @category Text Editor
@@ -1203,10 +1233,14 @@ export type TextEditorInsertCommand = typeof TextEditorInsertCommand.Type
1203
1233
  /**
1204
1234
  * Undo the last edit made to a file.
1205
1235
  *
1236
+ * **Details**
1237
+ *
1206
1238
  * Reverts the most recent str_replace, insert, or create operation on the file.
1207
1239
  *
1208
- * NOTE: This command is available in text_editor_20241022 and text_editor_20250124,
1209
- * but NOT in text_editor_20250728 (Claude 4 models).
1240
+ * **Gotchas**
1241
+ *
1242
+ * This command is available in text_editor_20241022 and text_editor_20250124,
1243
+ * but not in text_editor_20250728 (Claude 4 models).
1210
1244
  *
1211
1245
  * @category Text Editor
1212
1246
  * @since 4.0.0
@@ -1221,7 +1255,8 @@ export const TextEditorUndoEditCommand = Schema.Struct({
1221
1255
  /**
1222
1256
  * Text editor command payload for undoing the most recent edit to a file.
1223
1257
  *
1224
- * **Notes**
1258
+ * **Gotchas**
1259
+ *
1225
1260
  * Available for `text_editor_20241022` and `text_editor_20250124`, but not for Claude 4 text editor versions.
1226
1261
  *
1227
1262
  * @category Text Editor
@@ -1263,6 +1298,8 @@ const TextEditor_StrReplaceBasedEdit_Args = Schema.Struct({
1263
1298
  /**
1264
1299
  * Text editor tool for Claude 3.5 Sonnet (deprecated).
1265
1300
  *
1301
+ * **Details**
1302
+ *
1266
1303
  * Requires the "computer-use-2024-10-22" beta header.
1267
1304
  *
1268
1305
  * @category Text Editor
@@ -1280,7 +1317,8 @@ export const TextEditor_20241022 = Tool.providerDefined({
1280
1317
  /**
1281
1318
  * Text editor tool for Claude Sonnet 3.7 (deprecated model).
1282
1319
  *
1283
- * **Notes**
1320
+ * **Details**
1321
+ *
1284
1322
  * Requires the "computer-use-2025-01-24" beta header.
1285
1323
  *
1286
1324
  * @category Text Editor
@@ -1298,8 +1336,13 @@ export const TextEditor_20250124 = Tool.providerDefined({
1298
1336
  /**
1299
1337
  * Text editor tool for Claude 4 models using Anthropic's `str_replace_based_edit_tool`.
1300
1338
  *
1301
- * **Notes**
1302
- * Requires the "computer-use-2025-01-24" beta header. This version does not support the `undo_edit` command.
1339
+ * **Details**
1340
+ *
1341
+ * Requires the "computer-use-2025-01-24" beta header.
1342
+ *
1343
+ * **Gotchas**
1344
+ *
1345
+ * This version does not support the `undo_edit` command.
1303
1346
  *
1304
1347
  * @category Text Editor
1305
1348
  * @since 4.0.0
@@ -1317,7 +1360,9 @@ export const TextEditor_20250429 = Tool.providerDefined({
1317
1360
  /**
1318
1361
  * Text editor tool for Claude 4 models.
1319
1362
  *
1320
- * NOTE: This version does NOT support the `undo_edit` command.
1363
+ * **Gotchas**
1364
+ *
1365
+ * This version does not support the `undo_edit` command.
1321
1366
  *
1322
1367
  * @category Text Editor
1323
1368
  * @since 4.0.0
@@ -1343,6 +1388,8 @@ export const TextEditor_20250728 = Tool.providerDefined({
1343
1388
  /**
1344
1389
  * User location for localizing search results.
1345
1390
  *
1391
+ * **When to use**
1392
+ *
1346
1393
  * Providing location helps return more relevant results for location-dependent
1347
1394
  * queries like weather, local businesses, events, etc.
1348
1395
  *
@@ -1432,6 +1479,7 @@ export const WebSearchParameters = Schema.Struct({
1432
1479
  * Type of the parameters Claude supplies when invoking the Anthropic web search tool.
1433
1480
  *
1434
1481
  * **Details**
1482
+ *
1435
1483
  * Contains the generated search query used by `WebSearch_20250305`.
1436
1484
  *
1437
1485
  * @category Web Search
@@ -1446,9 +1494,10 @@ export type WebSearchParameters = typeof WebSearchParameters.Type
1446
1494
  /**
1447
1495
  * Web search tool for Claude models.
1448
1496
  *
1497
+ * **Details**
1498
+ *
1449
1499
  * Enables Claude to search the web for real-time information. This is a
1450
1500
  * server-side tool executed by Anthropic's infrastructure.
1451
- *
1452
1501
  * Generally available (no beta header required).
1453
1502
  *
1454
1503
  * @category Web Search
@@ -1568,9 +1617,10 @@ export type WebFetchParameters = typeof WebFetchParameters.Type
1568
1617
  /**
1569
1618
  * Web fetch tool for Claude models.
1570
1619
  *
1620
+ * **Details**
1621
+ *
1571
1622
  * Allows Claude to retrieve full content from web pages and PDF documents.
1572
1623
  * This is a server-side tool executed by Anthropic's infrastructure.
1573
- *
1574
1624
  * Requires the "web-fetch-2025-09-10" beta header.
1575
1625
  *
1576
1626
  * @category Web Fetch
@@ -1597,6 +1647,8 @@ export const WebFetch_20250910 = Tool.providerDefined({
1597
1647
  /**
1598
1648
  * Input parameters for regex-based tool search.
1599
1649
  *
1650
+ * **Details**
1651
+ *
1600
1652
  * Claude constructs regex patterns using Python's `re.search()` syntax.
1601
1653
  * Maximum query length: 200 characters.
1602
1654
  *
@@ -1644,10 +1696,11 @@ export type ToolSearchBM25Parameters = typeof ToolSearchBM25Parameters.Type
1644
1696
  /**
1645
1697
  * Regex-based tool search for Claude models.
1646
1698
  *
1699
+ * **Details**
1700
+ *
1647
1701
  * Claude constructs regex patterns using Python's `re.search()` syntax to
1648
1702
  * find tools. The regex is matched against tool names, descriptions,
1649
1703
  * argument names, and argument descriptions.
1650
- *
1651
1704
  * Requires the "advanced-tool-use-2025-11-20" beta header.
1652
1705
  *
1653
1706
  * @category Tool Search
@@ -1665,10 +1718,11 @@ export const ToolSearchRegex_20251119 = Tool.providerDefined({
1665
1718
  /**
1666
1719
  * BM25/natural language tool search for Claude models.
1667
1720
  *
1721
+ * **Details**
1722
+ *
1668
1723
  * Claude uses natural language queries to search for tools using the
1669
1724
  * BM25 algorithm. The search is performed against tool names, descriptions,
1670
1725
  * argument names, and argument descriptions.
1671
- *
1672
1726
  * Requires the "advanced-tool-use-2025-11-20" beta header.
1673
1727
  *
1674
1728
  * @category Tool Search
package/src/index.ts CHANGED
@@ -54,7 +54,7 @@ export * as AnthropicError from "./AnthropicError.ts"
54
54
  * and converts Anthropic responses and streams back into Effect AI response
55
55
  * parts with Anthropic-specific metadata.
56
56
  *
57
- * **Common tasks**
57
+ * **When to use**
58
58
  *
59
59
  * - Create an Anthropic-backed model with {@link model}
60
60
  * - Build or provide a `LanguageModel.LanguageModel` layer with {@link layer}