@adaptic/lumic-utils 1.0.27 → 1.0.29
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/{apollo-client.client-eo-xgmdi.js → apollo-client.client-BQLzKbg9.js} +4 -4
- package/dist/{apollo-client.client-eo-xgmdi.js.map → apollo-client.client-BQLzKbg9.js.map} +1 -1
- package/dist/{apollo-client.client-DD13VF_T.js → apollo-client.client-C1dwHT2X.js} +3 -3
- package/dist/{apollo-client.client-DD13VF_T.js.map → apollo-client.client-C1dwHT2X.js.map} +1 -1
- package/dist/{apollo-client.server-BxpJcsVI.js → apollo-client.server-Crk0lXFR.js} +3 -3
- package/dist/{apollo-client.server-BxpJcsVI.js.map → apollo-client.server-Crk0lXFR.js.map} +1 -1
- package/dist/{apollo-client.server-2zi9dbLa.js → apollo-client.server-DoI6FK_-.js} +3 -3
- package/dist/{apollo-client.server-2zi9dbLa.js.map → apollo-client.server-DoI6FK_-.js.map} +1 -1
- package/dist/{index-BbwdRyPk.js → index-CV8HlDp8.js} +719 -42
- package/dist/{index-zDK1X6HR.js.map → index-CV8HlDp8.js.map} +1 -1
- package/dist/{index-zDK1X6HR.js → index-CtY-7qjs.js} +720 -41
- package/dist/{index-BbwdRyPk.js.map → index-CtY-7qjs.js.map} +1 -1
- package/dist/{index-BQ1buNZm.js → index-DA066GXe.js} +2 -2
- package/dist/{index-BQ1buNZm.js.map → index-DA066GXe.js.map} +1 -1
- package/dist/{index-CV0UmY0w.js → index-IAFN9E4Q.js} +2 -2
- package/dist/{index-CV0UmY0w.js.map → index-IAFN9E4Q.js.map} +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test.cjs +1 -1
- package/dist/test.mjs +1 -1
- package/dist/types/config/secrets.d.ts +10 -0
- package/dist/types/functions/__tests__/gpt56-model-release-layer.test.d.ts +1 -0
- package/dist/types/functions/__tests__/llm-openai-responses-routing.test.d.ts +1 -0
- package/dist/types/functions/llm-config.d.ts +8 -6
- package/dist/types/functions/llm-openai.d.ts +125 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/schemas/openai-schemas.d.ts +30 -30
- package/dist/types/schemas/perplexity-schemas.d.ts +40 -40
- package/dist/types/types/openai-types.d.ts +42 -5
- package/dist/types/utils/config.d.ts +12 -1
- package/dist/types/utils/llm-cost-tracker.d.ts +2 -2
- package/package.json +1 -1
|
@@ -80,9 +80,14 @@ const OPENAI_COMPATIBLE_PROVIDERS = {
|
|
|
80
80
|
*/
|
|
81
81
|
const SUPPORTED_MODELS = {
|
|
82
82
|
// ── OpenAI GPT-5.6 series (current flagship) ─────────────────────────
|
|
83
|
-
// sol / terra / luna are the 2026 flagship trio
|
|
84
|
-
// api/docs/models/all).
|
|
85
|
-
//
|
|
83
|
+
// sol / terra / luna are the 2026 flagship reasoning trio
|
|
84
|
+
// (developers.openai.com/api/docs/models/all). They are REASONING models
|
|
85
|
+
// (isReasoningModel: true) and — like all reasoning models — do not accept a
|
|
86
|
+
// custom temperature. Critically, OpenAI rejects function tools for them on
|
|
87
|
+
// Chat Completions ("Function tools with reasoning_effort are not supported
|
|
88
|
+
// for gpt-5.6-sol in /v1/chat/completions"), so `requiresResponsesApiForTools`
|
|
89
|
+
// routes tool-bearing calls to the Responses API. Both flags are corrected
|
|
90
|
+
// here from their initial (registration-time) `false` values.
|
|
86
91
|
'gpt-5.6-sol': {
|
|
87
92
|
provider: 'openai',
|
|
88
93
|
supportsTools: true,
|
|
@@ -90,7 +95,8 @@ const SUPPORTED_MODELS = {
|
|
|
90
95
|
supportsStructuredOutput: true,
|
|
91
96
|
supportsDeveloperPrompt: true,
|
|
92
97
|
supportsTemperature: false,
|
|
93
|
-
isReasoningModel:
|
|
98
|
+
isReasoningModel: true,
|
|
99
|
+
requiresResponsesApiForTools: true,
|
|
94
100
|
},
|
|
95
101
|
'gpt-5.6-terra': {
|
|
96
102
|
provider: 'openai',
|
|
@@ -99,7 +105,8 @@ const SUPPORTED_MODELS = {
|
|
|
99
105
|
supportsStructuredOutput: true,
|
|
100
106
|
supportsDeveloperPrompt: true,
|
|
101
107
|
supportsTemperature: false,
|
|
102
|
-
isReasoningModel:
|
|
108
|
+
isReasoningModel: true,
|
|
109
|
+
requiresResponsesApiForTools: true,
|
|
103
110
|
},
|
|
104
111
|
'gpt-5.6-luna': {
|
|
105
112
|
provider: 'openai',
|
|
@@ -108,7 +115,8 @@ const SUPPORTED_MODELS = {
|
|
|
108
115
|
supportsStructuredOutput: true,
|
|
109
116
|
supportsDeveloperPrompt: true,
|
|
110
117
|
supportsTemperature: false,
|
|
111
|
-
isReasoningModel:
|
|
118
|
+
isReasoningModel: true,
|
|
119
|
+
requiresResponsesApiForTools: true,
|
|
112
120
|
},
|
|
113
121
|
// ── OpenAI GPT-5.5 series ────────────────────────────────────────────
|
|
114
122
|
// GPT-5.x series: OpenAI's 2026 API constraint — only the default
|
|
@@ -591,16 +599,33 @@ function getModelProvider(model) {
|
|
|
591
599
|
return SUPPORTED_MODELS[model].provider;
|
|
592
600
|
}
|
|
593
601
|
/**
|
|
594
|
-
* Default model tiers per provider for use with
|
|
602
|
+
* Default model tiers per provider for use with the
|
|
603
|
+
* LLM_MODEL_MINI/NORMAL/ADVANCED/CRITICAL env vars.
|
|
604
|
+
*
|
|
605
|
+
* Four tiers, increasing in capability/cost: `mini` (high-volume, cheap) →
|
|
606
|
+
* `normal` (default) → `advanced` → `critical` (most-capable). The tier a caller
|
|
607
|
+
* lands on is resolved in `../utils/config` (see `LLM_MODEL_*`).
|
|
595
608
|
*/
|
|
596
609
|
const PROVIDER_DEFAULT_MODELS = {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
610
|
+
// OpenAI now leads with the GPT-5.6 reasoning trio. The historical blocker
|
|
611
|
+
// (gpt-5.6-* returning 400 on Chat-Completions + tools) is resolved by the
|
|
612
|
+
// Responses-API routing (`requiresResponsesApiForTools` +
|
|
613
|
+
// `makeOpenAIChatCompletionCall`), so the intended canary is live:
|
|
614
|
+
// normal → gpt-5.6-luna (cheapest of the trio)
|
|
615
|
+
// advanced → gpt-5.6-terra (flips off the temporary gpt-5.5 pin)
|
|
616
|
+
// critical → gpt-5.6-sol (most capable; in/out priced like gpt-5.5)
|
|
617
|
+
// `mini` stays on gpt-5.4-nano — the high-volume summarizer tier where the
|
|
618
|
+
// trio's reasoning cost is not warranted.
|
|
619
|
+
openai: { mini: 'gpt-5.4-nano', normal: 'gpt-5.6-luna', advanced: 'gpt-5.6-terra', critical: 'gpt-5.6-sol' },
|
|
620
|
+
// Non-OpenAI providers: `critical` mirrors `advanced` (each provider's
|
|
621
|
+
// most-capable model), so the new tier is a no-op for them until a distinct
|
|
622
|
+
// critical-tier model is chosen.
|
|
623
|
+
anthropic: { mini: 'claude-haiku-4-5', normal: 'claude-sonnet-4-6', advanced: 'claude-opus-4-7', critical: 'claude-opus-4-7' },
|
|
624
|
+
deepseek: { mini: 'deepseek-v4-flash', normal: 'deepseek-v4-flash', advanced: 'deepseek-v4-pro', critical: 'deepseek-v4-pro' },
|
|
625
|
+
kimi: { mini: 'kimi-k2-0905-preview', normal: 'kimi-k2.5', advanced: 'kimi-k2.6', critical: 'kimi-k2.6' },
|
|
626
|
+
qwen: { mini: 'qwen3.5-flash', normal: 'qwen3.5-plus', advanced: 'qwen3-max', critical: 'qwen3-max' },
|
|
627
|
+
xai: { mini: 'grok-4.1-fast', normal: 'grok-4-fast-non-reasoning', advanced: 'grok-4.3', critical: 'grok-4.3' },
|
|
628
|
+
gemini: { mini: 'gemini-3.1-flash-lite-preview', normal: 'gemini-3-flash-preview', advanced: 'gemini-3.1-pro-preview', critical: 'gemini-3.1-pro-preview' },
|
|
604
629
|
};
|
|
605
630
|
|
|
606
631
|
// Default implementation using console (backward compatible)
|
|
@@ -675,9 +700,11 @@ const lumicSecretsSchema = z.object({
|
|
|
675
700
|
llmMiniProvider: z.string().optional(),
|
|
676
701
|
llmNormalProvider: z.string().optional(),
|
|
677
702
|
llmAdvancedProvider: z.string().optional(),
|
|
703
|
+
llmCriticalProvider: z.string().optional(),
|
|
678
704
|
llmModelMini: z.string().optional(),
|
|
679
705
|
llmModelNormal: z.string().optional(),
|
|
680
706
|
llmModelAdvanced: z.string().optional(),
|
|
707
|
+
llmModelCritical: z.string().optional(),
|
|
681
708
|
lumicDebug: z.boolean().default(false),
|
|
682
709
|
allowedUploadPaths: z.string().default('/tmp'),
|
|
683
710
|
}),
|
|
@@ -740,9 +767,11 @@ function loadSecrets() {
|
|
|
740
767
|
llmMiniProvider: process.env.LLM_MINI_PROVIDER,
|
|
741
768
|
llmNormalProvider: process.env.LLM_NORMAL_PROVIDER,
|
|
742
769
|
llmAdvancedProvider: process.env.LLM_ADVANCED_PROVIDER,
|
|
770
|
+
llmCriticalProvider: process.env.LLM_CRITICAL_PROVIDER,
|
|
743
771
|
llmModelMini: process.env.LLM_MODEL_MINI,
|
|
744
772
|
llmModelNormal: process.env.LLM_MODEL_NORMAL,
|
|
745
773
|
llmModelAdvanced: process.env.LLM_MODEL_ADVANCED,
|
|
774
|
+
llmModelCritical: process.env.LLM_MODEL_CRITICAL,
|
|
746
775
|
lumicDebug: process.env.LUMIC_DEBUG === 'true' ||
|
|
747
776
|
process.env.lumic_debug === 'true',
|
|
748
777
|
allowedUploadPaths: process.env.LUMIC_ALLOWED_UPLOAD_PATHS || '/tmp',
|
|
@@ -842,6 +871,7 @@ const LLM_DEFAULT_PROVIDER = parseProvider(getSecrets().config.llmDefaultProvide
|
|
|
842
871
|
const LLM_MINI_PROVIDER = parseProvider(getSecrets().config.llmMiniProvider) || LLM_DEFAULT_PROVIDER;
|
|
843
872
|
const LLM_NORMAL_PROVIDER = parseProvider(getSecrets().config.llmNormalProvider) || LLM_DEFAULT_PROVIDER;
|
|
844
873
|
const LLM_ADVANCED_PROVIDER = parseProvider(getSecrets().config.llmAdvancedProvider) || LLM_DEFAULT_PROVIDER;
|
|
874
|
+
const LLM_CRITICAL_PROVIDER = parseProvider(getSecrets().config.llmCriticalProvider) || LLM_DEFAULT_PROVIDER;
|
|
845
875
|
// Keep backward compat — LLM_PROVIDER is the default provider
|
|
846
876
|
const LLM_PROVIDER = LLM_DEFAULT_PROVIDER;
|
|
847
877
|
/**
|
|
@@ -861,13 +891,14 @@ const DEFAULT_MODEL = (() => {
|
|
|
861
891
|
* Model tier values resolved from env vars.
|
|
862
892
|
*
|
|
863
893
|
* Resolution order per tier:
|
|
864
|
-
* 1. LLM_MODEL_MINI / LLM_MODEL_NORMAL / LLM_MODEL_ADVANCED (explicit model override)
|
|
894
|
+
* 1. LLM_MODEL_MINI / LLM_MODEL_NORMAL / LLM_MODEL_ADVANCED / LLM_MODEL_CRITICAL (explicit model override)
|
|
865
895
|
* 2. PROVIDER_DEFAULT_MODELS[tier-specific provider][tier] (provider default for tier)
|
|
866
896
|
*
|
|
867
897
|
* The tier-specific provider is:
|
|
868
898
|
* LLM_MINI_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
869
899
|
* LLM_NORMAL_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
870
900
|
* LLM_ADVANCED_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
901
|
+
* LLM_CRITICAL_PROVIDER → falls back to LLM_DEFAULT_PROVIDER
|
|
871
902
|
*/
|
|
872
903
|
const LLM_MODEL_MINI = (() => {
|
|
873
904
|
const env = getSecrets().config.llmModelMini;
|
|
@@ -896,6 +927,21 @@ const LLM_MODEL_ADVANCED = (() => {
|
|
|
896
927
|
}
|
|
897
928
|
return PROVIDER_DEFAULT_MODELS[LLM_ADVANCED_PROVIDER].advanced;
|
|
898
929
|
})();
|
|
930
|
+
/**
|
|
931
|
+
* The most-capable ("critical") model tier — reserved for the highest-stakes
|
|
932
|
+
* calls. Resolves from LLM_MODEL_CRITICAL, else the critical-tier default of the
|
|
933
|
+
* resolved LLM_CRITICAL_PROVIDER (see PROVIDER_DEFAULT_MODELS). For OpenAI this
|
|
934
|
+
* is gpt-5.6-sol; for other providers it mirrors their advanced tier.
|
|
935
|
+
*/
|
|
936
|
+
const LLM_MODEL_CRITICAL = (() => {
|
|
937
|
+
const env = getSecrets().config.llmModelCritical;
|
|
938
|
+
if (env) {
|
|
939
|
+
const resolved = resolveModelName(env);
|
|
940
|
+
if (resolved)
|
|
941
|
+
return resolved;
|
|
942
|
+
}
|
|
943
|
+
return PROVIDER_DEFAULT_MODELS[LLM_CRITICAL_PROVIDER].critical;
|
|
944
|
+
})();
|
|
899
945
|
const PERPLEXITY_MODEL = getSecrets().config.perplexityModel || DEFAULT_PERPLEXITY_MODEL;
|
|
900
946
|
const PERPLEXITY_API_URL = 'https://api.perplexity.ai/chat/completions';
|
|
901
947
|
|
|
@@ -908,15 +954,40 @@ const DEFAULT_DEVELOPER_PROMPT = `
|
|
|
908
954
|
Respond only with final content (e.g. code, a json or yaml object, a formatted string, or a markdown document) and nothing else. Do not reply with a preamble, introduction, or conclusion.
|
|
909
955
|
`;
|
|
910
956
|
/**
|
|
911
|
-
* Token costs in USD per token. Last updated
|
|
957
|
+
* Token costs in USD per token. Last updated July 2026.
|
|
912
958
|
*
|
|
913
|
-
* `cacheHitCost` reflects
|
|
914
|
-
* standard input rate per OpenAI's prompt
|
|
915
|
-
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
959
|
+
* `cacheHitCost` reflects each model's cached-input billing rate. For most
|
|
960
|
+
* models this is ~50% of the standard input rate (per OpenAI's prompt-caching
|
|
961
|
+
* documentation); the GPT-5.6 reasoning trio discounts cached input more
|
|
962
|
+
* aggressively, to 10% of the input rate. When set, `calculateCost` splits
|
|
963
|
+
* prompt tokens into cached vs non-cached buckets and applies the discount; when
|
|
964
|
+
* omitted, cached tokens are billed at the full input rate (a silent cost
|
|
965
|
+
* overstatement for cache-friendly workloads).
|
|
918
966
|
*/
|
|
919
967
|
const openAiModelCosts = {
|
|
968
|
+
// GPT-5.6 reasoning trio (sol/terra/luna). Tiered per-1M-token pricing,
|
|
969
|
+
// verified against OpenAI's published price sheet on 2026-07-13:
|
|
970
|
+
// sol — $5.00 in / $0.50 cached / $30.00 out (in/out identical to gpt-5.5)
|
|
971
|
+
// terra — $2.50 in / $0.25 cached / $15.00 out
|
|
972
|
+
// luna — $1.00 in / $0.10 cached / $6.00 out
|
|
973
|
+
// Cached input is 10% of the input rate across the trio. Reasoning tokens are
|
|
974
|
+
// a SUBSET of output tokens and are billed at the output rate inside
|
|
975
|
+
// `calculateCost`, so callers must not add them on top of the output count.
|
|
976
|
+
'gpt-5.6-sol': {
|
|
977
|
+
inputCost: 5 / 1_000_000,
|
|
978
|
+
cacheHitCost: 0.5 / 1_000_000,
|
|
979
|
+
outputCost: 30 / 1_000_000,
|
|
980
|
+
},
|
|
981
|
+
'gpt-5.6-terra': {
|
|
982
|
+
inputCost: 2.5 / 1_000_000,
|
|
983
|
+
cacheHitCost: 0.25 / 1_000_000,
|
|
984
|
+
outputCost: 15 / 1_000_000,
|
|
985
|
+
},
|
|
986
|
+
'gpt-5.6-luna': {
|
|
987
|
+
inputCost: 1 / 1_000_000,
|
|
988
|
+
cacheHitCost: 0.1 / 1_000_000,
|
|
989
|
+
outputCost: 6 / 1_000_000,
|
|
990
|
+
},
|
|
920
991
|
'gpt-5.5': {
|
|
921
992
|
inputCost: 5 / 1_000_000,
|
|
922
993
|
cacheHitCost: 2.5 / 1_000_000,
|
|
@@ -2248,12 +2319,18 @@ class LLMCostTracker {
|
|
|
2248
2319
|
* @param provider - The LLM provider ('openai' or 'deepseek')
|
|
2249
2320
|
* @param model - The model name (e.g., 'gpt-5', 'deepseek-chat')
|
|
2250
2321
|
* @param inputTokens - Number of input/prompt tokens
|
|
2251
|
-
* @param outputTokens -
|
|
2252
|
-
* @param reasoningTokens -
|
|
2322
|
+
* @param outputTokens - Total output/completion tokens, INCLUDING reasoning tokens
|
|
2323
|
+
* @param reasoningTokens - Reasoning tokens, a subset of outputTokens (default: 0). Billed at the output rate, not on top of it.
|
|
2253
2324
|
* @param cacheHitTokens - Number of cache hit tokens (default: 0)
|
|
2254
2325
|
*/
|
|
2255
2326
|
trackUsage(provider, model, inputTokens, outputTokens, reasoningTokens = 0, cacheHitTokens = 0) {
|
|
2256
|
-
|
|
2327
|
+
// Reasoning tokens are a SUBSET of output tokens for every provider tracked
|
|
2328
|
+
// here (they are counted within completion/output tokens and billed at the
|
|
2329
|
+
// output rate). calculateCost bills output AND reasoning separately, so cost
|
|
2330
|
+
// the non-reasoning remainder to avoid billing reasoning twice; the stored
|
|
2331
|
+
// record keeps the full outputTokens/reasoningTokens for reporting. For
|
|
2332
|
+
// non-reasoning calls reasoningTokens is 0, so this is a no-op.
|
|
2333
|
+
const cost = calculateCost(provider, model, inputTokens, outputTokens - reasoningTokens, reasoningTokens, cacheHitTokens);
|
|
2257
2334
|
const record = {
|
|
2258
2335
|
provider,
|
|
2259
2336
|
model,
|
|
@@ -2570,6 +2647,112 @@ function isReasoningModel(model) {
|
|
|
2570
2647
|
}
|
|
2571
2648
|
return getModelCapabilities(model).isReasoningModel;
|
|
2572
2649
|
}
|
|
2650
|
+
/**
|
|
2651
|
+
* Checks whether a model must use the OpenAI Responses API (`/v1/responses`)
|
|
2652
|
+
* for function-tool calls rather than Chat Completions (`/v1/chat/completions`).
|
|
2653
|
+
*
|
|
2654
|
+
* Driven entirely by the {@link ModelCapabilities.requiresResponsesApiForTools}
|
|
2655
|
+
* flag in the model registry — there are no hardcoded model-name checks here.
|
|
2656
|
+
* Unknown models and models without the flag return `false` (stay on Chat
|
|
2657
|
+
* Completions).
|
|
2658
|
+
*
|
|
2659
|
+
* @param model The model to check.
|
|
2660
|
+
* @returns True when tool-bearing calls for this model must be routed to the
|
|
2661
|
+
* Responses API, false otherwise.
|
|
2662
|
+
*/
|
|
2663
|
+
function requiresResponsesApiForTools(model) {
|
|
2664
|
+
if (!isValidModel(model)) {
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
return getModelCapabilities(model).requiresResponsesApiForTools ?? false;
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2670
|
+
* OpenAI's `reasoning_effort` ladder, ordered from least to most effort. This is
|
|
2671
|
+
* the full 2026 ladder (developers.openai.com); NOTE there is no `'max'` level.
|
|
2672
|
+
* Mirrors the widened {@link LLMOptions.reasoning_effort} union.
|
|
2673
|
+
*/
|
|
2674
|
+
const REASONING_EFFORT_LADDER = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh'];
|
|
2675
|
+
/**
|
|
2676
|
+
* Per-model `reasoning_effort` support window for OpenAI reasoning models,
|
|
2677
|
+
* expressed on {@link REASONING_EFFORT_LADDER}. `min`/`max` are the lowest and
|
|
2678
|
+
* highest effort each model's API accepts; a request below `min` clamps up and
|
|
2679
|
+
* above `max` clamps down, so an over/under-shoot degrades gracefully instead of
|
|
2680
|
+
* returning HTTP 400.
|
|
2681
|
+
*
|
|
2682
|
+
* Reasoning models ABSENT from this table omit `reasoning_effort` entirely —
|
|
2683
|
+
* notably `o1-mini`, which does not accept the parameter at all. The windows
|
|
2684
|
+
* record TRUE API support; the wire value is additionally narrowed to
|
|
2685
|
+
* {@link SdkReasoningEffort} in {@link toSdkReasoningEffort}, so when the SDK
|
|
2686
|
+
* widens only that mapping (not these windows) needs revisiting.
|
|
2687
|
+
*/
|
|
2688
|
+
const MODEL_REASONING_EFFORT_SUPPORT = {
|
|
2689
|
+
// GPT-5.6 reasoning trio — full ladder (developers.openai.com/api/docs/models).
|
|
2690
|
+
'gpt-5.6-sol': { min: 'minimal', max: 'xhigh' },
|
|
2691
|
+
'gpt-5.6-terra': { min: 'minimal', max: 'xhigh' },
|
|
2692
|
+
'gpt-5.6-luna': { min: 'minimal', max: 'xhigh' },
|
|
2693
|
+
// o-series reasoning models accept low|medium|high (no none/minimal/xhigh).
|
|
2694
|
+
o1: { min: 'low', max: 'high' },
|
|
2695
|
+
o3: { min: 'low', max: 'high' },
|
|
2696
|
+
'o3-mini': { min: 'low', max: 'high' },
|
|
2697
|
+
'o4-mini': { min: 'low', max: 'high' },
|
|
2698
|
+
// o1-mini is intentionally omitted — it rejects reasoning_effort outright.
|
|
2699
|
+
};
|
|
2700
|
+
/**
|
|
2701
|
+
* Folds a full-ladder effort level onto the nearest value the installed OpenAI
|
|
2702
|
+
* SDK can send ({@link SdkReasoningEffort}). Levels below `low` map to `low`,
|
|
2703
|
+
* levels above `high` map to `high`. Exhaustive over the ladder so the compiler
|
|
2704
|
+
* flags any future ladder addition. Widen this mapping when the SDK's
|
|
2705
|
+
* `ReasoningEffort` type gains `none`/`minimal`/`xhigh`.
|
|
2706
|
+
*
|
|
2707
|
+
* @param level A level on {@link REASONING_EFFORT_LADDER}.
|
|
2708
|
+
* @returns The nearest SDK-sendable effort.
|
|
2709
|
+
*/
|
|
2710
|
+
function toSdkReasoningEffort(level) {
|
|
2711
|
+
switch (level) {
|
|
2712
|
+
case 'none':
|
|
2713
|
+
case 'minimal':
|
|
2714
|
+
case 'low':
|
|
2715
|
+
return 'low';
|
|
2716
|
+
case 'medium':
|
|
2717
|
+
return 'medium';
|
|
2718
|
+
case 'high':
|
|
2719
|
+
case 'xhigh':
|
|
2720
|
+
return 'high';
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
/**
|
|
2724
|
+
* Clamps a requested {@link LLMOptions.reasoning_effort} to a value the target
|
|
2725
|
+
* model — and the installed OpenAI SDK — will accept, degrading gracefully so an
|
|
2726
|
+
* unsupported (too-high or too-low) level never returns HTTP 400.
|
|
2727
|
+
*
|
|
2728
|
+
* Resolution:
|
|
2729
|
+
* 1. Models without an entry in {@link MODEL_REASONING_EFFORT_SUPPORT}
|
|
2730
|
+
* (non-reasoning models, or reasoning models like `o1-mini` that reject the
|
|
2731
|
+
* parameter) ⇒ `undefined`, i.e. omit `reasoning_effort` from the request.
|
|
2732
|
+
* 2. Clamp the requested level into the model's `[min, max]` window.
|
|
2733
|
+
* 3. Fold onto the SDK-sendable range via {@link toSdkReasoningEffort}.
|
|
2734
|
+
*
|
|
2735
|
+
* Shared by BOTH OpenAI transports so the Chat and Responses paths clamp
|
|
2736
|
+
* identically.
|
|
2737
|
+
*
|
|
2738
|
+
* @param requested The caller's requested effort (full ladder).
|
|
2739
|
+
* @param model The normalized model name the request targets.
|
|
2740
|
+
* @returns An SDK-safe effort, or `undefined` when the field must be omitted.
|
|
2741
|
+
*/
|
|
2742
|
+
function clampReasoningEffort(requested, model) {
|
|
2743
|
+
const support = MODEL_REASONING_EFFORT_SUPPORT[model];
|
|
2744
|
+
if (!support) {
|
|
2745
|
+
return undefined;
|
|
2746
|
+
}
|
|
2747
|
+
const requestedIdx = REASONING_EFFORT_LADDER.indexOf(requested);
|
|
2748
|
+
if (requestedIdx < 0) {
|
|
2749
|
+
return undefined;
|
|
2750
|
+
}
|
|
2751
|
+
const minIdx = REASONING_EFFORT_LADDER.indexOf(support.min);
|
|
2752
|
+
const maxIdx = REASONING_EFFORT_LADDER.indexOf(support.max);
|
|
2753
|
+
const clampedIdx = Math.min(Math.max(requestedIdx, minIdx), maxIdx);
|
|
2754
|
+
return toSdkReasoningEffort(REASONING_EFFORT_LADDER[clampedIdx]);
|
|
2755
|
+
}
|
|
2573
2756
|
/**
|
|
2574
2757
|
* Normalizes the response format option based on model compatibility.
|
|
2575
2758
|
* @param responseFormat The desired response format.
|
|
@@ -2701,6 +2884,18 @@ async function createCompletion(content, responseFormat, options = DEFAULT_OPTIO
|
|
|
2701
2884
|
if (options.max_completion_tokens !== undefined) {
|
|
2702
2885
|
queryOptions.max_completion_tokens = options.max_completion_tokens;
|
|
2703
2886
|
}
|
|
2887
|
+
// Forward reasoning_effort on the Chat path for reasoning models. Chat
|
|
2888
|
+
// Completions accepts reasoning_effort for reasoning models (only tools +
|
|
2889
|
+
// effort together 400 on GPT-5.6, and those tool-bearing calls are already
|
|
2890
|
+
// routed to the Responses API), so this is safe. The value is clamped per
|
|
2891
|
+
// model so an unsupported level degrades gracefully instead of 400-ing;
|
|
2892
|
+
// clampReasoningEffort returns undefined for models that reject the parameter.
|
|
2893
|
+
if (options.reasoning_effort !== undefined && isReasoningModel(normalizedModel)) {
|
|
2894
|
+
const effort = clampReasoningEffort(options.reasoning_effort, normalizedModel);
|
|
2895
|
+
if (effort !== undefined) {
|
|
2896
|
+
queryOptions.reasoning_effort = effort;
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2704
2899
|
// Only set response_format when it's not the default 'text' type
|
|
2705
2900
|
// (sending response_format: {type: 'text'} is redundant and may cause issues)
|
|
2706
2901
|
const responseFormatOption = getResponseFormatOption(responseFormat, normalizedModel);
|
|
@@ -2776,6 +2971,9 @@ async function createCompletion(content, responseFormat, options = DEFAULT_OPTIO
|
|
|
2776
2971
|
completion_tokens: completion.usage?.completion_tokens ?? 0,
|
|
2777
2972
|
total_tokens: completion.usage?.total_tokens ?? 0,
|
|
2778
2973
|
cached_tokens: cachedTokens,
|
|
2974
|
+
// Non-reasoning Chat-Completions models report no reasoning tokens; read
|
|
2975
|
+
// defensively so the field is always present and correct.
|
|
2976
|
+
reasoning_tokens: completion.usage?.completion_tokens_details?.reasoning_tokens ?? 0,
|
|
2779
2977
|
},
|
|
2780
2978
|
system_fingerprint: completion.system_fingerprint,
|
|
2781
2979
|
service_tier: options.service_tier,
|
|
@@ -2784,9 +2982,383 @@ async function createCompletion(content, responseFormat, options = DEFAULT_OPTIO
|
|
|
2784
2982
|
};
|
|
2785
2983
|
return response;
|
|
2786
2984
|
}
|
|
2985
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2986
|
+
// Transparent Chat-Completions → Responses API routing (GPT-5.6 reasoning trio)
|
|
2987
|
+
//
|
|
2988
|
+
// OpenAI's GPT-5.6 reasoning models (sol/terra/luna) return HTTP 400 for
|
|
2989
|
+
// function tools on `/v1/chat/completions`
|
|
2990
|
+
// ("Function tools with reasoning_effort are not supported for gpt-5.6-sol in
|
|
2991
|
+
// /v1/chat/completions"); they require the Responses API (`/v1/responses`).
|
|
2992
|
+
// The helpers below convert a Chat-Completions-style request into a Responses
|
|
2993
|
+
// request and normalize the Responses result back into the SAME internal
|
|
2994
|
+
// {@link CompletionResponse}, so callers of {@link makeOpenAIChatCompletionCall}
|
|
2995
|
+
// receive a byte-identical {@link LLMResponse} envelope regardless of which
|
|
2996
|
+
// endpoint served the call. The routing decision is data-driven via
|
|
2997
|
+
// {@link requiresResponsesApiForTools}.
|
|
2998
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2999
|
+
/**
|
|
3000
|
+
* Coerces a Chat-Completions message `content` value (string, content-part
|
|
3001
|
+
* array, or null) into a plain string. Mirrors the text-extraction rule used
|
|
3002
|
+
* elsewhere in this module: array parts contribute their `text` field, all
|
|
3003
|
+
* other shapes contribute nothing.
|
|
3004
|
+
*
|
|
3005
|
+
* @param content The message content in any of its Chat-Completions shapes.
|
|
3006
|
+
* @returns The concatenated text, or an empty string when there is none.
|
|
3007
|
+
*/
|
|
3008
|
+
function coerceMessageText(content) {
|
|
3009
|
+
if (typeof content === 'string') {
|
|
3010
|
+
return content;
|
|
3011
|
+
}
|
|
3012
|
+
if (Array.isArray(content)) {
|
|
3013
|
+
return content
|
|
3014
|
+
.map((part) => typeof part === 'object' && part !== null && 'text' in part &&
|
|
3015
|
+
typeof part.text === 'string'
|
|
3016
|
+
? part.text
|
|
3017
|
+
: '')
|
|
3018
|
+
.join('');
|
|
3019
|
+
}
|
|
3020
|
+
return '';
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* Converts Chat-Completions user content (string or multi-modal content parts)
|
|
3024
|
+
* into the Responses API content shape. String content passes through
|
|
3025
|
+
* unchanged; content-part arrays map `text` → `input_text` and `image_url` →
|
|
3026
|
+
* `input_image`. Unsupported part kinds (audio/file) are skipped rather than
|
|
3027
|
+
* emitted in an incompatible shape — no tool-calling caller uses them today.
|
|
3028
|
+
*
|
|
3029
|
+
* @param content The Chat-Completions user content.
|
|
3030
|
+
* @returns A string or an array of Responses input-content parts.
|
|
3031
|
+
*/
|
|
3032
|
+
function chatContentToResponsesContent(content) {
|
|
3033
|
+
if (typeof content === 'string') {
|
|
3034
|
+
return content;
|
|
3035
|
+
}
|
|
3036
|
+
const parts = [];
|
|
3037
|
+
for (const part of content) {
|
|
3038
|
+
if (part.type === 'text') {
|
|
3039
|
+
parts.push({ type: 'input_text', text: part.text });
|
|
3040
|
+
}
|
|
3041
|
+
else if (part.type === 'image_url') {
|
|
3042
|
+
parts.push({
|
|
3043
|
+
type: 'input_image',
|
|
3044
|
+
image_url: part.image_url.url,
|
|
3045
|
+
detail: part.image_url.detail ?? 'auto',
|
|
3046
|
+
});
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
return parts;
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* Converts a single Chat-Completions message into zero or more Responses API
|
|
3053
|
+
* input items. Assistant tool calls become `function_call` items and `tool`
|
|
3054
|
+
* results become `function_call_output` items — both keyed by the SAME id the
|
|
3055
|
+
* chat envelope exposed as `tool_call.id` / `tool_call_id`, so a multi-turn
|
|
3056
|
+
* tool conversation round-trips correctly through the Responses transport.
|
|
3057
|
+
*
|
|
3058
|
+
* @param message The Chat-Completions message to convert.
|
|
3059
|
+
* @returns The equivalent Responses input items (may be empty).
|
|
3060
|
+
*/
|
|
3061
|
+
function chatMessageToResponsesInput(message) {
|
|
3062
|
+
switch (message.role) {
|
|
3063
|
+
case 'system':
|
|
3064
|
+
return [{ role: 'system', content: coerceMessageText(message.content) }];
|
|
3065
|
+
case 'developer':
|
|
3066
|
+
return [{ role: 'developer', content: coerceMessageText(message.content) }];
|
|
3067
|
+
case 'user':
|
|
3068
|
+
return [{ role: 'user', content: chatContentToResponsesContent(message.content) }];
|
|
3069
|
+
case 'assistant': {
|
|
3070
|
+
const items = [];
|
|
3071
|
+
const text = coerceMessageText(message.content);
|
|
3072
|
+
if (text.length > 0) {
|
|
3073
|
+
items.push({ role: 'assistant', content: text });
|
|
3074
|
+
}
|
|
3075
|
+
if (message.tool_calls) {
|
|
3076
|
+
for (const toolCall of message.tool_calls) {
|
|
3077
|
+
if (toolCall.type === 'function') {
|
|
3078
|
+
items.push({
|
|
3079
|
+
type: 'function_call',
|
|
3080
|
+
call_id: toolCall.id,
|
|
3081
|
+
name: toolCall.function.name,
|
|
3082
|
+
arguments: toolCall.function.arguments,
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
return items;
|
|
3088
|
+
}
|
|
3089
|
+
case 'tool':
|
|
3090
|
+
return [{
|
|
3091
|
+
type: 'function_call_output',
|
|
3092
|
+
call_id: message.tool_call_id,
|
|
3093
|
+
output: coerceMessageText(message.content),
|
|
3094
|
+
}];
|
|
3095
|
+
default:
|
|
3096
|
+
// Deprecated `function`-role messages carry no call_id to correlate; keep
|
|
3097
|
+
// the text so history stays coherent. No current caller emits these.
|
|
3098
|
+
return [{ role: 'assistant', content: coerceMessageText(message.content) }];
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
/**
|
|
3102
|
+
* Converts a Chat-Completions function tool (`{ type:'function', function:{…} }`)
|
|
3103
|
+
* into a Responses API function tool (`{ type:'function', name, parameters,
|
|
3104
|
+
* strict, description }`). `strict` defaults to `false` to preserve Chat
|
|
3105
|
+
* Completions' effective default (non-strict) — the Responses API otherwise
|
|
3106
|
+
* defaults function tools to strict, which would silently change model
|
|
3107
|
+
* behaviour and could reject payloads the Chat path accepted.
|
|
3108
|
+
*
|
|
3109
|
+
* @param tool The Chat-Completions function tool.
|
|
3110
|
+
* @returns The equivalent Responses API function tool.
|
|
3111
|
+
*/
|
|
3112
|
+
function chatToolToResponsesFunctionTool(tool) {
|
|
3113
|
+
return {
|
|
3114
|
+
type: 'function',
|
|
3115
|
+
name: tool.function.name,
|
|
3116
|
+
description: tool.function.description,
|
|
3117
|
+
parameters: tool.function.parameters ?? {},
|
|
3118
|
+
strict: tool.function.strict ?? false,
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* Maps an {@link OpenAIResponseFormat} onto the Responses API `text.format`
|
|
3123
|
+
* config, applying the same model-capability gates as the Chat path
|
|
3124
|
+
* ({@link getResponseFormatOption}): `'text'` yields `undefined` (omit
|
|
3125
|
+
* `text.format`), `'json'` yields `json_object` only when the model supports
|
|
3126
|
+
* JSON mode, and a `json_schema` request yields the flat Responses
|
|
3127
|
+
* `json_schema` format (name/schema at the top level, unlike Chat's nested
|
|
3128
|
+
* `json_schema` wrapper).
|
|
3129
|
+
*
|
|
3130
|
+
* @param responseFormat The requested response format.
|
|
3131
|
+
* @param normalizedModel The normalized model name.
|
|
3132
|
+
* @returns The `text.format` config, or `undefined` when none should be sent.
|
|
3133
|
+
* @throws Error when a `json_schema` format is requested for an incompatible model.
|
|
3134
|
+
*/
|
|
3135
|
+
function getResponsesTextFormat(responseFormat, normalizedModel) {
|
|
3136
|
+
if (responseFormat === 'text') {
|
|
3137
|
+
return undefined;
|
|
3138
|
+
}
|
|
3139
|
+
if (responseFormat === 'json') {
|
|
3140
|
+
return supportsJsonMode(normalizedModel) ? { type: 'json_object' } : undefined;
|
|
3141
|
+
}
|
|
3142
|
+
if (typeof responseFormat === 'object' && responseFormat.type === 'json_schema') {
|
|
3143
|
+
if (!isStructuredOutputCompatibleModel(normalizedModel)) {
|
|
3144
|
+
throw new Error(`${normalizedModel} is not compatible with structured outputs / json object.`);
|
|
3145
|
+
}
|
|
3146
|
+
return {
|
|
3147
|
+
type: 'json_schema',
|
|
3148
|
+
name: 'Response',
|
|
3149
|
+
schema: {
|
|
3150
|
+
type: 'object',
|
|
3151
|
+
properties: responseFormat.schema.properties,
|
|
3152
|
+
required: responseFormat.schema.required || [],
|
|
3153
|
+
},
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3156
|
+
throw new Error(`Invalid response format: ${String(responseFormat)}`);
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* Builds an OpenAI Responses API request body from the exact same arguments a
|
|
3160
|
+
* caller passes to {@link makeOpenAIChatCompletionCall}. This is the request
|
|
3161
|
+
* half of the transparent routing layer.
|
|
3162
|
+
*
|
|
3163
|
+
* The mapping deliberately mirrors {@link createCompletion}'s Chat request
|
|
3164
|
+
* one-for-one so request semantics are preserved across transports:
|
|
3165
|
+
* - `developerPrompt` (+ context messages + user `content`) → `input` items
|
|
3166
|
+
* (chat `tool_calls`/`tool` messages become `function_call`/
|
|
3167
|
+
* `function_call_output` items).
|
|
3168
|
+
* - chat `tools` → Responses `tools` (function tools only).
|
|
3169
|
+
* - `temperature` → `temperature`, gated by {@link supportsTemperature} exactly
|
|
3170
|
+
* as the Chat path (dropped for GPT-5.6/o-series reasoning models).
|
|
3171
|
+
* - `max_completion_tokens` → `max_output_tokens`.
|
|
3172
|
+
* - {@link OpenAIResponseFormat} → `text.format`.
|
|
3173
|
+
* - `reasoning_effort` → `reasoning.effort`, clamped per-model via
|
|
3174
|
+
* {@link clampReasoningEffort} and gated on {@link isReasoningModel} exactly as
|
|
3175
|
+
* the Chat path, so the two transports clamp identically. Only set when the
|
|
3176
|
+
* caller explicitly supplies it — parity is preserved for callers (like the
|
|
3177
|
+
* engine decision path) that do not.
|
|
3178
|
+
*
|
|
3179
|
+
* Parameters the Chat path does not forward (`top_p`, `parallel_tool_calls`,
|
|
3180
|
+
* `tool_choice`, `metadata`, `store`) are intentionally omitted here too, so the
|
|
3181
|
+
* request semantics stay identical to today's production Chat behaviour.
|
|
3182
|
+
*
|
|
3183
|
+
* @param content The user content (string or multi-modal content parts).
|
|
3184
|
+
* @param responseFormat The desired response format.
|
|
3185
|
+
* @param options The Chat-Completions-style options bag.
|
|
3186
|
+
* @param normalizedModel The normalized model name to target.
|
|
3187
|
+
* @returns A ready-to-send non-streaming Responses API request body.
|
|
3188
|
+
* @throws Error when a `json_schema` format is requested for an incompatible model.
|
|
3189
|
+
*/
|
|
3190
|
+
function buildResponsesRequestFromChatOptions(content, responseFormat, options, normalizedModel) {
|
|
3191
|
+
const input = [];
|
|
3192
|
+
if (options.developerPrompt && supportsDeveloperPrompt(normalizedModel)) {
|
|
3193
|
+
input.push({ role: 'developer', content: options.developerPrompt });
|
|
3194
|
+
}
|
|
3195
|
+
if (options.context) {
|
|
3196
|
+
for (const message of options.context) {
|
|
3197
|
+
input.push(...chatMessageToResponsesInput(message));
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
input.push({ role: 'user', content: chatContentToResponsesContent(content) });
|
|
3201
|
+
const requestBody = {
|
|
3202
|
+
model: normalizedModel,
|
|
3203
|
+
input,
|
|
3204
|
+
};
|
|
3205
|
+
if (options.tools && options.tools.length > 0) {
|
|
3206
|
+
const functionTools = options.tools
|
|
3207
|
+
.filter((tool) => tool.type === 'function')
|
|
3208
|
+
.map(chatToolToResponsesFunctionTool);
|
|
3209
|
+
if (functionTools.length > 0) {
|
|
3210
|
+
requestBody.tools = functionTools;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
if (options.temperature !== undefined && supportsTemperature(normalizedModel)) {
|
|
3214
|
+
requestBody.temperature = options.temperature;
|
|
3215
|
+
}
|
|
3216
|
+
if (options.max_completion_tokens !== undefined) {
|
|
3217
|
+
requestBody.max_output_tokens = options.max_completion_tokens;
|
|
3218
|
+
}
|
|
3219
|
+
const textFormat = getResponsesTextFormat(responseFormat, normalizedModel);
|
|
3220
|
+
if (textFormat) {
|
|
3221
|
+
requestBody.text = { format: textFormat };
|
|
3222
|
+
}
|
|
3223
|
+
if (options.reasoning_effort !== undefined && isReasoningModel(normalizedModel)) {
|
|
3224
|
+
const effort = clampReasoningEffort(options.reasoning_effort, normalizedModel);
|
|
3225
|
+
if (effort !== undefined) {
|
|
3226
|
+
requestBody.reasoning = { effort };
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
return requestBody;
|
|
3230
|
+
}
|
|
3231
|
+
/**
|
|
3232
|
+
* Normalizes an OpenAI Responses API result into the internal
|
|
3233
|
+
* {@link CompletionResponse} shape. This is the response half of the
|
|
3234
|
+
* transparent routing layer and is the single most correctness-critical mapping
|
|
3235
|
+
* in this module: the returned `tool_calls` MUST be byte-identical to what the
|
|
3236
|
+
* Chat path produces so downstream consumers (notably the engine decision path,
|
|
3237
|
+
* which reads `tool_call.function.arguments` as a JSON string) parse it
|
|
3238
|
+
* unchanged.
|
|
3239
|
+
*
|
|
3240
|
+
* Mapping:
|
|
3241
|
+
* - `function_call` output items → `{ id: call_id, type:'function',
|
|
3242
|
+
* function:{ name, arguments } }` with `arguments` kept as the raw JSON
|
|
3243
|
+
* string (never pre-parsed) — exactly the Chat `ChatCompletionMessageToolCall`
|
|
3244
|
+
* shape. `id` is sourced from `call_id` (not the item `id`) so it round-trips
|
|
3245
|
+
* as the `tool_call_id` in a multi-turn conversation.
|
|
3246
|
+
* - `message` output items → concatenated `output_text` parts (refusals and
|
|
3247
|
+
* non-text parts contribute nothing, matching the Chat path's null-content →
|
|
3248
|
+
* empty-string behaviour).
|
|
3249
|
+
* - usage: `input_tokens`→prompt, `output_tokens`→completion,
|
|
3250
|
+
* `input_tokens_details.cached_tokens`→cached,
|
|
3251
|
+
* `output_tokens_details.reasoning_tokens`→reasoning.
|
|
3252
|
+
*
|
|
3253
|
+
* `system_fingerprint` is `undefined` — the Responses API does not return one
|
|
3254
|
+
* (the Chat path forwards it; consumers already treat it as optional).
|
|
3255
|
+
*
|
|
3256
|
+
* @param response The raw OpenAI Responses API result.
|
|
3257
|
+
* @param normalizedModel The normalized model name the request targeted.
|
|
3258
|
+
* @param serviceTier The caller's requested service tier, echoed through as on
|
|
3259
|
+
* the Chat path.
|
|
3260
|
+
* @returns A {@link CompletionResponse} structurally identical to the Chat path's.
|
|
3261
|
+
*/
|
|
3262
|
+
function normalizeResponsesToCompletion(response, normalizedModel, serviceTier) {
|
|
3263
|
+
const toolCalls = response.output
|
|
3264
|
+
?.filter((item) => item.type === 'function_call')
|
|
3265
|
+
.map((toolCall) => ({
|
|
3266
|
+
id: toolCall.call_id,
|
|
3267
|
+
type: 'function',
|
|
3268
|
+
function: {
|
|
3269
|
+
name: toolCall.name,
|
|
3270
|
+
arguments: toolCall.arguments,
|
|
3271
|
+
},
|
|
3272
|
+
}));
|
|
3273
|
+
const content = response.output
|
|
3274
|
+
?.filter((item) => item.type === 'message')
|
|
3275
|
+
.map((item) => item.content
|
|
3276
|
+
.filter((part) => part.type === 'output_text')
|
|
3277
|
+
.map((part) => part.text)
|
|
3278
|
+
.join(''))
|
|
3279
|
+
.join('') || '';
|
|
3280
|
+
return {
|
|
3281
|
+
id: response.id,
|
|
3282
|
+
content,
|
|
3283
|
+
tool_calls: toolCalls && toolCalls.length > 0 ? toolCalls : undefined,
|
|
3284
|
+
usage: {
|
|
3285
|
+
prompt_tokens: response.usage?.input_tokens ?? 0,
|
|
3286
|
+
completion_tokens: response.usage?.output_tokens ?? 0,
|
|
3287
|
+
total_tokens: response.usage?.total_tokens ?? 0,
|
|
3288
|
+
cached_tokens: response.usage?.input_tokens_details?.cached_tokens ?? 0,
|
|
3289
|
+
reasoning_tokens: response.usage?.output_tokens_details?.reasoning_tokens ?? 0,
|
|
3290
|
+
},
|
|
3291
|
+
system_fingerprint: undefined,
|
|
3292
|
+
service_tier: serviceTier,
|
|
3293
|
+
provider: 'openai',
|
|
3294
|
+
model: normalizedModel,
|
|
3295
|
+
};
|
|
3296
|
+
}
|
|
3297
|
+
/**
|
|
3298
|
+
* Executes an OpenAI Responses API call for a Chat-Completions-style request and
|
|
3299
|
+
* returns the internal {@link CompletionResponse}. Mirrors {@link createCompletion}'s
|
|
3300
|
+
* transport concerns exactly — API-key resolution, timeout, `AbortSignal`
|
|
3301
|
+
* plumbing, the shared retry policy, and metadata-only failure logging — so the
|
|
3302
|
+
* two producers differ ONLY in the endpoint they hit.
|
|
3303
|
+
*
|
|
3304
|
+
* @param content The user content (string or multi-modal content parts).
|
|
3305
|
+
* @param responseFormat The desired response format.
|
|
3306
|
+
* @param options The Chat-Completions-style options bag.
|
|
3307
|
+
* @returns The normalized completion, identical in shape to the Chat path.
|
|
3308
|
+
* @throws Error when the API key is missing or the API call ultimately fails.
|
|
3309
|
+
*/
|
|
3310
|
+
async function createResponsesCompletion(content, responseFormat, options = DEFAULT_OPTIONS$1) {
|
|
3311
|
+
const normalizedModel = normalizeModelName(options.model || DEFAULT_MODEL);
|
|
3312
|
+
const apiKey = options.apiKey || getSecrets().openai.apiKey;
|
|
3313
|
+
if (!apiKey) {
|
|
3314
|
+
throw new Error('OpenAI API key is not provided and OPENAI_API_KEY environment variable is not set');
|
|
3315
|
+
}
|
|
3316
|
+
const openai = new OpenAI({
|
|
3317
|
+
apiKey: apiKey,
|
|
3318
|
+
timeout: options.timeout ?? LLM_TIMEOUT_MS,
|
|
3319
|
+
});
|
|
3320
|
+
const requestBody = buildResponsesRequestFromChatOptions(content, responseFormat, options, normalizedModel);
|
|
3321
|
+
let response;
|
|
3322
|
+
try {
|
|
3323
|
+
response = await withRetry(
|
|
3324
|
+
// Same AbortSignal plumbing as the Chat path — a fired signal tears down
|
|
3325
|
+
// the in-flight Responses request and releases its body buffer.
|
|
3326
|
+
() => openai.responses.create(requestBody, options.signal ? { signal: options.signal } : undefined), {
|
|
3327
|
+
maxRetries: 3,
|
|
3328
|
+
baseDelayMs: 2000,
|
|
3329
|
+
maxDelayMs: 30000,
|
|
3330
|
+
retryableErrors: isRetryableLLMError,
|
|
3331
|
+
signal: options.signal,
|
|
3332
|
+
}, `OpenAI-Responses:${normalizedModel}`);
|
|
3333
|
+
}
|
|
3334
|
+
catch (error) {
|
|
3335
|
+
// Metadata-only failure snapshot (no message content, no API key), matching
|
|
3336
|
+
// the Chat path's defensive observability.
|
|
3337
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3338
|
+
getLumicLogger().error(`OpenAI Responses call failed for model ${normalizedModel}`, {
|
|
3339
|
+
model: normalizedModel,
|
|
3340
|
+
errorMessage,
|
|
3341
|
+
inputItemCount: Array.isArray(requestBody.input) ? requestBody.input.length : 1,
|
|
3342
|
+
toolCount: requestBody.tools?.length ?? 0,
|
|
3343
|
+
hasTemperature: requestBody.temperature !== undefined && requestBody.temperature !== null,
|
|
3344
|
+
hasTextFormat: requestBody.text?.format !== undefined,
|
|
3345
|
+
hasMaxOutputTokens: requestBody.max_output_tokens !== undefined && requestBody.max_output_tokens !== null,
|
|
3346
|
+
hasReasoningEffort: requestBody.reasoning?.effort !== undefined && requestBody.reasoning?.effort !== null,
|
|
3347
|
+
});
|
|
3348
|
+
throw error;
|
|
3349
|
+
}
|
|
3350
|
+
return normalizeResponsesToCompletion(response, normalizedModel, options.service_tier);
|
|
3351
|
+
}
|
|
2787
3352
|
/**
|
|
2788
3353
|
* Makes a call to the Lumic LLM interface, either to the default model or to one specified.
|
|
2789
3354
|
*
|
|
3355
|
+
* Transport is chosen transparently: models flagged
|
|
3356
|
+
* {@link ModelCapabilities.requiresResponsesApiForTools} (the GPT-5.6 reasoning
|
|
3357
|
+
* trio) that are called WITH function tools are routed to the OpenAI Responses
|
|
3358
|
+
* API; every other call stays on Chat Completions. The returned
|
|
3359
|
+
* {@link LLMResponse} envelope — `response`, `tool_calls`, and `usage` — is
|
|
3360
|
+
* byte-identical across both transports, so callers require no changes.
|
|
3361
|
+
*
|
|
2790
3362
|
* @param content The content to pass to the LLM.
|
|
2791
3363
|
* @param responseFormat The format of the response. Defaults to 'text'.
|
|
2792
3364
|
* @param options The options for the LLM call. Defaults to an empty object.
|
|
@@ -2797,11 +3369,28 @@ const makeOpenAIChatCompletionCall = async (content, responseFormat = 'text', op
|
|
|
2797
3369
|
...DEFAULT_OPTIONS$1,
|
|
2798
3370
|
...options,
|
|
2799
3371
|
};
|
|
2800
|
-
|
|
3372
|
+
// Transparent transport routing. GPT-5.6 reasoning models 400 on
|
|
3373
|
+
// Chat-Completions + function tools, so route tool-bearing calls for such
|
|
3374
|
+
// models to the Responses API. `createResponsesCompletion` returns the SAME
|
|
3375
|
+
// CompletionResponse shape, so all cost-tracking and envelope construction
|
|
3376
|
+
// below is shared and the caller-facing result is identical.
|
|
3377
|
+
const normalizedModel = normalizeModelName(mergedOptions.model || DEFAULT_MODEL);
|
|
3378
|
+
const hasTools = !!(mergedOptions.tools && mergedOptions.tools.length > 0);
|
|
3379
|
+
const completion = requiresResponsesApiForTools(normalizedModel) && hasTools
|
|
3380
|
+
? await createResponsesCompletion(content, responseFormat, mergedOptions)
|
|
3381
|
+
: await createCompletion(content, responseFormat, mergedOptions);
|
|
2801
3382
|
// Track cost in the global cost tracker. Pass cached tokens through so the
|
|
2802
3383
|
// tracker applies the discounted cached-input rate (typically ~50% of the
|
|
2803
3384
|
// standard input rate) instead of billing every input token at full price.
|
|
2804
|
-
|
|
3385
|
+
// reasoning_tokens is 0 on the Chat path and the real count on the Responses
|
|
3386
|
+
// path, so reasoning-heavy models are billed accurately.
|
|
3387
|
+
getLLMCostTracker().trackUsage('openai', completion.model, completion.usage.prompt_tokens, completion.usage.completion_tokens, completion.usage.reasoning_tokens, completion.usage.cached_tokens);
|
|
3388
|
+
// Reasoning tokens are a SUBSET of completion (output) tokens. `calculateCost`
|
|
3389
|
+
// bills output AND reasoning at the output rate, so passing the full
|
|
3390
|
+
// completion_tokens alongside reasoning_tokens would bill reasoning twice.
|
|
3391
|
+
// Cost the non-reasoning remainder here and let calculateCost add reasoning
|
|
3392
|
+
// back once; the reported usage below keeps the full completion_tokens.
|
|
3393
|
+
const nonReasoningOutputTokens = completion.usage.completion_tokens - completion.usage.reasoning_tokens;
|
|
2805
3394
|
// Handle tool calls differently
|
|
2806
3395
|
if (completion.tool_calls && completion.tool_calls.length > 0) {
|
|
2807
3396
|
const toolCallResponse = {
|
|
@@ -2816,11 +3405,11 @@ const makeOpenAIChatCompletionCall = async (content, responseFormat = 'text', op
|
|
|
2816
3405
|
usage: {
|
|
2817
3406
|
prompt_tokens: completion.usage.prompt_tokens,
|
|
2818
3407
|
completion_tokens: completion.usage.completion_tokens,
|
|
2819
|
-
reasoning_tokens:
|
|
3408
|
+
reasoning_tokens: completion.usage.reasoning_tokens,
|
|
2820
3409
|
provider: 'openai',
|
|
2821
3410
|
model: completion.model,
|
|
2822
3411
|
cached_tokens: completion.usage.cached_tokens,
|
|
2823
|
-
cost: calculateCost('openai', completion.model, completion.usage.prompt_tokens, completion.usage.
|
|
3412
|
+
cost: calculateCost('openai', completion.model, completion.usage.prompt_tokens, nonReasoningOutputTokens, completion.usage.reasoning_tokens, completion.usage.cached_tokens),
|
|
2824
3413
|
},
|
|
2825
3414
|
tool_calls: completion.tool_calls,
|
|
2826
3415
|
};
|
|
@@ -2835,11 +3424,11 @@ const makeOpenAIChatCompletionCall = async (content, responseFormat = 'text', op
|
|
|
2835
3424
|
usage: {
|
|
2836
3425
|
prompt_tokens: completion.usage.prompt_tokens,
|
|
2837
3426
|
completion_tokens: completion.usage.completion_tokens,
|
|
2838
|
-
reasoning_tokens:
|
|
3427
|
+
reasoning_tokens: completion.usage.reasoning_tokens,
|
|
2839
3428
|
provider: 'openai',
|
|
2840
3429
|
model: completion.model,
|
|
2841
3430
|
cached_tokens: completion.usage.cached_tokens,
|
|
2842
|
-
cost: calculateCost('openai', completion.model, completion.usage.prompt_tokens, completion.usage.
|
|
3431
|
+
cost: calculateCost('openai', completion.model, completion.usage.prompt_tokens, nonReasoningOutputTokens, completion.usage.reasoning_tokens, completion.usage.cached_tokens),
|
|
2843
3432
|
},
|
|
2844
3433
|
tool_calls: completion.tool_calls,
|
|
2845
3434
|
};
|
|
@@ -2898,8 +3487,14 @@ const makeResponsesAPICall = async (input, options = {}) => {
|
|
|
2898
3487
|
// Responses API exposes cached input tokens under `input_tokens_details.cached_tokens`
|
|
2899
3488
|
// (the equivalent of Chat Completions' `prompt_tokens_details.cached_tokens`).
|
|
2900
3489
|
const responsesCachedTokens = response.usage?.input_tokens_details?.cached_tokens || 0;
|
|
3490
|
+
const responsesOutputTokens = response.usage?.output_tokens || 0;
|
|
3491
|
+
const responsesReasoningTokens = response.usage?.output_tokens_details?.reasoning_tokens || 0;
|
|
3492
|
+
// Reasoning tokens are a SUBSET of output tokens; cost the non-reasoning
|
|
3493
|
+
// remainder so calculateCost does not bill reasoning twice (same rationale as
|
|
3494
|
+
// makeOpenAIChatCompletionCall). Reported usage keeps the full output/reasoning counts.
|
|
3495
|
+
const responsesNonReasoningOutputTokens = responsesOutputTokens - responsesReasoningTokens;
|
|
2901
3496
|
// Track cost in the global cost tracker
|
|
2902
|
-
getLLMCostTracker().trackUsage('openai', normalizedModel, response.usage?.input_tokens || 0,
|
|
3497
|
+
getLLMCostTracker().trackUsage('openai', normalizedModel, response.usage?.input_tokens || 0, responsesOutputTokens, responsesReasoningTokens, responsesCachedTokens);
|
|
2903
3498
|
// Extract tool calls from the output
|
|
2904
3499
|
const toolCalls = response.output
|
|
2905
3500
|
?.filter((item) => item.type === 'function_call')
|
|
@@ -2936,12 +3531,12 @@ const makeResponsesAPICall = async (input, options = {}) => {
|
|
|
2936
3531
|
response: toolCallResponse,
|
|
2937
3532
|
usage: {
|
|
2938
3533
|
prompt_tokens: response.usage?.input_tokens || 0,
|
|
2939
|
-
completion_tokens:
|
|
2940
|
-
reasoning_tokens:
|
|
3534
|
+
completion_tokens: responsesOutputTokens,
|
|
3535
|
+
reasoning_tokens: responsesReasoningTokens,
|
|
2941
3536
|
provider: 'openai',
|
|
2942
3537
|
model: normalizedModel,
|
|
2943
3538
|
cached_tokens: responsesCachedTokens,
|
|
2944
|
-
cost: calculateCost('openai', normalizedModel, response.usage?.input_tokens || 0,
|
|
3539
|
+
cost: calculateCost('openai', normalizedModel, response.usage?.input_tokens || 0, responsesNonReasoningOutputTokens, responsesReasoningTokens, responsesCachedTokens),
|
|
2945
3540
|
},
|
|
2946
3541
|
tool_calls: toolCalls,
|
|
2947
3542
|
...(codeInterpreterOutputs ? { code_interpreter_outputs: codeInterpreterOutputs } : {}),
|
|
@@ -2969,12 +3564,12 @@ const makeResponsesAPICall = async (input, options = {}) => {
|
|
|
2969
3564
|
response: parsedResponse,
|
|
2970
3565
|
usage: {
|
|
2971
3566
|
prompt_tokens: response.usage?.input_tokens || 0,
|
|
2972
|
-
completion_tokens:
|
|
2973
|
-
reasoning_tokens:
|
|
3567
|
+
completion_tokens: responsesOutputTokens,
|
|
3568
|
+
reasoning_tokens: responsesReasoningTokens,
|
|
2974
3569
|
provider: 'openai',
|
|
2975
3570
|
model: normalizedModel,
|
|
2976
3571
|
cached_tokens: responsesCachedTokens,
|
|
2977
|
-
cost: calculateCost('openai', normalizedModel, response.usage?.input_tokens || 0,
|
|
3572
|
+
cost: calculateCost('openai', normalizedModel, response.usage?.input_tokens || 0, responsesNonReasoningOutputTokens, responsesReasoningTokens, responsesCachedTokens),
|
|
2978
3573
|
},
|
|
2979
3574
|
tool_calls: toolCalls,
|
|
2980
3575
|
...(codeInterpreterOutputs ? { code_interpreter_outputs: codeInterpreterOutputs } : {}),
|
|
@@ -23203,11 +23798,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
|
|
|
23203
23798
|
async function loadApolloModules() {
|
|
23204
23799
|
if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
|
|
23205
23800
|
// Server-side (or Lambda): load the CommonJS‑based implementation.
|
|
23206
|
-
return (await import('./apollo-client.server-
|
|
23801
|
+
return (await import('./apollo-client.server-Crk0lXFR.js'));
|
|
23207
23802
|
}
|
|
23208
23803
|
else {
|
|
23209
23804
|
// Client-side: load the ESM‑based implementation.
|
|
23210
|
-
return (await import('./apollo-client.client-
|
|
23805
|
+
return (await import('./apollo-client.client-BQLzKbg9.js'));
|
|
23211
23806
|
}
|
|
23212
23807
|
}
|
|
23213
23808
|
/**
|
|
@@ -80458,11 +81053,93 @@ const tools = [
|
|
|
80458
81053
|
}
|
|
80459
81054
|
}
|
|
80460
81055
|
},
|
|
81056
|
+
{
|
|
81057
|
+
"type": "function",
|
|
81058
|
+
"function": {
|
|
81059
|
+
"name": "requiresResponsesApiForTools",
|
|
81060
|
+
"description": "Checks whether a model must use the OpenAI Responses API (`/v1/responses`) for function-tool calls rather than Chat Completions (`/v1/chat/completions`). Driven entirely by the {@link ModelCapabilities.requiresResponsesApiForTools} flag in the model registry — there are no hardcoded model-name checks here. Unknown models and models without the flag return `false` (stay on Chat Completions).",
|
|
81061
|
+
"parameters": {
|
|
81062
|
+
"type": "object",
|
|
81063
|
+
"properties": {
|
|
81064
|
+
"model": {
|
|
81065
|
+
"type": "string",
|
|
81066
|
+
"description": "The model to check."
|
|
81067
|
+
}
|
|
81068
|
+
},
|
|
81069
|
+
"required": [
|
|
81070
|
+
"model"
|
|
81071
|
+
]
|
|
81072
|
+
}
|
|
81073
|
+
}
|
|
81074
|
+
},
|
|
81075
|
+
{
|
|
81076
|
+
"type": "function",
|
|
81077
|
+
"function": {
|
|
81078
|
+
"name": "buildResponsesRequestFromChatOptions",
|
|
81079
|
+
"description": "Builds an OpenAI Responses API request body from the exact same arguments a caller passes to {@link makeOpenAIChatCompletionCall}. This is the request half of the transparent routing layer. The mapping deliberately mirrors {@link createCompletion}'s Chat request one-for-one so request semantics are preserved across transports: - `developerPrompt` (+ context messages + user `content`) → `input` items (chat `tool_calls`/`tool` messages become `function_call`/ `function_call_output` items). - chat `tools` → Responses `tools` (function tools only). - `temperature` → `temperature`, gated by {@link supportsTemperature} exactly as the Chat path (dropped for GPT-5.6/o-series reasoning models). - `max_completion_tokens` → `max_output_tokens`. - {@link OpenAIResponseFormat} → `text.format`. - `reasoning_effort` → `reasoning.effort`, clamped per-model via {@link clampReasoningEffort} and gated on {@link isReasoningModel} exactly as the Chat path, so the two transports clamp identically. Only set when the caller explicitly supplies it — parity is preserved for callers (like the engine decision path) that do not. Parameters the Chat path does not forward (`top_p`, `parallel_tool_calls`, `tool_choice`, `metadata`, `store`) are intentionally omitted here too, so the request semantics stay identical to today's production Chat behaviour.",
|
|
81080
|
+
"parameters": {
|
|
81081
|
+
"type": "object",
|
|
81082
|
+
"properties": {
|
|
81083
|
+
"content": {
|
|
81084
|
+
"type": "string",
|
|
81085
|
+
"description": "The user content (string or multi-modal content parts)."
|
|
81086
|
+
},
|
|
81087
|
+
"responseFormat": {
|
|
81088
|
+
"type": "string",
|
|
81089
|
+
"description": "The desired response format."
|
|
81090
|
+
},
|
|
81091
|
+
"options": {
|
|
81092
|
+
"type": "string",
|
|
81093
|
+
"description": "The Chat-Completions-style options bag."
|
|
81094
|
+
},
|
|
81095
|
+
"normalizedModel": {
|
|
81096
|
+
"type": "string",
|
|
81097
|
+
"description": "The normalized model name to target."
|
|
81098
|
+
}
|
|
81099
|
+
},
|
|
81100
|
+
"required": [
|
|
81101
|
+
"content",
|
|
81102
|
+
"responseFormat",
|
|
81103
|
+
"options",
|
|
81104
|
+
"normalizedModel"
|
|
81105
|
+
]
|
|
81106
|
+
}
|
|
81107
|
+
}
|
|
81108
|
+
},
|
|
81109
|
+
{
|
|
81110
|
+
"type": "function",
|
|
81111
|
+
"function": {
|
|
81112
|
+
"name": "normalizeResponsesToCompletion",
|
|
81113
|
+
"description": "Normalizes an OpenAI Responses API result into the internal {@link CompletionResponse} shape. This is the response half of the transparent routing layer and is the single most correctness-critical mapping in this module: the returned `tool_calls` MUST be byte-identical to what the Chat path produces so downstream consumers (notably the engine decision path, which reads `tool_call.function.arguments` as a JSON string) parse it unchanged. Mapping: - `function_call` output items → `{ id: call_id, type:'function', function:{ name, arguments } }` with `arguments` kept as the raw JSON string (never pre-parsed) — exactly the Chat `ChatCompletionMessageToolCall` shape. `id` is sourced from `call_id` (not the item `id`) so it round-trips as the `tool_call_id` in a multi-turn conversation. - `message` output items → concatenated `output_text` parts (refusals and non-text parts contribute nothing, matching the Chat path's null-content → empty-string behaviour). - usage: `input_tokens`→prompt, `output_tokens`→completion, `input_tokens_details.cached_tokens`→cached, `output_tokens_details.reasoning_tokens`→reasoning. `system_fingerprint` is `undefined` — the Responses API does not return one (the Chat path forwards it; consumers already treat it as optional).",
|
|
81114
|
+
"parameters": {
|
|
81115
|
+
"type": "object",
|
|
81116
|
+
"properties": {
|
|
81117
|
+
"response": {
|
|
81118
|
+
"type": "string",
|
|
81119
|
+
"description": "The raw OpenAI Responses API result."
|
|
81120
|
+
},
|
|
81121
|
+
"normalizedModel": {
|
|
81122
|
+
"type": "string",
|
|
81123
|
+
"description": "The normalized model name the request targeted."
|
|
81124
|
+
},
|
|
81125
|
+
"serviceTier": {
|
|
81126
|
+
"type": "string",
|
|
81127
|
+
"description": "The caller's requested service tier, echoed through as on the Chat path."
|
|
81128
|
+
}
|
|
81129
|
+
},
|
|
81130
|
+
"required": [
|
|
81131
|
+
"response",
|
|
81132
|
+
"normalizedModel",
|
|
81133
|
+
"serviceTier"
|
|
81134
|
+
]
|
|
81135
|
+
}
|
|
81136
|
+
}
|
|
81137
|
+
},
|
|
80461
81138
|
{
|
|
80462
81139
|
"type": "function",
|
|
80463
81140
|
"function": {
|
|
80464
81141
|
"name": "makeOpenAIChatCompletionCall",
|
|
80465
|
-
"description": "Makes a call to the Lumic LLM interface, either to the default model or to one specified.",
|
|
81142
|
+
"description": "Makes a call to the Lumic LLM interface, either to the default model or to one specified. Transport is chosen transparently: models flagged {@link ModelCapabilities.requiresResponsesApiForTools} (the GPT-5.6 reasoning trio) that are called WITH function tools are routed to the OpenAI Responses API; every other call stays on Chat Completions. The returned {@link LLMResponse} envelope — `response`, `tool_calls`, and `usage` — is byte-identical across both transports, so callers require no changes.",
|
|
80466
81143
|
"parameters": {
|
|
80467
81144
|
"type": "object",
|
|
80468
81145
|
"properties": {
|
|
@@ -81730,5 +82407,5 @@ const lumic = {
|
|
|
81730
82407
|
}
|
|
81731
82408
|
};
|
|
81732
82409
|
|
|
81733
|
-
export { GraphQLInterfaceType as $, print as A, getNamedType as B, isInputType as C, isRequiredArgument as D, isNamedType as E, GraphQLError as F, GraphQLNonNull as G, isOutputType as H, isRequiredInputField as I, isCompositeType as J, Kind as K, getNullableType as L, getEnterLeaveForKind as M, isNode as N, OperationTypeNode as O, didYouMean as P, naturalCompare as Q, suggestionList as R, specifiedScalarTypes as S, keyMap as T, isType as U, isNullableType as V, visit as W, visitInParallel as X, keyValMap as Y, assertObjectType as Z, GraphQLScalarType as _, isListType as a, validateGoogleSheetsRange as a$, GraphQLUnionType as a0, GraphQLInputObjectType as a1, assertNullableType as a2, assertInterfaceType as a3, mapValue as a4, isSpecifiedScalarType as a5, isPrintableAsBlockString as a6, printBlockString as a7, BREAK as a8, GRAPHQL_MAX_INT as a9, printSourceLocation as aA, resolveObjMapThunk as aB, resolveReadonlyArrayThunk as aC, valueFromASTUntyped as aD, version$4 as aE, versionInfo as aF, getAugmentedNamespace as aG, isDigit$1 as aH, isNameStart as aI, dedentBlockStringLines as aJ, isNameContinue as aK, setLumicLogger as aL, getLumicLogger as aM, sanitizeForLog as aN, sanitizeError as aO, sanitizeAWSAuth as aP, sanitizeObject as aQ, getSecrets as aR, resetSecrets as aS, requireSecret as aT, withRetry as aU, CircuitBreaker as aV, CircuitBreakerState as aW, CircuitBreakerOpenError as aX, DEFAULT_CIRCUIT_BREAKER_CONFIG as aY, validateSlackChannel as aZ, validateS3Key as a_, GRAPHQL_MIN_INT as aa, GraphQLFloat as ab, GraphQLInt as ac, Location as ad, Token as ae, assertAbstractType as af, assertCompositeType as ag, assertEnumType as ah, assertEnumValueName as ai, assertInputObjectType as aj, assertInputType as ak, assertLeafType as al, assertListType as am, assertNamedType as an, assertNonNullType as ao, assertOutputType as ap, assertScalarType as aq, assertType as ar, assertUnionType as as, assertWrappingType as at, formatError as au, getLocation as av, getVisitFn as aw, isWrappingType as ax, printError as ay, printLocation as az, isAbstractType as b,
|
|
81734
|
-
//# sourceMappingURL=index-
|
|
82410
|
+
export { GraphQLInterfaceType as $, print as A, getNamedType as B, isInputType as C, isRequiredArgument as D, isNamedType as E, GraphQLError as F, GraphQLNonNull as G, isOutputType as H, isRequiredInputField as I, isCompositeType as J, Kind as K, getNullableType as L, getEnterLeaveForKind as M, isNode as N, OperationTypeNode as O, didYouMean as P, naturalCompare as Q, suggestionList as R, specifiedScalarTypes as S, keyMap as T, isType as U, isNullableType as V, visit as W, visitInParallel as X, keyValMap as Y, assertObjectType as Z, GraphQLScalarType as _, isListType as a, validateGoogleSheetsRange as a$, GraphQLUnionType as a0, GraphQLInputObjectType as a1, assertNullableType as a2, assertInterfaceType as a3, mapValue as a4, isSpecifiedScalarType as a5, isPrintableAsBlockString as a6, printBlockString as a7, BREAK as a8, GRAPHQL_MAX_INT as a9, printSourceLocation as aA, resolveObjMapThunk as aB, resolveReadonlyArrayThunk as aC, valueFromASTUntyped as aD, version$4 as aE, versionInfo as aF, getAugmentedNamespace as aG, isDigit$1 as aH, isNameStart as aI, dedentBlockStringLines as aJ, isNameContinue as aK, setLumicLogger as aL, getLumicLogger as aM, sanitizeForLog as aN, sanitizeError as aO, sanitizeAWSAuth as aP, sanitizeObject as aQ, getSecrets as aR, resetSecrets as aS, requireSecret as aT, withRetry as aU, CircuitBreaker as aV, CircuitBreakerState as aW, CircuitBreakerOpenError as aX, DEFAULT_CIRCUIT_BREAKER_CONFIG as aY, validateSlackChannel as aZ, validateS3Key as a_, GRAPHQL_MIN_INT as aa, GraphQLFloat as ab, GraphQLInt as ac, Location as ad, Token as ae, assertAbstractType as af, assertCompositeType as ag, assertEnumType as ah, assertEnumValueName as ai, assertInputObjectType as aj, assertInputType as ak, assertLeafType as al, assertListType as am, assertNamedType as an, assertNonNullType as ao, assertOutputType as ap, assertScalarType as aq, assertType as ar, assertUnionType as as, assertWrappingType as at, formatError as au, getLocation as av, getVisitFn as aw, isWrappingType as ax, printError as ay, printLocation as az, isAbstractType as b, PerplexityError as b$, LLMCostTracker as b0, getLLMCostTracker as b1, setLLMCostTracker as b2, resetLLMCostTracker as b3, setMetricsCollector as b4, getMetricsCollector as b5, resetMetricsCollector as b6, withMetrics as b7, generateCorrelationId as b8, getCorrelationId as b9, makeAnthropicCall as bA, makeOpenAICompatibleCall as bB, openAIChatCompletionSchema as bC, openAIImageResponseSchema as bD, validateOpenAIChatCompletion as bE, safeValidateOpenAIChatCompletion as bF, perplexityResponseSchema as bG, validatePerplexityResponse as bH, safeValidatePerplexityResponse as bI, googleSheetsValueRangeSchema as bJ, validateGoogleSheetsResponse as bK, safeValidateGoogleSheetsResponse as bL, s3ListObjectsSchema as bM, s3GetObjectSchema as bN, lambdaInvokeResponseSchema as bO, validateS3ListObjects as bP, safeValidateS3ListObjects as bQ, validateLambdaResponse as bR, safeValidateLambdaResponse as bS, createValidator as bT, createSafeValidator as bU, LumicError as bV, SlackError as bW, LLMError as bX, AWSLambdaError as bY, AWSS3Error as bZ, GoogleSheetsError as b_, getCorrelationContext as ba, withCorrelationId as bb, getCorrelationHeaders as bc, TokenBucketRateLimiter as bd, RATE_LIMIT_PROFILES as be, getRateLimiter as bf, resetAllRateLimiters as bg, withRateLimit as bh, checkIntegrationHealth as bi, SUPPORTED_MODELS as bj, isValidModel as bk, getModelCapabilities as bl, getModelProvider as bm, MODEL_ALIASES as bn, OPENAI_COMPATIBLE_PROVIDERS as bo, PROVIDER_DEFAULT_MODELS as bp, LLM_DEFAULT_PROVIDER as bq, LLM_MINI_PROVIDER as br, LLM_NORMAL_PROVIDER as bs, LLM_ADVANCED_PROVIDER as bt, LLM_CRITICAL_PROVIDER as bu, LLM_PROVIDER as bv, LLM_MODEL_MINI as bw, LLM_MODEL_NORMAL as bx, LLM_MODEL_ADVANCED as by, LLM_MODEL_CRITICAL as bz, isInterfaceType as c, JsonParseError as c0, PDFError as c1, ZipError as c2, SLACK_TIMEOUT_MS as c3, PERPLEXITY_TIMEOUT_MS as c4, GOOGLE_SHEETS_TIMEOUT_MS as c5, LLM_TIMEOUT_MS as c6, AWS_LAMBDA_TIMEOUT_MS as c7, AWS_S3_TIMEOUT_MS as c8, OPENWEATHER_TIMEOUT_MS as c9, GENERIC_FETCH_TIMEOUT_MS as ca, isObjectType as d, assertName as e, devAssert as f, isObjectLike as g, defineArguments as h, isNonNullType as i, argsToArgsConfig as j, GraphQLBoolean as k, lumic as l, GraphQLString as m, instanceOf as n, inspect as o, isInputObjectType as p, isLeafType as q, isEnumType as r, GraphQLID as s, toObjMap as t, invariant as u, GraphQLObjectType as v, GraphQLEnumType as w, GraphQLList as x, isScalarType as y, isUnionType as z };
|
|
82411
|
+
//# sourceMappingURL=index-CV8HlDp8.js.map
|