@theokit/sdk 4.10.0 → 4.10.1
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/CHANGELOG.md +30 -0
- package/dist/{cron-BF_AI5NP.d.ts → cron-C7catiH8.d.ts} +7 -2
- package/dist/{cron-DXEhagMa.d.cts → cron-DK1WVZnI.d.cts} +7 -2
- package/dist/cron.cjs +13 -6
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +13 -6
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +13 -6
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +13 -6
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/providers/types.d.ts +1 -1
- package/dist/types/provider-profile.d.ts +6 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15210,6 +15210,7 @@ var OpenAIClient = class {
|
|
|
15210
15210
|
if (this.options.organization !== void 0) {
|
|
15211
15211
|
headers["openai-organization"] = this.options.organization;
|
|
15212
15212
|
}
|
|
15213
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
15213
15214
|
const providerId = this.options.providerName ?? this.name;
|
|
15214
15215
|
let response;
|
|
15215
15216
|
try {
|
|
@@ -16282,9 +16283,11 @@ function resolveApiKey2(envVars) {
|
|
|
16282
16283
|
return void 0;
|
|
16283
16284
|
}
|
|
16284
16285
|
function selectTransport(profile, apiKey) {
|
|
16285
|
-
const
|
|
16286
|
-
|
|
16287
|
-
|
|
16286
|
+
const applyTransform = () => {
|
|
16287
|
+
if (profile.transform === void 0) return {};
|
|
16288
|
+
const ctx = { apiKey };
|
|
16289
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
16290
|
+
};
|
|
16288
16291
|
if (profile.apiMode === "chat_completions") {
|
|
16289
16292
|
if (profile.name === "ollama") {
|
|
16290
16293
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -16301,7 +16304,10 @@ function selectTransport(profile, apiKey) {
|
|
|
16301
16304
|
}
|
|
16302
16305
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
16303
16306
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
16304
|
-
|
|
16307
|
+
const t = applyTransform();
|
|
16308
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
16309
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
16310
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
16305
16311
|
return new OpenAIClient(opts);
|
|
16306
16312
|
}
|
|
16307
16313
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -16318,12 +16324,13 @@ function selectTransport(profile, apiKey) {
|
|
|
16318
16324
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
16319
16325
|
}
|
|
16320
16326
|
if (profile.apiMode === "responses_api") {
|
|
16321
|
-
const
|
|
16327
|
+
const t = applyTransform();
|
|
16328
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
16322
16329
|
return new ResponsesApiClient({
|
|
16323
16330
|
apiKey,
|
|
16324
16331
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
16325
16332
|
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
16326
|
-
...
|
|
16333
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
16327
16334
|
providerName: profile.name
|
|
16328
16335
|
});
|
|
16329
16336
|
}
|