ai 5.0.0-canary.14 → 5.0.0-canary.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/CHANGELOG.md +17 -0
- package/dist/index.d.mts +98 -160
- package/dist/index.d.ts +98 -160
- package/dist/index.js +85 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -86
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +24 -60
- package/dist/internal/index.d.ts +24 -60
- package/dist/internal/index.js +10 -67
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +5 -48
- package/dist/internal/index.mjs.map +1 -1
- package/dist/test/index.d.mts +4 -3
- package/dist/test/index.d.ts +4 -3
- package/dist/test/index.js +5 -2
- package/dist/test/index.js.map +1 -1
- package/dist/test/index.mjs +5 -2
- package/dist/test/index.mjs.map +1 -1
- package/package.json +3 -4
package/dist/internal/index.mjs
CHANGED
@@ -684,7 +684,11 @@ async function standardizePrompt({
|
|
684
684
|
}
|
685
685
|
|
686
686
|
// core/util/index.ts
|
687
|
-
import {
|
687
|
+
import {
|
688
|
+
generateId,
|
689
|
+
jsonSchema,
|
690
|
+
asSchema
|
691
|
+
} from "@ai-sdk/provider-utils";
|
688
692
|
|
689
693
|
// core/util/data-stream-parts.ts
|
690
694
|
var textStreamPart = {
|
@@ -942,53 +946,6 @@ function formatDataStreamPart(type, value) {
|
|
942
946
|
`;
|
943
947
|
}
|
944
948
|
|
945
|
-
// core/util/schema.ts
|
946
|
-
import { validatorSymbol } from "@ai-sdk/provider-utils";
|
947
|
-
|
948
|
-
// core/util/zod-schema.ts
|
949
|
-
import zodToJsonSchema from "zod-to-json-schema";
|
950
|
-
function zodSchema(zodSchema2, options) {
|
951
|
-
var _a7;
|
952
|
-
const useReferences = (_a7 = options == null ? void 0 : options.useReferences) != null ? _a7 : false;
|
953
|
-
return jsonSchema(
|
954
|
-
zodToJsonSchema(zodSchema2, {
|
955
|
-
$refStrategy: useReferences ? "root" : "none",
|
956
|
-
target: "jsonSchema7"
|
957
|
-
// note: openai mode breaks various gemini conversions
|
958
|
-
}),
|
959
|
-
{
|
960
|
-
validate: (value) => {
|
961
|
-
const result = zodSchema2.safeParse(value);
|
962
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
963
|
-
}
|
964
|
-
}
|
965
|
-
);
|
966
|
-
}
|
967
|
-
|
968
|
-
// core/util/schema.ts
|
969
|
-
var schemaSymbol = Symbol.for("vercel.ai.schema");
|
970
|
-
function jsonSchema(jsonSchema2, {
|
971
|
-
validate
|
972
|
-
} = {}) {
|
973
|
-
return {
|
974
|
-
[schemaSymbol]: true,
|
975
|
-
_type: void 0,
|
976
|
-
// should never be used directly
|
977
|
-
[validatorSymbol]: true,
|
978
|
-
jsonSchema: jsonSchema2,
|
979
|
-
validate
|
980
|
-
};
|
981
|
-
}
|
982
|
-
function isSchema(value) {
|
983
|
-
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
|
984
|
-
}
|
985
|
-
function asSchema(schema) {
|
986
|
-
return schema == null ? jsonSchema({
|
987
|
-
properties: {},
|
988
|
-
additionalProperties: false
|
989
|
-
}) : isSchema(schema) ? schema : zodSchema(schema);
|
990
|
-
}
|
991
|
-
|
992
949
|
// core/util/is-non-empty-object.ts
|
993
950
|
function isNonEmptyObject(object) {
|
994
951
|
return object != null && Object.keys(object).length > 0;
|