ai 6.0.0-beta.149 → 6.0.0-beta.150

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
2
2
 
3
+ ## 6.0.0-beta.150
4
+
5
+ ### Patch Changes
6
+
7
+ - db62f7d: Added schema name and description for generateText and output
8
+
3
9
  ## 6.0.0-beta.149
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -603,41 +603,91 @@ declare const text: () => Output<string, string>;
603
603
  * When the model generates a text response, it will return an object that matches the schema.
604
604
  *
605
605
  * @param schema - The schema of the object to generate.
606
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
607
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
606
608
  *
607
609
  * @returns An output specification for generating objects with the specified schema.
608
610
  */
609
- declare const object: <OBJECT>({ schema: inputSchema, }: {
611
+ declare const object: <OBJECT>({ schema: inputSchema, name, description, }: {
610
612
  schema: FlexibleSchema<OBJECT>;
613
+ /**
614
+ * Optional name of the output that should be generated.
615
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
616
+ */
617
+ name?: string;
618
+ /**
619
+ * Optional description of the output that should be generated.
620
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
621
+ */
622
+ description?: string;
611
623
  }) => Output<OBJECT, DeepPartial<OBJECT>>;
612
624
  /**
613
625
  * Output specification for array generation.
614
626
  * When the model generates a text response, it will return an array of elements.
615
627
  *
616
628
  * @param element - The schema of the array elements to generate.
629
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
630
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
617
631
  *
618
632
  * @returns An output specification for generating an array of elements.
619
633
  */
620
- declare const array: <ELEMENT>({ element: inputElementSchema, }: {
634
+ declare const array: <ELEMENT>({ element: inputElementSchema, name, description, }: {
621
635
  element: FlexibleSchema<ELEMENT>;
636
+ /**
637
+ * Optional name of the output that should be generated.
638
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
639
+ */
640
+ name?: string;
641
+ /**
642
+ * Optional description of the output that should be generated.
643
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
644
+ */
645
+ description?: string;
622
646
  }) => Output<Array<ELEMENT>, Array<ELEMENT>>;
623
647
  /**
624
648
  * Output specification for choice generation.
625
649
  * When the model generates a text response, it will return a one of the choice options.
626
650
  *
627
651
  * @param options - The available choices.
652
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
653
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
628
654
  *
629
655
  * @returns An output specification for generating a choice.
630
656
  */
631
- declare const choice: <CHOICE extends string>({ options: choiceOptions, }: {
657
+ declare const choice: <CHOICE extends string>({ options: choiceOptions, name, description, }: {
632
658
  options: Array<CHOICE>;
659
+ /**
660
+ * Optional name of the output that should be generated.
661
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
662
+ */
663
+ name?: string;
664
+ /**
665
+ * Optional description of the output that should be generated.
666
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
667
+ */
668
+ description?: string;
633
669
  }) => Output<CHOICE, CHOICE>;
634
670
  /**
635
671
  * Output specification for unstructured JSON generation.
636
672
  * When the model generates a text response, it will return a JSON object.
637
673
  *
674
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
675
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
676
+ *
638
677
  * @returns An output specification for generating JSON.
639
678
  */
640
- declare const json: () => Output<JSONValue$1, JSONValue$1>;
679
+ declare const json: ({ name, description, }?: {
680
+ /**
681
+ * Optional name of the output that should be generated.
682
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
683
+ */
684
+ name?: string;
685
+ /**
686
+ * Optional description of the output that should be generated.
687
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
688
+ */
689
+ description?: string;
690
+ }) => Output<JSONValue$1, JSONValue$1>;
641
691
 
642
692
  type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
643
693
  declare const output_array: typeof array;
package/dist/index.d.ts CHANGED
@@ -603,41 +603,91 @@ declare const text: () => Output<string, string>;
603
603
  * When the model generates a text response, it will return an object that matches the schema.
604
604
  *
605
605
  * @param schema - The schema of the object to generate.
606
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
607
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
606
608
  *
607
609
  * @returns An output specification for generating objects with the specified schema.
608
610
  */
609
- declare const object: <OBJECT>({ schema: inputSchema, }: {
611
+ declare const object: <OBJECT>({ schema: inputSchema, name, description, }: {
610
612
  schema: FlexibleSchema<OBJECT>;
613
+ /**
614
+ * Optional name of the output that should be generated.
615
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
616
+ */
617
+ name?: string;
618
+ /**
619
+ * Optional description of the output that should be generated.
620
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
621
+ */
622
+ description?: string;
611
623
  }) => Output<OBJECT, DeepPartial<OBJECT>>;
612
624
  /**
613
625
  * Output specification for array generation.
614
626
  * When the model generates a text response, it will return an array of elements.
615
627
  *
616
628
  * @param element - The schema of the array elements to generate.
629
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
630
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
617
631
  *
618
632
  * @returns An output specification for generating an array of elements.
619
633
  */
620
- declare const array: <ELEMENT>({ element: inputElementSchema, }: {
634
+ declare const array: <ELEMENT>({ element: inputElementSchema, name, description, }: {
621
635
  element: FlexibleSchema<ELEMENT>;
636
+ /**
637
+ * Optional name of the output that should be generated.
638
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
639
+ */
640
+ name?: string;
641
+ /**
642
+ * Optional description of the output that should be generated.
643
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
644
+ */
645
+ description?: string;
622
646
  }) => Output<Array<ELEMENT>, Array<ELEMENT>>;
623
647
  /**
624
648
  * Output specification for choice generation.
625
649
  * When the model generates a text response, it will return a one of the choice options.
626
650
  *
627
651
  * @param options - The available choices.
652
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
653
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
628
654
  *
629
655
  * @returns An output specification for generating a choice.
630
656
  */
631
- declare const choice: <CHOICE extends string>({ options: choiceOptions, }: {
657
+ declare const choice: <CHOICE extends string>({ options: choiceOptions, name, description, }: {
632
658
  options: Array<CHOICE>;
659
+ /**
660
+ * Optional name of the output that should be generated.
661
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
662
+ */
663
+ name?: string;
664
+ /**
665
+ * Optional description of the output that should be generated.
666
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
667
+ */
668
+ description?: string;
633
669
  }) => Output<CHOICE, CHOICE>;
634
670
  /**
635
671
  * Output specification for unstructured JSON generation.
636
672
  * When the model generates a text response, it will return a JSON object.
637
673
  *
674
+ * @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
675
+ * @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
676
+ *
638
677
  * @returns An output specification for generating JSON.
639
678
  */
640
- declare const json: () => Output<JSONValue$1, JSONValue$1>;
679
+ declare const json: ({ name, description, }?: {
680
+ /**
681
+ * Optional name of the output that should be generated.
682
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema name.
683
+ */
684
+ name?: string;
685
+ /**
686
+ * Optional description of the output that should be generated.
687
+ * Used by some providers for additional LLM guidance, e.g. via tool or schema description.
688
+ */
689
+ description?: string;
690
+ }) => Output<JSONValue$1, JSONValue$1>;
641
691
 
642
692
  type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
643
693
  declare const output_array: typeof array;
package/dist/index.js CHANGED
@@ -962,7 +962,7 @@ function detectMediaType({
962
962
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
963
963
 
964
964
  // src/version.ts
965
- var VERSION = true ? "6.0.0-beta.149" : "0.0.0-test";
965
+ var VERSION = true ? "6.0.0-beta.150" : "0.0.0-test";
966
966
 
967
967
  // src/util/download/download.ts
968
968
  var download = async ({ url }) => {
@@ -2869,13 +2869,17 @@ var text = () => ({
2869
2869
  }
2870
2870
  });
2871
2871
  var object = ({
2872
- schema: inputSchema
2872
+ schema: inputSchema,
2873
+ name: name15,
2874
+ description
2873
2875
  }) => {
2874
2876
  const schema = (0, import_provider_utils11.asSchema)(inputSchema);
2875
2877
  return {
2876
2878
  responseFormat: (0, import_provider_utils11.resolve)(schema.jsonSchema).then((jsonSchema2) => ({
2877
2879
  type: "json",
2878
- schema: jsonSchema2
2880
+ schema: jsonSchema2,
2881
+ ...name15 != null && { name: name15 },
2882
+ ...description != null && { description }
2879
2883
  })),
2880
2884
  async parseCompleteOutput({ text: text2 }, context) {
2881
2885
  const parseResult = await (0, import_provider_utils11.safeParseJSON)({ text: text2 });
@@ -2924,7 +2928,9 @@ var object = ({
2924
2928
  };
2925
2929
  };
2926
2930
  var array = ({
2927
- element: inputElementSchema
2931
+ element: inputElementSchema,
2932
+ name: name15,
2933
+ description
2928
2934
  }) => {
2929
2935
  const elementSchema = (0, import_provider_utils11.asSchema)(inputElementSchema);
2930
2936
  return {
@@ -2941,7 +2947,9 @@ var array = ({
2941
2947
  },
2942
2948
  required: ["elements"],
2943
2949
  additionalProperties: false
2944
- }
2950
+ },
2951
+ ...name15 != null && { name: name15 },
2952
+ ...description != null && { description }
2945
2953
  };
2946
2954
  }),
2947
2955
  async parseCompleteOutput({ text: text2 }, context) {
@@ -3019,7 +3027,9 @@ var array = ({
3019
3027
  };
3020
3028
  };
3021
3029
  var choice = ({
3022
- options: choiceOptions
3030
+ options: choiceOptions,
3031
+ name: name15,
3032
+ description
3023
3033
  }) => {
3024
3034
  return {
3025
3035
  // JSON schema that describes an enumeration:
@@ -3033,7 +3043,9 @@ var choice = ({
3033
3043
  },
3034
3044
  required: ["result"],
3035
3045
  additionalProperties: false
3036
- }
3046
+ },
3047
+ ...name15 != null && { name: name15 },
3048
+ ...description != null && { description }
3037
3049
  }),
3038
3050
  async parseCompleteOutput({ text: text2 }, context) {
3039
3051
  const parseResult = await (0, import_provider_utils11.safeParseJSON)({ text: text2 });
@@ -3089,10 +3101,15 @@ var choice = ({
3089
3101
  }
3090
3102
  };
3091
3103
  };
3092
- var json = () => {
3104
+ var json = ({
3105
+ name: name15,
3106
+ description
3107
+ } = {}) => {
3093
3108
  return {
3094
3109
  responseFormat: Promise.resolve({
3095
- type: "json"
3110
+ type: "json",
3111
+ ...name15 != null && { name: name15 },
3112
+ ...description != null && { description }
3096
3113
  }),
3097
3114
  async parseCompleteOutput({ text: text2 }, context) {
3098
3115
  const parseResult = await (0, import_provider_utils11.safeParseJSON)({ text: text2 });