@theokit/sdk 4.9.1 → 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-D_0p_gXd.d.ts → cron-C7catiH8.d.ts} +37 -1
- package/dist/{cron-26WH1n7o.d.cts → cron-DK1WVZnI.d.cts} +37 -1
- package/dist/cron.cjs +14 -1
- 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 +14 -1
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +14 -1
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +14 -1
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +14 -1
- 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 +14 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/providers/types.d.ts +1 -1
- package/dist/types/provider-profile.d.ts +36 -0
- package/package.json +1 -1
package/dist/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
|
@@ -12610,6 +12610,7 @@ var OpenAIClient = class {
|
|
|
12610
12610
|
if (this.options.organization !== void 0) {
|
|
12611
12611
|
headers["openai-organization"] = this.options.organization;
|
|
12612
12612
|
}
|
|
12613
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
12613
12614
|
const providerId = this.options.providerName ?? this.name;
|
|
12614
12615
|
let response;
|
|
12615
12616
|
try {
|
|
@@ -13682,6 +13683,11 @@ function resolveApiKey2(envVars) {
|
|
|
13682
13683
|
return void 0;
|
|
13683
13684
|
}
|
|
13684
13685
|
function selectTransport(profile, apiKey) {
|
|
13686
|
+
const applyTransform = () => {
|
|
13687
|
+
if (profile.transform === void 0) return {};
|
|
13688
|
+
const ctx = { apiKey };
|
|
13689
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
13690
|
+
};
|
|
13685
13691
|
if (profile.apiMode === "chat_completions") {
|
|
13686
13692
|
if (profile.name === "ollama") {
|
|
13687
13693
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -13698,6 +13704,10 @@ function selectTransport(profile, apiKey) {
|
|
|
13698
13704
|
}
|
|
13699
13705
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
13700
13706
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
13707
|
+
const t = applyTransform();
|
|
13708
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
13709
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13710
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
13701
13711
|
return new OpenAIClient(opts);
|
|
13702
13712
|
}
|
|
13703
13713
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -13714,10 +13724,13 @@ function selectTransport(profile, apiKey) {
|
|
|
13714
13724
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
13715
13725
|
}
|
|
13716
13726
|
if (profile.apiMode === "responses_api") {
|
|
13727
|
+
const t = applyTransform();
|
|
13728
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13717
13729
|
return new ResponsesApiClient({
|
|
13718
13730
|
apiKey,
|
|
13719
13731
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
13720
|
-
...
|
|
13732
|
+
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
13733
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
13721
13734
|
providerName: profile.name
|
|
13722
13735
|
});
|
|
13723
13736
|
}
|