@r16t/multimodal-mcp 1.2.2 → 1.2.3
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/build/providers/google.js +25 -19
- package/build/providers/openai.js +1 -1
- package/package.json +1 -1
|
@@ -18,12 +18,13 @@ export class GoogleProvider {
|
|
|
18
18
|
this.apiKey = apiKey;
|
|
19
19
|
}
|
|
20
20
|
async generateImage(params) {
|
|
21
|
-
const response = await fetch(`${GEMINI_BASE_URL}/models/imagen-4:
|
|
21
|
+
const response = await fetch(`${GEMINI_BASE_URL}/models/imagen-4.0-generate-001:predict?key=${this.apiKey}`, {
|
|
22
22
|
method: "POST",
|
|
23
23
|
headers: { "Content-Type": "application/json" },
|
|
24
24
|
body: JSON.stringify({
|
|
25
|
-
prompt: params.prompt,
|
|
26
|
-
|
|
25
|
+
instances: [{ prompt: params.prompt }],
|
|
26
|
+
parameters: {
|
|
27
|
+
sampleCount: 1,
|
|
27
28
|
aspectRatio: params.aspectRatio,
|
|
28
29
|
...params.providerOptions,
|
|
29
30
|
},
|
|
@@ -37,7 +38,7 @@ export class GoogleProvider {
|
|
|
37
38
|
return {
|
|
38
39
|
data: Buffer.from(base64, "base64"),
|
|
39
40
|
mimeType: "image/png",
|
|
40
|
-
metadata: { model: "imagen-4", provider: "google" },
|
|
41
|
+
metadata: { model: "imagen-4.0-generate-001", provider: "google" },
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
async editImage(params) {
|
|
@@ -50,8 +51,8 @@ export class GoogleProvider {
|
|
|
50
51
|
parts: [
|
|
51
52
|
{ text: params.prompt },
|
|
52
53
|
{
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
inlineData: {
|
|
55
|
+
mimeType: params.imageMimeType,
|
|
55
56
|
data: base64Image,
|
|
56
57
|
},
|
|
57
58
|
},
|
|
@@ -82,22 +83,27 @@ export class GoogleProvider {
|
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
85
|
async generateVideo(params) {
|
|
85
|
-
const
|
|
86
|
+
const instance = {
|
|
86
87
|
prompt: params.prompt,
|
|
87
|
-
config: {
|
|
88
|
-
aspectRatio: params.aspectRatio,
|
|
89
|
-
durationSeconds: params.duration,
|
|
90
|
-
...params.providerOptions,
|
|
91
|
-
},
|
|
92
88
|
};
|
|
93
89
|
if (params.imageData) {
|
|
94
90
|
const base64Image = params.imageData.toString("base64");
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
instance.image = {
|
|
92
|
+
inlineData: {
|
|
93
|
+
mimeType: params.imageMimeType ?? "image/png",
|
|
94
|
+
data: base64Image,
|
|
95
|
+
},
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
|
-
const
|
|
98
|
+
const requestBody = {
|
|
99
|
+
instances: [instance],
|
|
100
|
+
parameters: {
|
|
101
|
+
aspectRatio: params.aspectRatio,
|
|
102
|
+
durationSeconds: params.duration,
|
|
103
|
+
...params.providerOptions,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
const submitResponse = await fetch(`${GEMINI_BASE_URL}/models/veo-3.1-generate-preview:predictLongRunning?key=${this.apiKey}`, {
|
|
101
107
|
method: "POST",
|
|
102
108
|
headers: { "Content-Type": "application/json" },
|
|
103
109
|
body: JSON.stringify(requestBody),
|
|
@@ -116,7 +122,7 @@ export class GoogleProvider {
|
|
|
116
122
|
return {
|
|
117
123
|
data,
|
|
118
124
|
mimeType: "video/mp4",
|
|
119
|
-
metadata: { model: "veo-3.1", provider: "google", operationName: operation.name },
|
|
125
|
+
metadata: { model: "veo-3.1-generate-preview", provider: "google", operationName: operation.name },
|
|
120
126
|
};
|
|
121
127
|
}
|
|
122
128
|
async generateAudio(params) {
|
|
@@ -128,8 +134,8 @@ export class GoogleProvider {
|
|
|
128
134
|
body: JSON.stringify({
|
|
129
135
|
contents: [{ parts: [{ text: params.text }] }],
|
|
130
136
|
generationConfig: {
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
responseModalities: ["AUDIO"],
|
|
138
|
+
speechConfig: {
|
|
133
139
|
voiceConfig: {
|
|
134
140
|
prebuiltVoiceConfig: { voiceName: voice },
|
|
135
141
|
},
|