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.cjs CHANGED
@@ -8767,18 +8767,20 @@ var post20 = function(param) {
8767
8767
  ];
8768
8768
  case 1:
8769
8769
  openaiAssistant = _state.sent();
8770
- if (assistantId.length > 0 && openaiAssistant && (typeof openaiAssistant === "undefined" ? "undefined" : _type_of(openaiAssistant)) === "object") {
8771
- openaiAssistant.id = assistantId;
8772
- openaiAssistant.name = assistantId;
8773
- }
8774
8770
  _ref = (0, import_radash24.assign)(_object_spread({}, defaultAssistant, openaiAssistant), body), model = _ref.model, instructions = _ref.instructions, tools = _ref.tools, metadata = _ref.metadata, response_format = _ref.response_format, truncation_strategy = _ref.truncation_strategy;
8775
- azureAgentId = assistantId.length > 0 ? assistantId : void 0;
8771
+ 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;
8776
8772
  shouldSendInstructions = !azureAgentId && typeof instructions === "string" && instructions.trim().length > 0;
8777
8773
  responseBody = {
8778
8774
  conversation: threadId,
8779
8775
  stream: stream,
8780
8776
  input: createResponseItems
8781
8777
  };
8778
+ if (azureAgentId) {
8779
+ responseBody.agent = {
8780
+ name: azureAgentId,
8781
+ type: "agent_reference"
8782
+ };
8783
+ }
8782
8784
  if (!azureAgentId) {
8783
8785
  responseBody.model = model;
8784
8786
  responseBody.metadata = metadata;
@@ -8802,14 +8804,7 @@ var post20 = function(param) {
8802
8804
  }
8803
8805
  return [
8804
8806
  4,
8805
- client.responses.create(responseBody, azureAgentId ? {
8806
- body: {
8807
- agent: {
8808
- name: azureAgentId,
8809
- type: "agent_reference"
8810
- }
8811
- }
8812
- } : void 0)
8807
+ client.responses.create(responseBody)
8813
8808
  ];
8814
8809
  case 2:
8815
8810
  response = _state.sent();
@@ -8984,6 +8979,12 @@ var post21 = function(param) {
8984
8979
  stream: stream,
8985
8980
  input: input
8986
8981
  };
8982
+ if (azureAgentId) {
8983
+ responseBody.agent = {
8984
+ name: azureAgentId,
8985
+ type: "agent_reference"
8986
+ };
8987
+ }
8987
8988
  if (!azureAgentId) {
8988
8989
  responseBody.model = openaiAssistant.model;
8989
8990
  Object.assign(responseBody, serializeTools3({
@@ -8998,14 +8999,7 @@ var post21 = function(param) {
8998
8999
  }
8999
9000
  return [
9000
9001
  4,
9001
- client.responses.create(responseBody, azureAgentId ? {
9002
- body: {
9003
- agent: {
9004
- name: azureAgentId,
9005
- type: "agent_reference"
9006
- }
9007
- }
9008
- } : void 0)
9002
+ client.responses.create(responseBody)
9009
9003
  ];
9010
9004
  case 3:
9011
9005
  response = _state.sent();
@@ -9156,7 +9150,7 @@ var azureResponsesStorageAdapter = function() {
9156
9150
  };
9157
9151
  var getAzureClient = function() {
9158
9152
  return _async_to_generator(function() {
9159
- var aiProjectClient, _azureClient_apiKey, azureClient;
9153
+ var _aiProjectClient__options, aiProjectClient, apiVersion, _azureClient_apiKey, azureClient, _azureClient_apiKey1, azureClient1;
9160
9154
  return _ts_generator(this, function(_state) {
9161
9155
  switch(_state.label){
9162
9156
  case 0:
@@ -9170,14 +9164,17 @@ var azureResponsesStorageAdapter = function() {
9170
9164
  }
9171
9165
  aiProjectClient = getAIProjectClient();
9172
9166
  console.log("[azureResponsesStorageAdapter] aiProjectClient obtained");
9173
- if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
9167
+ 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;
9168
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getAzureOpenAIClient" in aiProjectClient && typeof aiProjectClient.getAzureOpenAIClient === "function")) return [
9174
9169
  3,
9175
9170
  2
9176
9171
  ];
9177
- console.log("[azureResponsesStorageAdapter] Calling getOpenAIClient()");
9172
+ console.log("[azureResponsesStorageAdapter] Calling getAzureOpenAIClient()");
9178
9173
  return [
9179
9174
  4,
9180
- aiProjectClient.getOpenAIClient()
9175
+ aiProjectClient.getAzureOpenAIClient(apiVersion ? {
9176
+ apiVersion: apiVersion
9177
+ } : void 0)
9181
9178
  ];
9182
9179
  case 1:
9183
9180
  azureClient = _state.sent();
@@ -9190,6 +9187,28 @@ var azureResponsesStorageAdapter = function() {
9190
9187
  azureClient
9191
9188
  ];
9192
9189
  case 2:
9190
+ if (!(aiProjectClient && (typeof aiProjectClient === "undefined" ? "undefined" : _type_of(aiProjectClient)) === "object" && "getOpenAIClient" in aiProjectClient && typeof aiProjectClient.getOpenAIClient === "function")) return [
9191
+ 3,
9192
+ 4
9193
+ ];
9194
+ console.log("[azureResponsesStorageAdapter] Calling getOpenAIClient()");
9195
+ return [
9196
+ 4,
9197
+ aiProjectClient.getOpenAIClient(apiVersion ? {
9198
+ apiVersion: apiVersion
9199
+ } : void 0)
9200
+ ];
9201
+ case 3:
9202
+ azureClient1 = _state.sent();
9203
+ console.log("[azureResponsesStorageAdapter] Azure OpenAI client obtained");
9204
+ console.log("[azureResponsesStorageAdapter] Azure client baseURL:", azureClient1.baseURL);
9205
+ console.log("[azureResponsesStorageAdapter] Azure client apiKey:", ((_azureClient_apiKey1 = azureClient1.apiKey) === null || _azureClient_apiKey1 === void 0 ? void 0 : _azureClient_apiKey1.substring(0, 20)) + "...");
9206
+ cachedClient = azureClient1;
9207
+ return [
9208
+ 2,
9209
+ azureClient1
9210
+ ];
9211
+ case 4:
9193
9212
  console.log("[azureResponsesStorageAdapter] Not an AIProjectClient, treating as OpenAI client");
9194
9213
  cachedClient = aiProjectClient;
9195
9214
  return [