@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/eval.js
CHANGED
|
@@ -12605,6 +12605,7 @@ var OpenAIClient = class {
|
|
|
12605
12605
|
if (this.options.organization !== void 0) {
|
|
12606
12606
|
headers["openai-organization"] = this.options.organization;
|
|
12607
12607
|
}
|
|
12608
|
+
if (this.options.extraHeaders !== void 0) Object.assign(headers, this.options.extraHeaders);
|
|
12608
12609
|
const providerId = this.options.providerName ?? this.name;
|
|
12609
12610
|
let response;
|
|
12610
12611
|
try {
|
|
@@ -13677,6 +13678,11 @@ function resolveApiKey2(envVars) {
|
|
|
13677
13678
|
return void 0;
|
|
13678
13679
|
}
|
|
13679
13680
|
function selectTransport(profile, apiKey) {
|
|
13681
|
+
const applyTransform = () => {
|
|
13682
|
+
if (profile.transform === void 0) return {};
|
|
13683
|
+
const ctx = { apiKey };
|
|
13684
|
+
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
13685
|
+
};
|
|
13680
13686
|
if (profile.apiMode === "chat_completions") {
|
|
13681
13687
|
if (profile.name === "ollama") {
|
|
13682
13688
|
const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
|
|
@@ -13693,6 +13699,10 @@ function selectTransport(profile, apiKey) {
|
|
|
13693
13699
|
}
|
|
13694
13700
|
const envOverride = resolveBaseUrlEnvOverride(profile.name);
|
|
13695
13701
|
if (envOverride !== void 0) opts.baseUrl = envOverride;
|
|
13702
|
+
const t = applyTransform();
|
|
13703
|
+
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
13704
|
+
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13705
|
+
if (merged !== void 0) opts.extraHeaders = merged;
|
|
13696
13706
|
return new OpenAIClient(opts);
|
|
13697
13707
|
}
|
|
13698
13708
|
if (profile.apiMode === "anthropic_messages") {
|
|
@@ -13709,10 +13719,13 @@ function selectTransport(profile, apiKey) {
|
|
|
13709
13719
|
return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
|
|
13710
13720
|
}
|
|
13711
13721
|
if (profile.apiMode === "responses_api") {
|
|
13722
|
+
const t = applyTransform();
|
|
13723
|
+
const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
13712
13724
|
return new ResponsesApiClient({
|
|
13713
13725
|
apiKey,
|
|
13714
13726
|
...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
|
|
13715
|
-
...
|
|
13727
|
+
...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
|
|
13728
|
+
...t.fetch !== void 0 ? { fetch: t.fetch } : {},
|
|
13716
13729
|
providerName: profile.name
|
|
13717
13730
|
});
|
|
13718
13731
|
}
|