@ai-sdk/provider 3.0.0-beta.29 → 3.0.0-beta.30

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/provider
2
2
 
3
+ ## 3.0.0-beta.30
4
+
5
+ ### Patch Changes
6
+
7
+ - cbf52cd: feat: expose raw finish reason
8
+
3
9
  ## 3.0.0-beta.29
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1621,18 +1621,31 @@ type LanguageModelV3ToolResult = {
1621
1621
  type LanguageModelV3Content = LanguageModelV3Text | LanguageModelV3Reasoning | LanguageModelV3File | LanguageModelV3Source | LanguageModelV3ToolCall | LanguageModelV3ToolResult;
1622
1622
 
1623
1623
  /**
1624
- Reason why a language model finished generating a response.
1625
-
1626
- Can be one of the following:
1627
- - `stop`: model generated stop sequence
1628
- - `length`: model generated maximum number of tokens
1629
- - `content-filter`: content filter violation stopped the model
1630
- - `tool-calls`: model triggered tool calls
1631
- - `error`: model stopped because of an error
1632
- - `other`: model stopped for other reasons
1633
- - `unknown`: the model has not transmitted a finish reason
1624
+ * Reason why a language model finished generating a response.
1625
+ *
1626
+ * Contains both a unified finish reason and a raw finish reason from the provider.
1627
+ * The unified finish reason is used to provide a consistent finish reason across different providers.
1628
+ * The raw finish reason is used to provide the original finish reason from the provider.
1634
1629
  */
1635
- type LanguageModelV3FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
1630
+ type LanguageModelV3FinishReason = {
1631
+ /**
1632
+ * Unified finish reason. This enables using the same finish reason across different providers.
1633
+ *
1634
+ * Can be one of the following:
1635
+ * - `stop`: model generated stop sequence
1636
+ * - `length`: model generated maximum number of tokens
1637
+ * - `content-filter`: content filter violation stopped the model
1638
+ * - `tool-calls`: model triggered tool calls
1639
+ * - `error`: model stopped because of an error
1640
+ * - `other`: model stopped for other reasons
1641
+ */
1642
+ unified: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
1643
+ /**
1644
+ * Raw finish reason from the provider.
1645
+ * This is the original finish reason from the provider.
1646
+ */
1647
+ raw: string | undefined;
1648
+ };
1636
1649
 
1637
1650
  interface LanguageModelV3ResponseMetadata {
1638
1651
  /**
package/dist/index.d.ts CHANGED
@@ -1621,18 +1621,31 @@ type LanguageModelV3ToolResult = {
1621
1621
  type LanguageModelV3Content = LanguageModelV3Text | LanguageModelV3Reasoning | LanguageModelV3File | LanguageModelV3Source | LanguageModelV3ToolCall | LanguageModelV3ToolResult;
1622
1622
 
1623
1623
  /**
1624
- Reason why a language model finished generating a response.
1625
-
1626
- Can be one of the following:
1627
- - `stop`: model generated stop sequence
1628
- - `length`: model generated maximum number of tokens
1629
- - `content-filter`: content filter violation stopped the model
1630
- - `tool-calls`: model triggered tool calls
1631
- - `error`: model stopped because of an error
1632
- - `other`: model stopped for other reasons
1633
- - `unknown`: the model has not transmitted a finish reason
1624
+ * Reason why a language model finished generating a response.
1625
+ *
1626
+ * Contains both a unified finish reason and a raw finish reason from the provider.
1627
+ * The unified finish reason is used to provide a consistent finish reason across different providers.
1628
+ * The raw finish reason is used to provide the original finish reason from the provider.
1634
1629
  */
1635
- type LanguageModelV3FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
1630
+ type LanguageModelV3FinishReason = {
1631
+ /**
1632
+ * Unified finish reason. This enables using the same finish reason across different providers.
1633
+ *
1634
+ * Can be one of the following:
1635
+ * - `stop`: model generated stop sequence
1636
+ * - `length`: model generated maximum number of tokens
1637
+ * - `content-filter`: content filter violation stopped the model
1638
+ * - `tool-calls`: model triggered tool calls
1639
+ * - `error`: model stopped because of an error
1640
+ * - `other`: model stopped for other reasons
1641
+ */
1642
+ unified: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
1643
+ /**
1644
+ * Raw finish reason from the provider.
1645
+ * This is the original finish reason from the provider.
1646
+ */
1647
+ raw: string | undefined;
1648
+ };
1636
1649
 
1637
1650
  interface LanguageModelV3ResponseMetadata {
1638
1651
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider",
3
- "version": "3.0.0-beta.29",
3
+ "version": "3.0.0-beta.30",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",