@ai-sdk/anthropic 2.0.12 → 2.0.14
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/CHANGELOG.md +14 -0
- package/dist/index.d.mts +89 -61
- package/dist/index.d.ts +89 -61
- package/dist/index.js +60 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -25
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +89 -61
- package/dist/internal/index.d.ts +89 -61
- package/dist/internal/index.js +60 -25
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +60 -25
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -544,7 +544,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
|
-
|
|
547
|
+
const toolResultParts = anthropicContent.filter(
|
|
548
|
+
(part) => part.type === "tool_result"
|
|
549
|
+
);
|
|
550
|
+
const otherParts = anthropicContent.filter(
|
|
551
|
+
(part) => part.type !== "tool_result"
|
|
552
|
+
);
|
|
553
|
+
const reorderedContent = toolResultParts.length > 0 ? [...toolResultParts, ...otherParts] : anthropicContent;
|
|
554
|
+
messages.push({ role: "user", content: reorderedContent });
|
|
548
555
|
break;
|
|
549
556
|
}
|
|
550
557
|
case "assistant": {
|
|
@@ -1970,69 +1977,97 @@ var textEditor_20250429 = createProviderDefinedToolFactory7({
|
|
|
1970
1977
|
// src/anthropic-tools.ts
|
|
1971
1978
|
var anthropicTools = {
|
|
1972
1979
|
/**
|
|
1973
|
-
*
|
|
1980
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
1981
|
+
* allowing system operations, script execution, and command-line automation.
|
|
1974
1982
|
*
|
|
1975
1983
|
* Image results are supported.
|
|
1976
1984
|
*
|
|
1977
|
-
*
|
|
1985
|
+
* Tool name must be `bash`.
|
|
1978
1986
|
*/
|
|
1979
1987
|
bash_20241022,
|
|
1980
1988
|
/**
|
|
1981
|
-
*
|
|
1989
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
1990
|
+
* allowing system operations, script execution, and command-line automation.
|
|
1982
1991
|
*
|
|
1983
1992
|
* Image results are supported.
|
|
1984
1993
|
*
|
|
1985
|
-
*
|
|
1994
|
+
* Tool name must be `bash`.
|
|
1986
1995
|
*/
|
|
1987
1996
|
bash_20250124,
|
|
1988
1997
|
/**
|
|
1989
|
-
*
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
*
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
* Creates a tool for editing text. Must have name "str_replace_based_edit_tool".
|
|
1998
|
-
* Note: This version does not support the "undo_edit" command.
|
|
1998
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
1999
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
2000
|
+
* the API conversation.
|
|
2001
|
+
*
|
|
2002
|
+
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
2003
|
+
* including writing code, in a secure, sandboxed environment.
|
|
2004
|
+
*
|
|
2005
|
+
* Tool name must be `code_execution`.
|
|
1999
2006
|
*/
|
|
2000
|
-
|
|
2007
|
+
codeExecution_20250522,
|
|
2001
2008
|
/**
|
|
2002
|
-
*
|
|
2009
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
2010
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
2003
2011
|
*
|
|
2004
2012
|
* Image results are supported.
|
|
2005
2013
|
*
|
|
2014
|
+
* Tool name must be `computer`.
|
|
2015
|
+
*
|
|
2006
2016
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
2007
2017
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
2008
2018
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
2009
2019
|
*/
|
|
2010
2020
|
computer_20241022,
|
|
2011
2021
|
/**
|
|
2012
|
-
*
|
|
2022
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
2023
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
2013
2024
|
*
|
|
2014
2025
|
* Image results are supported.
|
|
2015
2026
|
*
|
|
2027
|
+
* Tool name must be `computer`.
|
|
2028
|
+
*
|
|
2016
2029
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
2017
2030
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
2018
2031
|
* @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
|
|
2019
|
-
* @param execute - The function to execute the tool. Optional.
|
|
2020
2032
|
*/
|
|
2021
2033
|
computer_20250124,
|
|
2034
|
+
/**
|
|
2035
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2036
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2037
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2038
|
+
*
|
|
2039
|
+
* Tool name must be `str_replace_editor`.
|
|
2040
|
+
*/
|
|
2041
|
+
textEditor_20241022,
|
|
2042
|
+
/**
|
|
2043
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2044
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2045
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2046
|
+
*
|
|
2047
|
+
* Tool name must be `str_replace_editor`.
|
|
2048
|
+
*/
|
|
2049
|
+
textEditor_20250124,
|
|
2050
|
+
/**
|
|
2051
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2052
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2053
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2054
|
+
*
|
|
2055
|
+
* Note: This version does not support the "undo_edit" command.
|
|
2056
|
+
*
|
|
2057
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
2058
|
+
*/
|
|
2059
|
+
textEditor_20250429,
|
|
2022
2060
|
/**
|
|
2023
2061
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
2024
|
-
*
|
|
2062
|
+
*
|
|
2063
|
+
* Tool name must be `web_search`.
|
|
2025
2064
|
*
|
|
2026
2065
|
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
2027
2066
|
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
2028
2067
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
2029
2068
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
2030
2069
|
*/
|
|
2031
|
-
webSearch_20250305
|
|
2032
|
-
/**
|
|
2033
|
-
* Creates a tool for executing Python code. Must have name "code_execution".
|
|
2034
|
-
*/
|
|
2035
|
-
codeExecution_20250522
|
|
2070
|
+
webSearch_20250305
|
|
2036
2071
|
};
|
|
2037
2072
|
export {
|
|
2038
2073
|
AnthropicMessagesLanguageModel,
|