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