@ai-sdk/provider 0.0.15 → 0.0.17

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.d.mts CHANGED
@@ -445,7 +445,18 @@ type LanguageModelV1CallSettings = {
445
445
  type: 'text';
446
446
  } | {
447
447
  type: 'json';
448
+ /**
449
+ * JSON schema that the generated output should conform to.
450
+ */
448
451
  schema?: JSONSchema7;
452
+ /**
453
+ * Name of output that should be generated. Used by some providers for additional LLM guidance.
454
+ */
455
+ name?: string;
456
+ /**
457
+ * Description of the output that should be generated. Used by some providers for additional LLM guidance.
458
+ */
459
+ description?: string;
449
460
  };
450
461
  /**
451
462
  The seed (integer) to use for random sampling. If set and supported
@@ -607,7 +618,8 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
607
618
  object-tool mode.
608
619
 
609
620
  @deprecated mode will be removed in v2.
610
- All necessary settings will be directly supported through the call settings.
621
+ All necessary settings will be directly supported through the call settings,
622
+ in particular responseFormat, toolChoice, and tools.
611
623
  */
612
624
  mode: {
613
625
  type: 'regular';
@@ -621,6 +633,18 @@ Specifies how the tool should be selected. Defaults to 'auto'.
621
633
  toolChoice?: LanguageModelV1ToolChoice;
622
634
  } | {
623
635
  type: 'object-json';
636
+ /**
637
+ * JSON schema that the generated output should conform to.
638
+ */
639
+ schema?: JSONSchema7;
640
+ /**
641
+ * Name of output that should be generated. Used by some providers for additional LLM guidance.
642
+ */
643
+ name?: string;
644
+ /**
645
+ * Description of the output that should be generated. Used by some providers for additional LLM guidance.
646
+ */
647
+ description?: string;
624
648
  } | {
625
649
  type: 'object-tool';
626
650
  tool: LanguageModelV1FunctionTool;
@@ -723,6 +747,25 @@ type LanguageModelV1 = {
723
747
  */
724
748
  readonly supportsImageUrls?: boolean;
725
749
  /**
750
+ Flag whether this model supports grammar-guided generation,
751
+ i.e. follows JSON schemas for object generation
752
+ when the response format is set to 'json' or
753
+ when the `object-json` mode is used.
754
+
755
+ This means that the model guarantees that the generated JSON
756
+ will be a valid JSON object AND that the object will match the
757
+ JSON schema.
758
+
759
+ Please note that `generateObject` and `streamObject` will work
760
+ regardless of this flag, but might send different prompts and
761
+ use further optimizations if this flag is set to `true`.
762
+
763
+ Defaults to `false`.
764
+
765
+ TODO rename to supportsGrammarGuidedGeneration in v2
766
+ */
767
+ readonly supportsStructuredOutputs?: boolean;
768
+ /**
726
769
  Generates a language model output (non-streaming).
727
770
 
728
771
  Naming: "do" prefix to prevent accidental direct usage of the method
package/dist/index.d.ts CHANGED
@@ -445,7 +445,18 @@ type LanguageModelV1CallSettings = {
445
445
  type: 'text';
446
446
  } | {
447
447
  type: 'json';
448
+ /**
449
+ * JSON schema that the generated output should conform to.
450
+ */
448
451
  schema?: JSONSchema7;
452
+ /**
453
+ * Name of output that should be generated. Used by some providers for additional LLM guidance.
454
+ */
455
+ name?: string;
456
+ /**
457
+ * Description of the output that should be generated. Used by some providers for additional LLM guidance.
458
+ */
459
+ description?: string;
449
460
  };
450
461
  /**
451
462
  The seed (integer) to use for random sampling. If set and supported
@@ -607,7 +618,8 @@ type LanguageModelV1CallOptions = LanguageModelV1CallSettings & {
607
618
  object-tool mode.
608
619
 
609
620
  @deprecated mode will be removed in v2.
610
- All necessary settings will be directly supported through the call settings.
621
+ All necessary settings will be directly supported through the call settings,
622
+ in particular responseFormat, toolChoice, and tools.
611
623
  */
612
624
  mode: {
613
625
  type: 'regular';
@@ -621,6 +633,18 @@ Specifies how the tool should be selected. Defaults to 'auto'.
621
633
  toolChoice?: LanguageModelV1ToolChoice;
622
634
  } | {
623
635
  type: 'object-json';
636
+ /**
637
+ * JSON schema that the generated output should conform to.
638
+ */
639
+ schema?: JSONSchema7;
640
+ /**
641
+ * Name of output that should be generated. Used by some providers for additional LLM guidance.
642
+ */
643
+ name?: string;
644
+ /**
645
+ * Description of the output that should be generated. Used by some providers for additional LLM guidance.
646
+ */
647
+ description?: string;
624
648
  } | {
625
649
  type: 'object-tool';
626
650
  tool: LanguageModelV1FunctionTool;
@@ -723,6 +747,25 @@ type LanguageModelV1 = {
723
747
  */
724
748
  readonly supportsImageUrls?: boolean;
725
749
  /**
750
+ Flag whether this model supports grammar-guided generation,
751
+ i.e. follows JSON schemas for object generation
752
+ when the response format is set to 'json' or
753
+ when the `object-json` mode is used.
754
+
755
+ This means that the model guarantees that the generated JSON
756
+ will be a valid JSON object AND that the object will match the
757
+ JSON schema.
758
+
759
+ Please note that `generateObject` and `streamObject` will work
760
+ regardless of this flag, but might send different prompts and
761
+ use further optimizations if this flag is set to `true`.
762
+
763
+ Defaults to `false`.
764
+
765
+ TODO rename to supportsGrammarGuidedGeneration in v2
766
+ */
767
+ readonly supportsStructuredOutputs?: boolean;
768
+ /**
726
769
  Generates a language model output (non-streaming).
727
770
 
728
771
  Naming: "do" prefix to prevent accidental direct usage of the method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",