@fairyhunter13/ai-anthropic 3.0.58-fork.1

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 (53) hide show
  1. package/CHANGELOG.md +2521 -0
  2. package/LICENSE +13 -0
  3. package/README.md +43 -0
  4. package/dist/index.d.mts +1099 -0
  5. package/dist/index.d.ts +1099 -0
  6. package/dist/index.js +5222 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/index.mjs +5298 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/internal/index.d.mts +960 -0
  11. package/dist/internal/index.d.ts +960 -0
  12. package/dist/internal/index.js +5122 -0
  13. package/dist/internal/index.js.map +1 -0
  14. package/dist/internal/index.mjs +5190 -0
  15. package/dist/internal/index.mjs.map +1 -0
  16. package/docs/05-anthropic.mdx +1321 -0
  17. package/internal.d.ts +1 -0
  18. package/package.json +83 -0
  19. package/src/anthropic-error.ts +26 -0
  20. package/src/anthropic-message-metadata.ts +143 -0
  21. package/src/anthropic-messages-api.ts +1348 -0
  22. package/src/anthropic-messages-language-model.ts +2407 -0
  23. package/src/anthropic-messages-options.ts +267 -0
  24. package/src/anthropic-prepare-tools.ts +404 -0
  25. package/src/anthropic-provider.ts +177 -0
  26. package/src/anthropic-tools.ts +238 -0
  27. package/src/convert-anthropic-messages-usage.ts +73 -0
  28. package/src/convert-to-anthropic-messages-prompt.ts +1144 -0
  29. package/src/forward-anthropic-container-id-from-last-step.ts +38 -0
  30. package/src/get-cache-control.ts +63 -0
  31. package/src/index.ts +17 -0
  32. package/src/internal/index.ts +4 -0
  33. package/src/map-anthropic-stop-reason.ts +30 -0
  34. package/src/tool/bash_20241022.ts +33 -0
  35. package/src/tool/bash_20250124.ts +33 -0
  36. package/src/tool/code-execution_20250522.ts +61 -0
  37. package/src/tool/code-execution_20250825.ts +281 -0
  38. package/src/tool/code-execution_20260120.ts +315 -0
  39. package/src/tool/computer_20241022.ts +87 -0
  40. package/src/tool/computer_20250124.ts +130 -0
  41. package/src/tool/computer_20251124.ts +151 -0
  42. package/src/tool/memory_20250818.ts +62 -0
  43. package/src/tool/text-editor_20241022.ts +69 -0
  44. package/src/tool/text-editor_20250124.ts +69 -0
  45. package/src/tool/text-editor_20250429.ts +70 -0
  46. package/src/tool/text-editor_20250728.ts +86 -0
  47. package/src/tool/tool-search-bm25_20251119.ts +99 -0
  48. package/src/tool/tool-search-regex_20251119.ts +111 -0
  49. package/src/tool/web-fetch-20250910.ts +145 -0
  50. package/src/tool/web-fetch-20260209.ts +145 -0
  51. package/src/tool/web-search_20250305.ts +136 -0
  52. package/src/tool/web-search_20260209.ts +136 -0
  53. package/src/version.ts +6 -0
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # AI SDK - Anthropic Provider
2
+
3
+ The **[Anthropic provider](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Anthropic Messages API](https://docs.anthropic.com/claude/reference/messages_post).
4
+
5
+ ## Setup
6
+
7
+ The Anthropic provider is available in the `@ai-sdk/anthropic` module. You can install it with
8
+
9
+ ```bash
10
+ npm i @ai-sdk/anthropic
11
+ ```
12
+
13
+ ## Skill for Coding Agents
14
+
15
+ If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:
16
+
17
+ ```shell
18
+ npx skills add vercel/ai
19
+ ```
20
+
21
+ ## Provider Instance
22
+
23
+ You can import the default provider instance `anthropic` from `@ai-sdk/anthropic`:
24
+
25
+ ```ts
26
+ import { anthropic } from '@ai-sdk/anthropic';
27
+ ```
28
+
29
+ ## Example
30
+
31
+ ```ts
32
+ import { anthropic } from '@ai-sdk/anthropic';
33
+ import { generateText } from 'ai';
34
+
35
+ const { text } = await generateText({
36
+ model: anthropic('claude-3-haiku-20240307'),
37
+ prompt: 'Write a vegetarian lasagna recipe for 4 people.',
38
+ });
39
+ ```
40
+
41
+ ## Documentation
42
+
43
+ Please check out the **[Anthropic provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic)** for more information.