modelfusion 0.129.0 → 0.129.1
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/README.md +5 -2
- package/core/schema/ZodSchema.cjs +12 -0
- package/core/schema/ZodSchema.d.ts +10 -0
- package/core/schema/ZodSchema.js +12 -0
- package/model-function/generate-text/prompt-template/ContentPart.d.ts +4 -3
- package/model-provider/stability/StabilityImageGenerationModel.d.ts +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
@@ -637,9 +637,12 @@ Ask questions about a PDF document and get answers from the document.
|
|
637
637
|
|
638
638
|
### [Next.js / ModelFusion Demos](https://github.com/lgrammel/modelfusion/tree/main/examples/nextjs)
|
639
639
|
|
640
|
-
> _Next.js app_, _image generation_
|
640
|
+
> _Next.js app_, _image generation_, _transcription_, _OpenAI_, _Stability AI_
|
641
641
|
|
642
|
-
|
642
|
+
Examples of using ModelFusion with Next.js 14 (App Router):
|
643
|
+
|
644
|
+
- image generation
|
645
|
+
- voice recording & transcription
|
643
646
|
|
644
647
|
### [Duplex Speech Streaming (using Vite/React & ModelFusion Server/Fastify)](https://github.com/lgrammel/modelfusion/tree/main/examples/speech-streaming-vite-react-fastify)
|
645
648
|
|
@@ -14,12 +14,24 @@ class ZodSchema {
|
|
14
14
|
writable: true,
|
15
15
|
value: void 0
|
16
16
|
});
|
17
|
+
/**
|
18
|
+
* Use only for typing purposes. The value is always `undefined`.
|
19
|
+
*/
|
17
20
|
Object.defineProperty(this, "_type", {
|
18
21
|
enumerable: true,
|
19
22
|
configurable: true,
|
20
23
|
writable: true,
|
21
24
|
value: void 0
|
22
25
|
});
|
26
|
+
/**
|
27
|
+
* Use only for typing purposes. The value is always `undefined`.
|
28
|
+
*/
|
29
|
+
Object.defineProperty(this, "_partialType", {
|
30
|
+
enumerable: true,
|
31
|
+
configurable: true,
|
32
|
+
writable: true,
|
33
|
+
value: void 0
|
34
|
+
});
|
23
35
|
this.zodSchema = zodSchema;
|
24
36
|
}
|
25
37
|
validate(data) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { z } from "zod";
|
2
2
|
import { JsonSchemaProducer } from "./JsonSchemaProducer.js";
|
3
3
|
import { Schema } from "./Schema.js";
|
4
|
+
import { PartialDeep } from "type-fest";
|
4
5
|
export declare function zodSchema<STRUCTURE>(zodSchema: z.Schema<STRUCTURE>): ZodSchema<STRUCTURE>;
|
5
6
|
export declare class ZodSchema<STRUCTURE> implements Schema<STRUCTURE>, JsonSchemaProducer {
|
6
7
|
readonly zodSchema: z.Schema<STRUCTURE>;
|
@@ -13,5 +14,14 @@ export declare class ZodSchema<STRUCTURE> implements Schema<STRUCTURE>, JsonSche
|
|
13
14
|
error: unknown;
|
14
15
|
};
|
15
16
|
getJsonSchema(): unknown;
|
17
|
+
/**
|
18
|
+
* Use only for typing purposes. The value is always `undefined`.
|
19
|
+
*/
|
16
20
|
readonly _type: STRUCTURE;
|
21
|
+
/**
|
22
|
+
* Use only for typing purposes. The value is always `undefined`.
|
23
|
+
*/
|
24
|
+
readonly _partialType: PartialDeep<STRUCTURE, {
|
25
|
+
recurseIntoArrays: true;
|
26
|
+
}>;
|
17
27
|
}
|
package/core/schema/ZodSchema.js
CHANGED
@@ -10,12 +10,24 @@ export class ZodSchema {
|
|
10
10
|
writable: true,
|
11
11
|
value: void 0
|
12
12
|
});
|
13
|
+
/**
|
14
|
+
* Use only for typing purposes. The value is always `undefined`.
|
15
|
+
*/
|
13
16
|
Object.defineProperty(this, "_type", {
|
14
17
|
enumerable: true,
|
15
18
|
configurable: true,
|
16
19
|
writable: true,
|
17
20
|
value: void 0
|
18
21
|
});
|
22
|
+
/**
|
23
|
+
* Use only for typing purposes. The value is always `undefined`.
|
24
|
+
*/
|
25
|
+
Object.defineProperty(this, "_partialType", {
|
26
|
+
enumerable: true,
|
27
|
+
configurable: true,
|
28
|
+
writable: true,
|
29
|
+
value: void 0
|
30
|
+
});
|
19
31
|
this.zodSchema = zodSchema;
|
20
32
|
}
|
21
33
|
validate(data) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
export interface TextPart {
|
2
3
|
type: "text";
|
3
4
|
/**
|
@@ -8,9 +9,9 @@ export interface TextPart {
|
|
8
9
|
export interface ImagePart {
|
9
10
|
type: "image";
|
10
11
|
/**
|
11
|
-
* Image data. Can either be a base64-encoded string or a
|
12
|
+
* Image data. Can either be a base64-encoded string, a Uint8Array, or a Buffer.
|
12
13
|
*/
|
13
|
-
image: string | Uint8Array;
|
14
|
+
image: string | Uint8Array | Buffer;
|
14
15
|
/**
|
15
16
|
* Optional mime type of the image.
|
16
17
|
*/
|
@@ -27,5 +28,5 @@ export interface ToolResponsePart {
|
|
27
28
|
id: string;
|
28
29
|
response: unknown;
|
29
30
|
}
|
30
|
-
export declare function getImageAsBase64(image: string | Uint8Array): string;
|
31
|
+
export declare function getImageAsBase64(image: string | Uint8Array | Buffer): string;
|
31
32
|
export declare function validateContentIsString(content: string | unknown, prompt: unknown): string;
|
@@ -69,9 +69,9 @@ export declare class StabilityImageGenerationModel extends AbstractModel<Stabili
|
|
69
69
|
doGenerateImages(prompt: StabilityImageGenerationPrompt, callOptions: FunctionCallOptions): Promise<{
|
70
70
|
rawResponse: {
|
71
71
|
artifacts: {
|
72
|
+
base64: string;
|
72
73
|
finishReason: "ERROR" | "SUCCESS" | "CONTENT_FILTERED";
|
73
74
|
seed: number;
|
74
|
-
base64: string;
|
75
75
|
}[];
|
76
76
|
};
|
77
77
|
base64Images: string[];
|
@@ -86,25 +86,25 @@ declare const stabilityImageGenerationResponseSchema: z.ZodObject<{
|
|
86
86
|
seed: z.ZodNumber;
|
87
87
|
finishReason: z.ZodEnum<["SUCCESS", "ERROR", "CONTENT_FILTERED"]>;
|
88
88
|
}, "strip", z.ZodTypeAny, {
|
89
|
+
base64: string;
|
89
90
|
finishReason: "ERROR" | "SUCCESS" | "CONTENT_FILTERED";
|
90
91
|
seed: number;
|
91
|
-
base64: string;
|
92
92
|
}, {
|
93
|
+
base64: string;
|
93
94
|
finishReason: "ERROR" | "SUCCESS" | "CONTENT_FILTERED";
|
94
95
|
seed: number;
|
95
|
-
base64: string;
|
96
96
|
}>, "many">;
|
97
97
|
}, "strip", z.ZodTypeAny, {
|
98
98
|
artifacts: {
|
99
|
+
base64: string;
|
99
100
|
finishReason: "ERROR" | "SUCCESS" | "CONTENT_FILTERED";
|
100
101
|
seed: number;
|
101
|
-
base64: string;
|
102
102
|
}[];
|
103
103
|
}, {
|
104
104
|
artifacts: {
|
105
|
+
base64: string;
|
105
106
|
finishReason: "ERROR" | "SUCCESS" | "CONTENT_FILTERED";
|
106
107
|
seed: number;
|
107
|
-
base64: string;
|
108
108
|
}[];
|
109
109
|
}>;
|
110
110
|
export type StabilityImageGenerationResponse = z.infer<typeof stabilityImageGenerationResponseSchema>;
|