@cartanova/qgrid-ai-sdk 2.7.9 → 2.8.0
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.ko.md +13 -0
- package/README.md +13 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -201,6 +201,7 @@ const { text } = await generateText({
|
|
|
201
201
|
|
|
202
202
|
| 옵션 | 값 | 적용 범위 | 설명 |
|
|
203
203
|
|---|---|---|---|
|
|
204
|
+
| `tokenName` | provider prefix를 포함한 토큰 이름 | 공통 | `anthropic/yds`처럼 활성 토큰 하나를 엄격히 지정. prefix는 model provider와 같아야 하며 빈 값·누락·inactive·quota 초과 시 다른 토큰으로 fallback하지 않음 |
|
|
204
205
|
| `logger` | `boolean` | 공통 | qgrid request log 저장 여부. 기본값은 `true`. `false`로 설정해도 client tool 실행과 multi-step 연결은 계속 동작 |
|
|
205
206
|
| `sessionKey` | `string` | OpenAI 전용 | 전체 history 재전송 시 불투명 prompt-cache affinity를 파생하는 멀티턴 대화 식별자 ([아래](#멀티턴-prompt-cache-sessionkey) 참조) |
|
|
206
207
|
| `effort` | `"none"` \| `"minimal"` \| `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` | 공통 (지원 값은 모델별 상이, 예: `"max"`는 GPT-5.6+) | reasoning 모델의 추론 깊이. 기본값은 config의 `defaultEffort` (`"low"`) |
|
|
@@ -212,6 +213,18 @@ const { text } = await generateText({
|
|
|
212
213
|
| `imageGenerationOptions` | `{ quality?, size? }` | OpenAI 전용 | 이미지 품질/크기 힌트. `quality: "low" \| "medium" \| "high"`, `size: "1024x1024" \| "1024x1536" \| "1536x1024"` (기본: `medium` / `1536x1024`) |
|
|
213
214
|
| `fallbackModels` | `string[]` | 예약 | 향후 qgrid 서버 fallback routing용 예약 필드. 현재 동작하지 않으며 Claude Code의 Fable refusal fallback과 무관 |
|
|
214
215
|
|
|
216
|
+
```typescript
|
|
217
|
+
await generateText({
|
|
218
|
+
model: qgrid("anthropic/claude-fable-5"),
|
|
219
|
+
prompt,
|
|
220
|
+
providerOptions: {
|
|
221
|
+
qgrid: { tokenName: "anthropic/yds" } satisfies QgridProviderOptions,
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`tokenName`은 `streamText`에서도 같은 방식으로 동작합니다.
|
|
227
|
+
|
|
215
228
|
AI SDK 최상위 `timeout`은 전체 클라이언트 제한시간이며 custom provider 실행 전에
|
|
216
229
|
`AbortSignal`로 변환됩니다. 따라서 그 숫자 자체는 qgrid에 전달되지 않습니다. qgrid 서버의
|
|
217
230
|
Claude Code 프로세스 제한시간을 바꾸려면 `providerOptions.qgrid.timeoutMs`를 사용하세요.
|
package/README.md
CHANGED
|
@@ -210,6 +210,7 @@ const { text } = await generateText({
|
|
|
210
210
|
|
|
211
211
|
| Option | Values | Applies to | Description |
|
|
212
212
|
|---|---|---|---|
|
|
213
|
+
| `tokenName` | provider-prefixed token name | both providers | Strictly targets one active token, such as `anthropic/yds`. The prefix must match the model provider; empty, missing, inactive, or over-threshold targets fail without fallback |
|
|
213
214
|
| `logger` | `boolean` | both providers | qgrid request logging. Defaults to `true`; `false` disables request-log persistence for this generation without disabling client tools or multi-step continuation |
|
|
214
215
|
| `sessionKey` | `string` | OpenAI only | Multi-turn conversation identifier used to derive opaque prompt-cache affinity while replaying full history (see [below](#multi-turn-prompt-cache-sessionkey)) |
|
|
215
216
|
| `effort` | `"none"` \| `"minimal"` \| `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` | both providers (supported values are model-dependent, e.g. `"max"` is GPT-5.6+) | Reasoning depth. Defaults to the config's `defaultEffort` (`"low"`) |
|
|
@@ -221,6 +222,18 @@ const { text } = await generateText({
|
|
|
221
222
|
| `imageGenerationOptions` | `{ quality?, size? }` | OpenAI only | Image quality/size hints. `quality: "low" \| "medium" \| "high"`, `size: "1024x1024" \| "1024x1536" \| "1536x1024"` (defaults: `medium` / `1536x1024`) |
|
|
222
223
|
| `fallbackModels` | `string[]` | reserved | Reserved for future qgrid server-side fallback routing. Not functional yet and unrelated to Claude Code's Fable refusal fallback |
|
|
223
224
|
|
|
225
|
+
```typescript
|
|
226
|
+
await generateText({
|
|
227
|
+
model: qgrid("anthropic/claude-fable-5"),
|
|
228
|
+
prompt,
|
|
229
|
+
providerOptions: {
|
|
230
|
+
qgrid: { tokenName: "anthropic/yds" } satisfies QgridProviderOptions,
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`tokenName` works the same way with `streamText`.
|
|
236
|
+
|
|
224
237
|
AI SDK's top-level `timeout` remains the overall client-side budget and is converted to an
|
|
225
238
|
`AbortSignal` before the custom provider runs. It does not expose the numeric timeout to qgrid.
|
|
226
239
|
Use `providerOptions.qgrid.timeoutMs` when the qgrid server's Claude Code process needs a different
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ type QgridProviderConfig = {
|
|
|
12
12
|
* providerOptions.qgrid 로 전달한다.
|
|
13
13
|
*/
|
|
14
14
|
type QgridProviderOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* 이 요청을 처리할 활성 qgrid 토큰 이름. provider prefix를 포함해야 하며 다른 토큰으로 fallback하지 않는다.
|
|
17
|
+
*/
|
|
18
|
+
tokenName?: string;
|
|
15
19
|
/**
|
|
16
20
|
* qgrid request log 저장 여부. 기본값은 true.
|
|
17
21
|
* false여도 client tool 실행과 multi-step 연결은 계속 동작한다.
|
package/dist/index.js
CHANGED
|
@@ -1075,7 +1075,9 @@ function qgridProviderMetadata(data) {
|
|
|
1075
1075
|
} };
|
|
1076
1076
|
}
|
|
1077
1077
|
function getQgridProviderOptions(options) {
|
|
1078
|
-
|
|
1078
|
+
const qgridOptions = options.providerOptions?.qgrid ?? {};
|
|
1079
|
+
if (qgridOptions.tokenName !== void 0 && qgridOptions.tokenName.trim() === "") throw new Error("qgrid: tokenName must not be empty");
|
|
1080
|
+
return qgridOptions;
|
|
1079
1081
|
}
|
|
1080
1082
|
function toAiSdkUsage(usage) {
|
|
1081
1083
|
const cacheRead = usage.cache_read_input_tokens;
|
|
@@ -1150,6 +1152,7 @@ function qgrid(modelId, config) {
|
|
|
1150
1152
|
const serviceTier = qgridOptions.serviceTier;
|
|
1151
1153
|
const timeoutMs = qgridOptions.timeoutMs;
|
|
1152
1154
|
const logger = qgridOptions.logger;
|
|
1155
|
+
const tokenName = qgridOptions.tokenName;
|
|
1153
1156
|
const imageGenerationOptions = qgridOptions.imageGenerationOptions;
|
|
1154
1157
|
if (imageGeneration) assertImageInputFitsJsonTransport(imageUrls);
|
|
1155
1158
|
const sessionKey = qgridOptions.sessionKey;
|
|
@@ -1184,6 +1187,7 @@ function qgrid(modelId, config) {
|
|
|
1184
1187
|
...projectName ? { projectName } : {},
|
|
1185
1188
|
...cacheAffinityKey ? { cacheAffinityKey } : {},
|
|
1186
1189
|
...logger === false ? { logger: false } : {},
|
|
1190
|
+
...tokenName ? { tokenName } : {},
|
|
1187
1191
|
...runContext ? { runContext } : {},
|
|
1188
1192
|
...toolResultsPayload ? { toolResults: toolResultsPayload } : {},
|
|
1189
1193
|
...imageGeneration ? { imageGeneration } : {},
|
|
@@ -1254,6 +1258,7 @@ function qgrid(modelId, config) {
|
|
|
1254
1258
|
const serviceTier = qgridOptions.serviceTier;
|
|
1255
1259
|
const timeoutMs = qgridOptions.timeoutMs;
|
|
1256
1260
|
const logger = qgridOptions.logger;
|
|
1261
|
+
const tokenName = qgridOptions.tokenName;
|
|
1257
1262
|
if (qgridOptions.imageGeneration) throw new Error("qgrid: imageGeneration is not supported with streamText — use generateText instead.");
|
|
1258
1263
|
const { prompt, system, history, droppedImageCount } = extractPromptAndHistory(options.prompt, { includeImages: false });
|
|
1259
1264
|
warnDroppedImages(droppedImageCount);
|
|
@@ -1287,6 +1292,7 @@ function qgrid(modelId, config) {
|
|
|
1287
1292
|
...projectName ? { projectName } : {},
|
|
1288
1293
|
...cacheAffinityKey ? { cacheAffinityKey } : {},
|
|
1289
1294
|
...logger === false ? { logger: false } : {},
|
|
1295
|
+
...tokenName ? { tokenName } : {},
|
|
1290
1296
|
...runContext ? { runContext } : {},
|
|
1291
1297
|
...toolResultsPayload ? { toolResults: toolResultsPayload } : {}
|
|
1292
1298
|
} }),
|