ai 5.0.0-canary.13 → 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 +30 -0
- package/dist/index.d.mts +133 -294
- package/dist/index.d.ts +133 -294
- package/dist/index.js +174 -242
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -174
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +24 -65
- package/dist/internal/index.d.ts +24 -65
- package/dist/internal/index.js +10 -69
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +5 -50
- 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
@@ -638,7 +638,6 @@ async function standardizePrompt({
|
|
638
638
|
});
|
639
639
|
}
|
640
640
|
return {
|
641
|
-
type: "prompt",
|
642
641
|
system: prompt.system,
|
643
642
|
messages: [
|
644
643
|
{
|
@@ -677,7 +676,6 @@ async function standardizePrompt({
|
|
677
676
|
});
|
678
677
|
}
|
679
678
|
return {
|
680
|
-
type: "messages",
|
681
679
|
messages,
|
682
680
|
system: prompt.system
|
683
681
|
};
|
@@ -686,7 +684,11 @@ async function standardizePrompt({
|
|
686
684
|
}
|
687
685
|
|
688
686
|
// core/util/index.ts
|
689
|
-
import {
|
687
|
+
import {
|
688
|
+
generateId,
|
689
|
+
jsonSchema,
|
690
|
+
asSchema
|
691
|
+
} from "@ai-sdk/provider-utils";
|
690
692
|
|
691
693
|
// core/util/data-stream-parts.ts
|
692
694
|
var textStreamPart = {
|
@@ -944,53 +946,6 @@ function formatDataStreamPart(type, value) {
|
|
944
946
|
`;
|
945
947
|
}
|
946
948
|
|
947
|
-
// core/util/schema.ts
|
948
|
-
import { validatorSymbol } from "@ai-sdk/provider-utils";
|
949
|
-
|
950
|
-
// core/util/zod-schema.ts
|
951
|
-
import zodToJsonSchema from "zod-to-json-schema";
|
952
|
-
function zodSchema(zodSchema2, options) {
|
953
|
-
var _a7;
|
954
|
-
const useReferences = (_a7 = options == null ? void 0 : options.useReferences) != null ? _a7 : false;
|
955
|
-
return jsonSchema(
|
956
|
-
zodToJsonSchema(zodSchema2, {
|
957
|
-
$refStrategy: useReferences ? "root" : "none",
|
958
|
-
target: "jsonSchema7"
|
959
|
-
// note: openai mode breaks various gemini conversions
|
960
|
-
}),
|
961
|
-
{
|
962
|
-
validate: (value) => {
|
963
|
-
const result = zodSchema2.safeParse(value);
|
964
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
965
|
-
}
|
966
|
-
}
|
967
|
-
);
|
968
|
-
}
|
969
|
-
|
970
|
-
// core/util/schema.ts
|
971
|
-
var schemaSymbol = Symbol.for("vercel.ai.schema");
|
972
|
-
function jsonSchema(jsonSchema2, {
|
973
|
-
validate
|
974
|
-
} = {}) {
|
975
|
-
return {
|
976
|
-
[schemaSymbol]: true,
|
977
|
-
_type: void 0,
|
978
|
-
// should never be used directly
|
979
|
-
[validatorSymbol]: true,
|
980
|
-
jsonSchema: jsonSchema2,
|
981
|
-
validate
|
982
|
-
};
|
983
|
-
}
|
984
|
-
function isSchema(value) {
|
985
|
-
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
|
986
|
-
}
|
987
|
-
function asSchema(schema) {
|
988
|
-
return schema == null ? jsonSchema({
|
989
|
-
properties: {},
|
990
|
-
additionalProperties: false
|
991
|
-
}) : isSchema(schema) ? schema : zodSchema(schema);
|
992
|
-
}
|
993
|
-
|
994
949
|
// core/util/is-non-empty-object.ts
|
995
950
|
function isNonEmptyObject(object) {
|
996
951
|
return object != null && Object.keys(object).length > 0;
|