@theokit/sdk 4.9.1 → 4.10.0

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.js CHANGED
@@ -13677,6 +13677,9 @@ function resolveApiKey2(envVars) {
13677
13677
  return void 0;
13678
13678
  }
13679
13679
  function selectTransport(profile, apiKey) {
13680
+ const transformCtx = { apiKey };
13681
+ const transformFetch = profile.transform?.fetch?.(transformCtx);
13682
+ const transformHeaders = profile.transform?.headers?.(transformCtx);
13680
13683
  if (profile.apiMode === "chat_completions") {
13681
13684
  if (profile.name === "ollama") {
13682
13685
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13693,6 +13696,7 @@ function selectTransport(profile, apiKey) {
13693
13696
  }
13694
13697
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13695
13698
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13699
+ if (transformFetch !== void 0) opts.fetch = transformFetch;
13696
13700
  return new OpenAIClient(opts);
13697
13701
  }
13698
13702
  if (profile.apiMode === "anthropic_messages") {
@@ -13709,10 +13713,12 @@ function selectTransport(profile, apiKey) {
13709
13713
  return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
13710
13714
  }
13711
13715
  if (profile.apiMode === "responses_api") {
13716
+ const mergedHeaders = profile.extraHeaders !== void 0 || transformHeaders !== void 0 ? { ...profile.extraHeaders, ...transformHeaders } : void 0;
13712
13717
  return new ResponsesApiClient({
13713
13718
  apiKey,
13714
13719
  ...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
13715
- ...profile.extraHeaders !== void 0 ? { extraHeaders: profile.extraHeaders } : {},
13720
+ ...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
13721
+ ...transformFetch !== void 0 ? { fetch: transformFetch } : {},
13716
13722
  providerName: profile.name
13717
13723
  });
13718
13724
  }