supercompat 3.15.5 → 3.15.6

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/index.js CHANGED
@@ -8645,18 +8645,20 @@ var post20 = function(param) {
8645
8645
  ];
8646
8646
  case 1:
8647
8647
  openaiAssistant = _state.sent();
8648
- if (assistantId.length > 0 && openaiAssistant && (typeof openaiAssistant === "undefined" ? "undefined" : _type_of(openaiAssistant)) === "object") {
8649
- openaiAssistant.id = assistantId;
8650
- openaiAssistant.name = assistantId;
8651
- }
8652
8648
  _assign9 = assign9(_object_spread({}, defaultAssistant, openaiAssistant), body), model = _assign9.model, instructions = _assign9.instructions, tools = _assign9.tools, metadata = _assign9.metadata, response_format = _assign9.response_format, truncation_strategy = _assign9.truncation_strategy;
8653
- azureAgentId = assistantId.length > 0 ? assistantId : void 0;
8649
+ azureAgentId = openaiAssistant && (typeof openaiAssistant === "undefined" ? "undefined" : _type_of(openaiAssistant)) === "object" && typeof openaiAssistant.id === "string" && typeof openaiAssistant.name === "string" && openaiAssistant.id.trim().length > 0 && openaiAssistant.id === openaiAssistant.name && openaiAssistant.id === assistantId ? openaiAssistant.id : void 0;
8654
8650
  shouldSendInstructions = !azureAgentId && typeof instructions === "string" && instructions.trim().length > 0;
8655
8651
  responseBody = {
8656
8652
  conversation: threadId,
8657
8653
  stream: stream,
8658
8654
  input: createResponseItems
8659
8655
  };
8656
+ if (azureAgentId) {
8657
+ responseBody.agent = {
8658
+ name: azureAgentId,
8659
+ type: "agent_reference"
8660
+ };
8661
+ }
8660
8662
  if (!azureAgentId) {
8661
8663
  responseBody.model = model;
8662
8664
  responseBody.metadata = metadata;
@@ -8680,14 +8682,7 @@ var post20 = function(param) {
8680
8682
  }
8681
8683
  return [
8682
8684
  4,
8683
- client.responses.create(responseBody, azureAgentId ? {
8684
- body: {
8685
- agent: {
8686
- name: azureAgentId,
8687
- type: "agent_reference"
8688
- }
8689
- }
8690
- } : void 0)
8685
+ client.responses.create(responseBody)
8691
8686
  ];
8692
8687
  case 2:
8693
8688
  response = _state.sent();
@@ -8862,6 +8857,12 @@ var post21 = function(param) {
8862
8857
  stream: stream,
8863
8858
  input: input
8864
8859
  };
8860
+ if (azureAgentId) {
8861
+ responseBody.agent = {
8862
+ name: azureAgentId,
8863
+ type: "agent_reference"
8864
+ };
8865
+ }
8865
8866
  if (!azureAgentId) {
8866
8867
  responseBody.model = openaiAssistant.model;
8867
8868
  Object.assign(responseBody, serializeTools3({
@@ -8876,14 +8877,7 @@ var post21 = function(param) {
8876
8877
  }
8877
8878
  return [
8878
8879
  4,
8879
- client.responses.create(responseBody, azureAgentId ? {
8880
- body: {
8881
- agent: {
8882
- name: azureAgentId,
8883
- type: "agent_reference"
8884
- }
8885
- }
8886
- } : void 0)
8880
+ client.responses.create(responseBody)
8887
8881
  ];
8888
8882
  case 3:
8889
8883
  response = _state.sent();
@@ -9034,7 +9028,7 @@ var azureResponsesStorageAdapter = function() {
9034
9028
  };
9035
9029
  var getAzureClient = function() {
9036
9030
  return _async_to_generator(function() {
9037
- var aiProjectClient, _azureClient_apiKey, azureClient;
9031
+ var _aiProjectClient__options, aiProjectClient, apiVersion, _azureClient_apiKey, azureClient, _azureClient_apiKey1, azureClient1;
9038
9032
  return _ts_generator(this, function(_state) {
9039
9033
  switch(_state.label){
9040
9034
  case 0:
@@ -9048,14 +9042,17 @@ var azureResponsesStorageAdapter = function() {
9048
9042
  }
9049
9043
  aiProjectClient = getAIProjectClient();
9050
9044
  console.log("[azureResponsesStorageAdapter] aiProjectClient obtained");
9051
- if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
9045
+ apiVersion = (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" ? (_aiProjectClient__options = aiProjectClient._options) === null || _aiProjectClient__options === void 0 ? void 0 : _aiProjectClient__options.apiVersion : void 0;
9046
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getAzureOpenAIClient" in aiProjectClient && typeof aiProjectClient.getAzureOpenAIClient === "function")) return [
9052
9047
  3,
9053
9048
  2
9054
9049
  ];
9055
- console.log("[azureResponsesStorageAdapter] Calling getOpenAIClient()");
9050
+ console.log("[azureResponsesStorageAdapter] Calling getAzureOpenAIClient()");
9056
9051
  return [
9057
9052
  4,
9058
- aiProjectClient.getOpenAIClient()
9053
+ aiProjectClient.getAzureOpenAIClient(apiVersion ? {
9054
+ apiVersion: apiVersion
9055
+ } : void 0)
9059
9056
  ];
9060
9057
  case 1:
9061
9058
  azureClient = _state.sent();
@@ -9068,6 +9065,28 @@ var azureResponsesStorageAdapter = function() {
9068
9065
  azureClient
9069
9066
  ];
9070
9067
  case 2:
9068
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
9069
+ 3,
9070
+ 4
9071
+ ];
9072
+ console.log("[azureResponsesStorageAdapter] Calling getOpenAIClient()");
9073
+ return [
9074
+ 4,
9075
+ aiProjectClient.getOpenAIClient(apiVersion ? {
9076
+ apiVersion: apiVersion
9077
+ } : void 0)
9078
+ ];
9079
+ case 3:
9080
+ azureClient1 = _state.sent();
9081
+ console.log("[azureResponsesStorageAdapter] Azure OpenAI client obtained");
9082
+ console.log("[azureResponsesStorageAdapter] Azure client baseURL:", azureClient1.baseURL);
9083
+ console.log("[azureResponsesStorageAdapter] Azure client apiKey:", ((_azureClient_apiKey1 = azureClient1.apiKey) === null || _azureClient_apiKey1 === void 0 ? void 0 : _azureClient_apiKey1.substring(0, 20)) + "...");
9084
+ cachedClient = azureClient1;
9085
+ return [
9086
+ 2,
9087
+ azureClient1
9088
+ ];
9089
+ case 4:
9071
9090
  console.log("[azureResponsesStorageAdapter] Not an AIProjectClient, treating as OpenAI client");
9072
9091
  cachedClient = aiProjectClient;
9073
9092
  return [