supercompat 2.6.1 → 2.7.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/index.cjs +26 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/supercompat.cjs +1 -1
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js +1 -1
- package/dist/supercompat.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { supercompat } from './supercompat.cjs';
|
|
2
|
-
import OpenAI from 'openai';
|
|
2
|
+
import OpenAI, { AzureOpenAI } from 'openai';
|
|
3
3
|
import Mistral from '@mistralai/mistralai';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
5
|
import { MessageWithRun, StorageAdapterArgs } from './types/index.cjs';
|
|
@@ -33,6 +33,18 @@ declare const openaiClientAdapter: ({ openai, }: {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
declare const azureOpenaiClientAdapter: ({ azureOpenai, }: {
|
|
37
|
+
azureOpenai: AzureOpenAI;
|
|
38
|
+
}) => {
|
|
39
|
+
type: string;
|
|
40
|
+
client: AzureOpenAI;
|
|
41
|
+
requestHandlers: {
|
|
42
|
+
'^/(?:v1|/?openai)/chat/completions$': {
|
|
43
|
+
post: (_url: string, options: any) => Promise<Response>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
36
48
|
declare const mistralClientAdapter: ({ mistral, }: {
|
|
37
49
|
mistral: Mistral;
|
|
38
50
|
}) => {
|
|
@@ -115,4 +127,4 @@ declare const prismaStorageAdapter: ({ prisma, }: {
|
|
|
115
127
|
};
|
|
116
128
|
};
|
|
117
129
|
|
|
118
|
-
export { anthropicClientAdapter, completionsRunAdapter, groqClientAdapter, mistralClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter };
|
|
130
|
+
export { anthropicClientAdapter, azureOpenaiClientAdapter, completionsRunAdapter, groqClientAdapter, mistralClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { supercompat } from './supercompat.js';
|
|
2
|
-
import OpenAI from 'openai';
|
|
2
|
+
import OpenAI, { AzureOpenAI } from 'openai';
|
|
3
3
|
import Mistral from '@mistralai/mistralai';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
5
|
import { MessageWithRun, StorageAdapterArgs } from './types/index.js';
|
|
@@ -33,6 +33,18 @@ declare const openaiClientAdapter: ({ openai, }: {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
declare const azureOpenaiClientAdapter: ({ azureOpenai, }: {
|
|
37
|
+
azureOpenai: AzureOpenAI;
|
|
38
|
+
}) => {
|
|
39
|
+
type: string;
|
|
40
|
+
client: AzureOpenAI;
|
|
41
|
+
requestHandlers: {
|
|
42
|
+
'^/(?:v1|/?openai)/chat/completions$': {
|
|
43
|
+
post: (_url: string, options: any) => Promise<Response>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
36
48
|
declare const mistralClientAdapter: ({ mistral, }: {
|
|
37
49
|
mistral: Mistral;
|
|
38
50
|
}) => {
|
|
@@ -115,4 +127,4 @@ declare const prismaStorageAdapter: ({ prisma, }: {
|
|
|
115
127
|
};
|
|
116
128
|
};
|
|
117
129
|
|
|
118
|
-
export { anthropicClientAdapter, completionsRunAdapter, groqClientAdapter, mistralClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter };
|
|
130
|
+
export { anthropicClientAdapter, azureOpenaiClientAdapter, completionsRunAdapter, groqClientAdapter, mistralClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter };
|
package/dist/index.js
CHANGED
|
@@ -391,7 +391,7 @@ var endpointFromBaseUrl = function(param) {
|
|
|
391
391
|
// src/supercompat.ts
|
|
392
392
|
var supercompat = function(param) {
|
|
393
393
|
var client = param.client, storage = param.storage, runAdapter = param.runAdapter;
|
|
394
|
-
if (client.
|
|
394
|
+
if (client.type === "AZURE_OPENAI") {
|
|
395
395
|
return new AzureOpenAI({
|
|
396
396
|
apiKey: client.client.apiKey,
|
|
397
397
|
apiVersion: client.client.apiVersion,
|
|
@@ -800,6 +800,19 @@ var openaiClientAdapter = function(param) {
|
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
802
|
};
|
|
803
|
+
// src/adapters/client/azureOpenaiClientAdapter/index.ts
|
|
804
|
+
var azureOpenaiClientAdapter = function(param) {
|
|
805
|
+
var azureOpenai = param.azureOpenai;
|
|
806
|
+
return {
|
|
807
|
+
type: "AZURE_OPENAI",
|
|
808
|
+
client: azureOpenai,
|
|
809
|
+
requestHandlers: {
|
|
810
|
+
"^/(?:v1|/?openai)/chat/completions$": completions2({
|
|
811
|
+
openai: azureOpenai
|
|
812
|
+
})
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
};
|
|
803
816
|
// src/adapters/client/mistralClientAdapter/completions/post.ts
|
|
804
817
|
var post3 = function(param) {
|
|
805
818
|
var mistral = param.mistral;
|
|
@@ -1251,10 +1264,13 @@ var serializeTools = function(param) {
|
|
|
1251
1264
|
var tools = param.tools;
|
|
1252
1265
|
return (tools !== null && tools !== void 0 ? tools : []).map(function(tool) {
|
|
1253
1266
|
if (tool.type === "function") {
|
|
1267
|
+
var _tool_function_parameters;
|
|
1254
1268
|
return {
|
|
1255
1269
|
name: tool.function.name,
|
|
1256
1270
|
description: tool.function.description,
|
|
1257
|
-
input_schema: tool.function.parameters
|
|
1271
|
+
input_schema: (_tool_function_parameters = tool.function.parameters) !== null && _tool_function_parameters !== void 0 ? _tool_function_parameters : {
|
|
1272
|
+
type: "object"
|
|
1273
|
+
}
|
|
1258
1274
|
};
|
|
1259
1275
|
}
|
|
1260
1276
|
return tool;
|
|
@@ -1278,12 +1294,13 @@ var serializeMessage = function(param) {
|
|
|
1278
1294
|
text: message.content
|
|
1279
1295
|
}
|
|
1280
1296
|
].concat(_to_consumable_array(((_message_tool_calls = message.tool_calls) !== null && _message_tool_calls !== void 0 ? _message_tool_calls : []).map(function(toolCall) {
|
|
1281
|
-
return {
|
|
1297
|
+
return _object_spread({
|
|
1282
1298
|
type: "tool_use",
|
|
1283
1299
|
id: toolCall.id,
|
|
1284
|
-
name: toolCall.function.name
|
|
1300
|
+
name: toolCall.function.name
|
|
1301
|
+
}, toolCall.function.arguments ? {
|
|
1285
1302
|
input: JSON.parse(toolCall.function.arguments)
|
|
1286
|
-
};
|
|
1303
|
+
} : {});
|
|
1287
1304
|
})))
|
|
1288
1305
|
};
|
|
1289
1306
|
} else if (message.role === "tool") {
|
|
@@ -3535,5 +3552,5 @@ var prismaStorageAdapter = function(param) {
|
|
|
3535
3552
|
};
|
|
3536
3553
|
};
|
|
3537
3554
|
};
|
|
3538
|
-
export { anthropicClientAdapter, completionsRunAdapter, groqClientAdapter, mistralClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, supercompat };
|
|
3555
|
+
export { anthropicClientAdapter, azureOpenaiClientAdapter, completionsRunAdapter, groqClientAdapter, mistralClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, supercompat };
|
|
3539
3556
|
//# sourceMappingURL=index.js.map
|