@cartanova/qgrid-ai-sdk 2.9.5 → 2.9.6
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 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -220,7 +220,7 @@ const { text } = await generateText({
|
|
|
220
220
|
| `serviceTier` | `string` | OpenAI only | OpenAI/codex service tier |
|
|
221
221
|
| `timeoutMs` | positive integer, max `1_800_000` | Anthropic only | Server-side Claude Code process timeout in milliseconds. The SDK's non-stream HTTP budget is 60 seconds longer. Defaults to 240 seconds |
|
|
222
222
|
| `imageGeneration` | `boolean` | OpenAI only, non-stream | Enables codex's built-in `image_generation` tool (see [below](#image-generation)) |
|
|
223
|
-
| `imageGenerationOptions` | `{ quality?, size?, background? }` | OpenAI only | Image controls; `background: "transparent"` selects standalone Images. Read actual size/quality from response metadata ([below](#image-generation)). |
|
|
223
|
+
| `imageGenerationOptions` | `{ quality?, size?, background?, outputFormat? }` | OpenAI only | Image controls; `outputFormat` selects PNG/JPEG/WebP on Responses. `background: "transparent"` selects standalone Images (PNG only). Read actual size/quality from response metadata ([below](#image-generation)). |
|
|
224
224
|
| `fallbackModels` | `string[]` | reserved | Reserved for future qgrid server-side fallback routing. Not functional yet and unrelated to Claude Code's Fable refusal fallback |
|
|
225
225
|
|
|
226
226
|
```typescript
|
|
@@ -270,14 +270,16 @@ const result = await generateText({
|
|
|
270
270
|
providerOptions: {
|
|
271
271
|
qgrid: {
|
|
272
272
|
imageGeneration: true,
|
|
273
|
-
imageGenerationOptions: { quality: "medium", size: "1536x1024" },
|
|
273
|
+
imageGenerationOptions: { quality: "medium", size: "1536x1024", outputFormat: "webp" },
|
|
274
274
|
},
|
|
275
275
|
},
|
|
276
276
|
});
|
|
277
277
|
|
|
278
|
-
const image = result.files[0]; // mediaType: "image/
|
|
278
|
+
const image = result.files[0]; // mediaType: "image/webp", base64
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
+
Since 2.9.6, `imageGenerationOptions.outputFormat` accepts `"png" | "jpeg" | "webp"`; omission keeps PNG. qgrid preserves the returned image format in `mediaType` rather than converting the image. Save files with the matching extension. Transparent background requests only support PNG and reject JPEG/WebP before generation. `result.files[].mediaType` retains the AI SDK standard `string` type; no qgrid-specific wrapper or type assertion is needed.
|
|
282
|
+
|
|
281
283
|
Reference images can be passed through normal AI SDK multimodal message parts:
|
|
282
284
|
|
|
283
285
|
```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -66,11 +66,12 @@ type QgridOpenAIProviderOptions = QgridCommonProviderOptions & {
|
|
|
66
66
|
*/
|
|
67
67
|
imageGeneration?: boolean;
|
|
68
68
|
/**
|
|
69
|
-
* Image generation
|
|
70
|
-
*
|
|
71
|
-
* public calculator table.
|
|
69
|
+
* Image generation controls. The Responses backend selects the image model;
|
|
70
|
+
* quality/size cost estimates use the GPT Image 2 public calculator table.
|
|
72
71
|
*/
|
|
73
72
|
imageGenerationOptions?: {
|
|
73
|
+
/** Responses output format. Defaults to PNG; transparent output only supports PNG. */
|
|
74
|
+
outputFormat?: "png" | "jpeg" | "webp";
|
|
74
75
|
quality?: "low" | "medium" | "high";
|
|
75
76
|
size?: "1024x1024" | "1024x1536" | "1536x1024";
|
|
76
77
|
/** Transparent uses Codex standalone Images and validates PNG alpha. See README for limits. */
|
package/dist/index.js
CHANGED
|
@@ -1237,7 +1237,7 @@ function qgrid(modelId, config) {
|
|
|
1237
1237
|
});
|
|
1238
1238
|
else if (item.type === "image") content.push({
|
|
1239
1239
|
type: "file",
|
|
1240
|
-
mediaType: "image/png",
|
|
1240
|
+
mediaType: item.mediaType ?? "image/png",
|
|
1241
1241
|
data: item.data,
|
|
1242
1242
|
...item.generation ? { providerMetadata: { qgrid: { imageGeneration: item.generation } } } : {}
|
|
1243
1243
|
});
|