@cartanova/qgrid-ai-sdk 2.3.6 → 2.3.8
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/dist/index.d.ts +14 -0
- package/dist/index.js +13 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,20 @@ type QgridProviderOptions = {
|
|
|
29
29
|
serviceTier?: string;
|
|
30
30
|
/** @todo 향후 qgrid 서버 fallback routing에 사용할 후보 모델 목록. */
|
|
31
31
|
fallbackModels?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* codex 내장 image_generation tool 을 켠다. OpenAI/codex route + non-stream 전용.
|
|
34
|
+
* generateText 결과의 files 로 이미지를 받는다. streaming(streamText)에서는 거부된다.
|
|
35
|
+
*/
|
|
36
|
+
imageGeneration?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Image generation hint and cost-estimation basis. The image model is fixed
|
|
39
|
+
* to gpt-image-2; qgrid accepts supported quality/size pairs from OpenAI's
|
|
40
|
+
* public calculator table.
|
|
41
|
+
*/
|
|
42
|
+
imageGenerationOptions?: {
|
|
43
|
+
quality?: "low" | "medium" | "high";
|
|
44
|
+
size?: "1024x1024" | "1024x1536" | "1536x1024";
|
|
45
|
+
};
|
|
32
46
|
};
|
|
33
47
|
/**
|
|
34
48
|
* codex thread 좌표
|
package/dist/index.js
CHANGED
|
@@ -528,6 +528,8 @@ function qgrid(modelId, config) {
|
|
|
528
528
|
const verbosity = qgridOptions.verbosity;
|
|
529
529
|
const reasoningSummary = qgridOptions.reasoningSummary;
|
|
530
530
|
const serviceTier = qgridOptions.serviceTier;
|
|
531
|
+
const imageGeneration = qgridOptions.imageGeneration;
|
|
532
|
+
const imageGenerationOptions = qgridOptions.imageGenerationOptions;
|
|
531
533
|
const sessionKey = qgridOptions.sessionKey;
|
|
532
534
|
const reuseSessionKey = reusableSessionKey(modelId, sessionKey);
|
|
533
535
|
const rawSchema = options.responseFormat?.type === "json" ? options.responseFormat.schema : void 0;
|
|
@@ -572,7 +574,9 @@ function qgrid(modelId, config) {
|
|
|
572
574
|
...projectName ? { projectName } : {},
|
|
573
575
|
...logMode ? { logMode } : {},
|
|
574
576
|
...runContext ? { runContext } : {},
|
|
575
|
-
...toolResultsPayload ? { toolResults: toolResultsPayload } : {}
|
|
577
|
+
...toolResultsPayload ? { toolResults: toolResultsPayload } : {},
|
|
578
|
+
...imageGeneration ? { imageGeneration } : {},
|
|
579
|
+
...imageGenerationOptions ? { imageGenerationOptions } : {}
|
|
576
580
|
} }),
|
|
577
581
|
signal: options.abortSignal
|
|
578
582
|
}).then(async (res) => {
|
|
@@ -592,7 +596,12 @@ function qgrid(modelId, config) {
|
|
|
592
596
|
type: "text",
|
|
593
597
|
text: item.text
|
|
594
598
|
});
|
|
595
|
-
else content.push({
|
|
599
|
+
else if (item.type === "image") content.push({
|
|
600
|
+
type: "file",
|
|
601
|
+
mediaType: "image/png",
|
|
602
|
+
data: item.data
|
|
603
|
+
});
|
|
604
|
+
else if (item.type === "tool-call") content.push({
|
|
596
605
|
type: "tool-call",
|
|
597
606
|
toolCallId: item.toolCallId,
|
|
598
607
|
toolName: item.toolName,
|
|
@@ -606,6 +615,7 @@ function qgrid(modelId, config) {
|
|
|
606
615
|
type: "text",
|
|
607
616
|
text: data.text
|
|
608
617
|
});
|
|
618
|
+
if (imageGeneration && !content.some((c) => c.type === "file")) throw new Error("qgrid: imageGeneration was requested but the response contained no image — the server may be an older version that does not support image generation.");
|
|
609
619
|
if (data.runContext && finishReason.unified === "tool-calls") clientRun = {
|
|
610
620
|
runContext: data.runContext,
|
|
611
621
|
pendingToolCallIds: new Set(content.filter((c) => c.type === "tool-call").map((c) => c.toolCallId))
|
|
@@ -635,6 +645,7 @@ function qgrid(modelId, config) {
|
|
|
635
645
|
const verbosity = qgridOptions.verbosity;
|
|
636
646
|
const reasoningSummary = qgridOptions.reasoningSummary;
|
|
637
647
|
const serviceTier = qgridOptions.serviceTier;
|
|
648
|
+
if (qgridOptions.imageGeneration) throw new Error("qgrid: imageGeneration is not supported with streamText — use generateText instead.");
|
|
638
649
|
const sessionKey = qgridOptions.sessionKey;
|
|
639
650
|
const reuseSessionKey = reusableSessionKey(modelId, sessionKey);
|
|
640
651
|
const rawSchema = options.responseFormat?.type === "json" ? options.responseFormat.schema : void 0;
|