@ai-sdk/anthropic 2.0.13 → 2.0.15

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