supercompat 3.18.1 → 4.0.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/index.cjs +0 -16452
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -330
- package/dist/index.d.ts +1 -330
- package/dist/index.js +0 -16353
- package/dist/index.js.map +1 -1
- package/dist/openai/index.cjs +94218 -0
- package/dist/openai/index.cjs.map +1 -0
- package/dist/openai/index.d.cts +547 -0
- package/dist/openai/index.d.ts +547 -0
- package/dist/openai/index.js +94082 -0
- package/dist/openai/index.js.map +1 -0
- package/dist/supercompat.cjs.map +1 -1
- package/dist/supercompat.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,331 +1,2 @@
|
|
|
1
|
-
export { supercompat } from './supercompat.cjs';
|
|
2
|
-
import OpenAI, { AzureOpenAI } from 'openai';
|
|
3
|
-
import { AIProjectClient } from '@azure/ai-projects';
|
|
4
|
-
import { Mistral } from '@mistralai/mistralai';
|
|
5
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
6
|
-
import { GoogleGenAI } from '@google/genai';
|
|
7
|
-
import { OpenRouter } from '@openrouter/sdk';
|
|
8
|
-
import { MessageWithRun, StorageAdapterArgs, RequestHandler, RunAdapterWithAssistant } from './types/index.cjs';
|
|
9
|
-
import { PrismaClient } from '@prisma/client';
|
|
10
1
|
|
|
11
|
-
|
|
12
|
-
groq: any;
|
|
13
|
-
}) => {
|
|
14
|
-
client: any;
|
|
15
|
-
requestHandlers: {
|
|
16
|
-
'^/v1/models$': {
|
|
17
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
18
|
-
};
|
|
19
|
-
'^/v1/chat/completions$': {
|
|
20
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
declare const openaiClientAdapter: ({ openai, }: {
|
|
26
|
-
openai: OpenAI;
|
|
27
|
-
}) => {
|
|
28
|
-
client: OpenAI;
|
|
29
|
-
requestHandlers: {
|
|
30
|
-
'^/v1/models$': {
|
|
31
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
32
|
-
};
|
|
33
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
34
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
declare const azureOpenaiClientAdapter: ({ azureOpenai, }: {
|
|
40
|
-
azureOpenai: AzureOpenAI;
|
|
41
|
-
}) => {
|
|
42
|
-
type: string;
|
|
43
|
-
client: AzureOpenAI;
|
|
44
|
-
requestHandlers: {
|
|
45
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
46
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Client adapter for Azure AI Projects.
|
|
53
|
-
*
|
|
54
|
-
* Supports both Azure Agents API and Azure Responses API:
|
|
55
|
-
*
|
|
56
|
-
* @example Azure Agents API
|
|
57
|
-
* ```typescript
|
|
58
|
-
* const client = supercompat({
|
|
59
|
-
* client: azureAiProjectClientAdapter({ azureAiProject }),
|
|
60
|
-
* storage: azureAgentsStorageAdapter(),
|
|
61
|
-
* runAdapter: azureAgentsRunAdapter({ ... })
|
|
62
|
-
* })
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* @example Azure Responses API
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const client = supercompat({
|
|
68
|
-
* client: azureAiProjectClientAdapter({ azureAiProject }),
|
|
69
|
-
* storage: azureResponsesStorageAdapter(),
|
|
70
|
-
* runAdapter: responsesRunAdapter({ ... })
|
|
71
|
-
* })
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
declare const azureAiProjectClientAdapter: ({ azureAiProject, }: {
|
|
75
|
-
azureAiProject: AIProjectClient;
|
|
76
|
-
}) => {
|
|
77
|
-
type: string;
|
|
78
|
-
client: AIProjectClient;
|
|
79
|
-
requestHandlers: {
|
|
80
|
-
'^/v1/models$': {
|
|
81
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
declare const mistralClientAdapter: ({ mistral, }: {
|
|
87
|
-
mistral: Mistral;
|
|
88
|
-
}) => {
|
|
89
|
-
client: Mistral;
|
|
90
|
-
requestHandlers: {
|
|
91
|
-
'^/v1/models$': {
|
|
92
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
93
|
-
};
|
|
94
|
-
'^/v1/chat/completions$': {
|
|
95
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
declare const perplexityClientAdapter: ({ perplexity, }: {
|
|
101
|
-
perplexity: OpenAI;
|
|
102
|
-
}) => {
|
|
103
|
-
client: OpenAI;
|
|
104
|
-
requestHandlers: {
|
|
105
|
-
'^/v1/models$': {
|
|
106
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
107
|
-
};
|
|
108
|
-
'^/v1/chat/completions$': {
|
|
109
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
declare const anthropicClientAdapter: ({ anthropic, }: {
|
|
115
|
-
anthropic: Anthropic;
|
|
116
|
-
}) => {
|
|
117
|
-
client: Anthropic;
|
|
118
|
-
requestHandlers: {
|
|
119
|
-
'^/v1/models$': {
|
|
120
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
121
|
-
};
|
|
122
|
-
'^/v1/chat/completions$': {
|
|
123
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
declare const togetherClientAdapter: ({ together, }: {
|
|
129
|
-
together: OpenAI;
|
|
130
|
-
}) => {
|
|
131
|
-
client: OpenAI;
|
|
132
|
-
requestHandlers: {
|
|
133
|
-
'^/v1/models$': {
|
|
134
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
135
|
-
};
|
|
136
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
137
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
declare const googleClientAdapter: ({ google, }: {
|
|
143
|
-
google: GoogleGenAI;
|
|
144
|
-
}) => {
|
|
145
|
-
client: GoogleGenAI;
|
|
146
|
-
requestHandlers: {
|
|
147
|
-
'^/v1/models$': {
|
|
148
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
149
|
-
};
|
|
150
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
151
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
declare const humirisClientAdapter: ({ humiris, }: {
|
|
157
|
-
humiris: OpenAI;
|
|
158
|
-
}) => {
|
|
159
|
-
client: OpenAI;
|
|
160
|
-
requestHandlers: {
|
|
161
|
-
'^/v1/models$': {
|
|
162
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
163
|
-
};
|
|
164
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
165
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
declare const ollamaClientAdapter: ({ ollama, }: {
|
|
171
|
-
ollama: OpenAI;
|
|
172
|
-
}) => {
|
|
173
|
-
client: OpenAI;
|
|
174
|
-
requestHandlers: {
|
|
175
|
-
'^/v1/models$': {
|
|
176
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
177
|
-
};
|
|
178
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
179
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
declare const openRouterClientAdapter: ({ openRouter, provider, }: {
|
|
185
|
-
openRouter: OpenRouter;
|
|
186
|
-
provider?: Record<string, unknown>;
|
|
187
|
-
}) => {
|
|
188
|
-
client: OpenRouter;
|
|
189
|
-
requestHandlers: {
|
|
190
|
-
'^/v1/models$': {
|
|
191
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
192
|
-
};
|
|
193
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
194
|
-
post: (_url: string, options: {
|
|
195
|
-
body: string;
|
|
196
|
-
}) => Promise<Response>;
|
|
197
|
-
};
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
declare const completionsRunAdapter: () => {
|
|
202
|
-
handleRun: ({ client, run, onEvent, getMessages, }: {
|
|
203
|
-
client: OpenAI;
|
|
204
|
-
run: OpenAI.Beta.Threads.Run;
|
|
205
|
-
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
206
|
-
getMessages: () => Promise<MessageWithRun[]>;
|
|
207
|
-
}) => Promise<any>;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
type MethodHandlers$2 = {
|
|
211
|
-
get?: RequestHandler;
|
|
212
|
-
post?: RequestHandler;
|
|
213
|
-
};
|
|
214
|
-
declare const prismaStorageAdapter: ({ prisma, }: {
|
|
215
|
-
prisma: PrismaClient;
|
|
216
|
-
}) => ((args: StorageAdapterArgs) => {
|
|
217
|
-
requestHandlers: Record<string, MethodHandlers$2>;
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
type MethodHandlers$1 = {
|
|
221
|
-
get?: RequestHandler;
|
|
222
|
-
post?: RequestHandler;
|
|
223
|
-
};
|
|
224
|
-
type ResponsesStorageAdapterArgs = StorageAdapterArgs & {
|
|
225
|
-
runAdapter: RunAdapterWithAssistant;
|
|
226
|
-
};
|
|
227
|
-
declare const responsesStorageAdapter: () => ((args: ResponsesStorageAdapterArgs) => {
|
|
228
|
-
requestHandlers: Record<string, MethodHandlers$1>;
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
type MethodHandlers = {
|
|
232
|
-
get?: RequestHandler;
|
|
233
|
-
post?: RequestHandler;
|
|
234
|
-
};
|
|
235
|
-
type AzureResponsesStorageAdapterArgs = StorageAdapterArgs & {
|
|
236
|
-
runAdapter: RunAdapterWithAssistant;
|
|
237
|
-
originalClient?: any;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* Storage adapter for Azure's Responses API (conversations + responses endpoints).
|
|
241
|
-
*
|
|
242
|
-
* Use this with Azure AI Projects and azureAiProjectClientAdapter:
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* ```typescript
|
|
246
|
-
* const azureAiProject = new AIProjectClient(endpoint, credential)
|
|
247
|
-
*
|
|
248
|
-
* const client = supercompat({
|
|
249
|
-
* client: azureAiProjectClientAdapter({ azureAiProject }),
|
|
250
|
-
* storage: azureResponsesStorageAdapter(),
|
|
251
|
-
* runAdapter: responsesRunAdapter({ getOpenaiAssistant: () => assistant }),
|
|
252
|
-
* })
|
|
253
|
-
* ```
|
|
254
|
-
*/
|
|
255
|
-
declare const azureResponsesStorageAdapter: () => ((args: AzureResponsesStorageAdapterArgs) => {
|
|
256
|
-
requestHandlers: Record<string, MethodHandlers>;
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
type AzureAgentsStorageAdapterArgs = StorageAdapterArgs & {
|
|
260
|
-
runAdapter: RunAdapterWithAssistant;
|
|
261
|
-
};
|
|
262
|
-
declare const azureAgentsStorageAdapter: ({ azureAiProject, prisma, }: {
|
|
263
|
-
azureAiProject: AIProjectClient;
|
|
264
|
-
prisma: PrismaClient;
|
|
265
|
-
}) => ({ runAdapter }: AzureAgentsStorageAdapterArgs) => {
|
|
266
|
-
requestHandlers: {
|
|
267
|
-
'^/(?:v1|/?openai)/assistants$': {
|
|
268
|
-
post: RequestHandler;
|
|
269
|
-
};
|
|
270
|
-
'^/(?:v1|/?openai)/threads$': {
|
|
271
|
-
post: RequestHandler;
|
|
272
|
-
};
|
|
273
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/messages$": {
|
|
274
|
-
post: RequestHandler;
|
|
275
|
-
get: RequestHandler;
|
|
276
|
-
};
|
|
277
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs$": {
|
|
278
|
-
get: RequestHandler;
|
|
279
|
-
post: RequestHandler;
|
|
280
|
-
};
|
|
281
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)$": {
|
|
282
|
-
get: RequestHandler;
|
|
283
|
-
};
|
|
284
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)/steps$": {
|
|
285
|
-
get: RequestHandler;
|
|
286
|
-
};
|
|
287
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)/submit_tool_outputs$": {
|
|
288
|
-
post: RequestHandler;
|
|
289
|
-
};
|
|
290
|
-
"^/(?:v1|/?openai)/files/([^/]+)$": {
|
|
291
|
-
get: RequestHandler;
|
|
292
|
-
};
|
|
293
|
-
"^/(?:v1|/?openai)/files/([^/]+)/content$": {
|
|
294
|
-
get: RequestHandler;
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
type Args = {
|
|
300
|
-
select?: {
|
|
301
|
-
id?: boolean;
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
declare const responsesRunAdapter: ({ getOpenaiAssistant: getDirectOpenaiAssistant, waitUntil }: {
|
|
305
|
-
getOpenaiAssistant: (args?: Args) => Promise<OpenAI.Beta.Assistants.Assistant> | OpenAI.Beta.Assistants.Assistant | Pick<OpenAI.Beta.Assistants.Assistant, "id"> | Promise<Pick<OpenAI.Beta.Assistants.Assistant, "id">>;
|
|
306
|
-
waitUntil?: <T>(p: Promise<T>) => void | Promise<void>;
|
|
307
|
-
}) => {
|
|
308
|
-
handleRun: ({ client, threadId, response, onEvent, }: {
|
|
309
|
-
client: OpenAI;
|
|
310
|
-
threadId: string;
|
|
311
|
-
response: AsyncIterable<any>;
|
|
312
|
-
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
313
|
-
}) => Promise<void>;
|
|
314
|
-
getOpenaiAssistant: ({ select: { id } }?: Args) => Promise<OpenAI.Beta.Assistants.Assistant | {
|
|
315
|
-
id: string;
|
|
316
|
-
}>;
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
declare const azureAgentsRunAdapter: ({ azureAiProject, }: {
|
|
320
|
-
azureAiProject: AIProjectClient;
|
|
321
|
-
}) => {
|
|
322
|
-
handleRun: ({ threadId, assistantId, instructions, tools, onEvent, }: {
|
|
323
|
-
threadId: string;
|
|
324
|
-
assistantId: string;
|
|
325
|
-
instructions?: string;
|
|
326
|
-
tools?: any[];
|
|
327
|
-
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
328
|
-
}) => Promise<void>;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, azureResponsesStorageAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openRouterClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, togetherClientAdapter };
|
|
2
|
+
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,331 +1,2 @@
|
|
|
1
|
-
export { supercompat } from './supercompat.js';
|
|
2
|
-
import OpenAI, { AzureOpenAI } from 'openai';
|
|
3
|
-
import { AIProjectClient } from '@azure/ai-projects';
|
|
4
|
-
import { Mistral } from '@mistralai/mistralai';
|
|
5
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
6
|
-
import { GoogleGenAI } from '@google/genai';
|
|
7
|
-
import { OpenRouter } from '@openrouter/sdk';
|
|
8
|
-
import { MessageWithRun, StorageAdapterArgs, RequestHandler, RunAdapterWithAssistant } from './types/index.js';
|
|
9
|
-
import { PrismaClient } from '@prisma/client';
|
|
10
1
|
|
|
11
|
-
|
|
12
|
-
groq: any;
|
|
13
|
-
}) => {
|
|
14
|
-
client: any;
|
|
15
|
-
requestHandlers: {
|
|
16
|
-
'^/v1/models$': {
|
|
17
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
18
|
-
};
|
|
19
|
-
'^/v1/chat/completions$': {
|
|
20
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
declare const openaiClientAdapter: ({ openai, }: {
|
|
26
|
-
openai: OpenAI;
|
|
27
|
-
}) => {
|
|
28
|
-
client: OpenAI;
|
|
29
|
-
requestHandlers: {
|
|
30
|
-
'^/v1/models$': {
|
|
31
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
32
|
-
};
|
|
33
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
34
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
declare const azureOpenaiClientAdapter: ({ azureOpenai, }: {
|
|
40
|
-
azureOpenai: AzureOpenAI;
|
|
41
|
-
}) => {
|
|
42
|
-
type: string;
|
|
43
|
-
client: AzureOpenAI;
|
|
44
|
-
requestHandlers: {
|
|
45
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
46
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Client adapter for Azure AI Projects.
|
|
53
|
-
*
|
|
54
|
-
* Supports both Azure Agents API and Azure Responses API:
|
|
55
|
-
*
|
|
56
|
-
* @example Azure Agents API
|
|
57
|
-
* ```typescript
|
|
58
|
-
* const client = supercompat({
|
|
59
|
-
* client: azureAiProjectClientAdapter({ azureAiProject }),
|
|
60
|
-
* storage: azureAgentsStorageAdapter(),
|
|
61
|
-
* runAdapter: azureAgentsRunAdapter({ ... })
|
|
62
|
-
* })
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* @example Azure Responses API
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const client = supercompat({
|
|
68
|
-
* client: azureAiProjectClientAdapter({ azureAiProject }),
|
|
69
|
-
* storage: azureResponsesStorageAdapter(),
|
|
70
|
-
* runAdapter: responsesRunAdapter({ ... })
|
|
71
|
-
* })
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
declare const azureAiProjectClientAdapter: ({ azureAiProject, }: {
|
|
75
|
-
azureAiProject: AIProjectClient;
|
|
76
|
-
}) => {
|
|
77
|
-
type: string;
|
|
78
|
-
client: AIProjectClient;
|
|
79
|
-
requestHandlers: {
|
|
80
|
-
'^/v1/models$': {
|
|
81
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
declare const mistralClientAdapter: ({ mistral, }: {
|
|
87
|
-
mistral: Mistral;
|
|
88
|
-
}) => {
|
|
89
|
-
client: Mistral;
|
|
90
|
-
requestHandlers: {
|
|
91
|
-
'^/v1/models$': {
|
|
92
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
93
|
-
};
|
|
94
|
-
'^/v1/chat/completions$': {
|
|
95
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
declare const perplexityClientAdapter: ({ perplexity, }: {
|
|
101
|
-
perplexity: OpenAI;
|
|
102
|
-
}) => {
|
|
103
|
-
client: OpenAI;
|
|
104
|
-
requestHandlers: {
|
|
105
|
-
'^/v1/models$': {
|
|
106
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
107
|
-
};
|
|
108
|
-
'^/v1/chat/completions$': {
|
|
109
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
declare const anthropicClientAdapter: ({ anthropic, }: {
|
|
115
|
-
anthropic: Anthropic;
|
|
116
|
-
}) => {
|
|
117
|
-
client: Anthropic;
|
|
118
|
-
requestHandlers: {
|
|
119
|
-
'^/v1/models$': {
|
|
120
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
121
|
-
};
|
|
122
|
-
'^/v1/chat/completions$': {
|
|
123
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
declare const togetherClientAdapter: ({ together, }: {
|
|
129
|
-
together: OpenAI;
|
|
130
|
-
}) => {
|
|
131
|
-
client: OpenAI;
|
|
132
|
-
requestHandlers: {
|
|
133
|
-
'^/v1/models$': {
|
|
134
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
135
|
-
};
|
|
136
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
137
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
declare const googleClientAdapter: ({ google, }: {
|
|
143
|
-
google: GoogleGenAI;
|
|
144
|
-
}) => {
|
|
145
|
-
client: GoogleGenAI;
|
|
146
|
-
requestHandlers: {
|
|
147
|
-
'^/v1/models$': {
|
|
148
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
149
|
-
};
|
|
150
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
151
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
declare const humirisClientAdapter: ({ humiris, }: {
|
|
157
|
-
humiris: OpenAI;
|
|
158
|
-
}) => {
|
|
159
|
-
client: OpenAI;
|
|
160
|
-
requestHandlers: {
|
|
161
|
-
'^/v1/models$': {
|
|
162
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
163
|
-
};
|
|
164
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
165
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
declare const ollamaClientAdapter: ({ ollama, }: {
|
|
171
|
-
ollama: OpenAI;
|
|
172
|
-
}) => {
|
|
173
|
-
client: OpenAI;
|
|
174
|
-
requestHandlers: {
|
|
175
|
-
'^/v1/models$': {
|
|
176
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
177
|
-
};
|
|
178
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
179
|
-
post: (_url: string, options: any) => Promise<Response>;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
declare const openRouterClientAdapter: ({ openRouter, provider, }: {
|
|
185
|
-
openRouter: OpenRouter;
|
|
186
|
-
provider?: Record<string, unknown>;
|
|
187
|
-
}) => {
|
|
188
|
-
client: OpenRouter;
|
|
189
|
-
requestHandlers: {
|
|
190
|
-
'^/v1/models$': {
|
|
191
|
-
get: (_url: string, _options: any) => Promise<Response>;
|
|
192
|
-
};
|
|
193
|
-
'^/(?:v1|/?openai)/chat/completions$': {
|
|
194
|
-
post: (_url: string, options: {
|
|
195
|
-
body: string;
|
|
196
|
-
}) => Promise<Response>;
|
|
197
|
-
};
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
declare const completionsRunAdapter: () => {
|
|
202
|
-
handleRun: ({ client, run, onEvent, getMessages, }: {
|
|
203
|
-
client: OpenAI;
|
|
204
|
-
run: OpenAI.Beta.Threads.Run;
|
|
205
|
-
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
206
|
-
getMessages: () => Promise<MessageWithRun[]>;
|
|
207
|
-
}) => Promise<any>;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
type MethodHandlers$2 = {
|
|
211
|
-
get?: RequestHandler;
|
|
212
|
-
post?: RequestHandler;
|
|
213
|
-
};
|
|
214
|
-
declare const prismaStorageAdapter: ({ prisma, }: {
|
|
215
|
-
prisma: PrismaClient;
|
|
216
|
-
}) => ((args: StorageAdapterArgs) => {
|
|
217
|
-
requestHandlers: Record<string, MethodHandlers$2>;
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
type MethodHandlers$1 = {
|
|
221
|
-
get?: RequestHandler;
|
|
222
|
-
post?: RequestHandler;
|
|
223
|
-
};
|
|
224
|
-
type ResponsesStorageAdapterArgs = StorageAdapterArgs & {
|
|
225
|
-
runAdapter: RunAdapterWithAssistant;
|
|
226
|
-
};
|
|
227
|
-
declare const responsesStorageAdapter: () => ((args: ResponsesStorageAdapterArgs) => {
|
|
228
|
-
requestHandlers: Record<string, MethodHandlers$1>;
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
type MethodHandlers = {
|
|
232
|
-
get?: RequestHandler;
|
|
233
|
-
post?: RequestHandler;
|
|
234
|
-
};
|
|
235
|
-
type AzureResponsesStorageAdapterArgs = StorageAdapterArgs & {
|
|
236
|
-
runAdapter: RunAdapterWithAssistant;
|
|
237
|
-
originalClient?: any;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* Storage adapter for Azure's Responses API (conversations + responses endpoints).
|
|
241
|
-
*
|
|
242
|
-
* Use this with Azure AI Projects and azureAiProjectClientAdapter:
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* ```typescript
|
|
246
|
-
* const azureAiProject = new AIProjectClient(endpoint, credential)
|
|
247
|
-
*
|
|
248
|
-
* const client = supercompat({
|
|
249
|
-
* client: azureAiProjectClientAdapter({ azureAiProject }),
|
|
250
|
-
* storage: azureResponsesStorageAdapter(),
|
|
251
|
-
* runAdapter: responsesRunAdapter({ getOpenaiAssistant: () => assistant }),
|
|
252
|
-
* })
|
|
253
|
-
* ```
|
|
254
|
-
*/
|
|
255
|
-
declare const azureResponsesStorageAdapter: () => ((args: AzureResponsesStorageAdapterArgs) => {
|
|
256
|
-
requestHandlers: Record<string, MethodHandlers>;
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
type AzureAgentsStorageAdapterArgs = StorageAdapterArgs & {
|
|
260
|
-
runAdapter: RunAdapterWithAssistant;
|
|
261
|
-
};
|
|
262
|
-
declare const azureAgentsStorageAdapter: ({ azureAiProject, prisma, }: {
|
|
263
|
-
azureAiProject: AIProjectClient;
|
|
264
|
-
prisma: PrismaClient;
|
|
265
|
-
}) => ({ runAdapter }: AzureAgentsStorageAdapterArgs) => {
|
|
266
|
-
requestHandlers: {
|
|
267
|
-
'^/(?:v1|/?openai)/assistants$': {
|
|
268
|
-
post: RequestHandler;
|
|
269
|
-
};
|
|
270
|
-
'^/(?:v1|/?openai)/threads$': {
|
|
271
|
-
post: RequestHandler;
|
|
272
|
-
};
|
|
273
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/messages$": {
|
|
274
|
-
post: RequestHandler;
|
|
275
|
-
get: RequestHandler;
|
|
276
|
-
};
|
|
277
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs$": {
|
|
278
|
-
get: RequestHandler;
|
|
279
|
-
post: RequestHandler;
|
|
280
|
-
};
|
|
281
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)$": {
|
|
282
|
-
get: RequestHandler;
|
|
283
|
-
};
|
|
284
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)/steps$": {
|
|
285
|
-
get: RequestHandler;
|
|
286
|
-
};
|
|
287
|
-
"^/(?:v1|/?openai)/threads/([^/]+)/runs/([^/]+)/submit_tool_outputs$": {
|
|
288
|
-
post: RequestHandler;
|
|
289
|
-
};
|
|
290
|
-
"^/(?:v1|/?openai)/files/([^/]+)$": {
|
|
291
|
-
get: RequestHandler;
|
|
292
|
-
};
|
|
293
|
-
"^/(?:v1|/?openai)/files/([^/]+)/content$": {
|
|
294
|
-
get: RequestHandler;
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
type Args = {
|
|
300
|
-
select?: {
|
|
301
|
-
id?: boolean;
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
declare const responsesRunAdapter: ({ getOpenaiAssistant: getDirectOpenaiAssistant, waitUntil }: {
|
|
305
|
-
getOpenaiAssistant: (args?: Args) => Promise<OpenAI.Beta.Assistants.Assistant> | OpenAI.Beta.Assistants.Assistant | Pick<OpenAI.Beta.Assistants.Assistant, "id"> | Promise<Pick<OpenAI.Beta.Assistants.Assistant, "id">>;
|
|
306
|
-
waitUntil?: <T>(p: Promise<T>) => void | Promise<void>;
|
|
307
|
-
}) => {
|
|
308
|
-
handleRun: ({ client, threadId, response, onEvent, }: {
|
|
309
|
-
client: OpenAI;
|
|
310
|
-
threadId: string;
|
|
311
|
-
response: AsyncIterable<any>;
|
|
312
|
-
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
313
|
-
}) => Promise<void>;
|
|
314
|
-
getOpenaiAssistant: ({ select: { id } }?: Args) => Promise<OpenAI.Beta.Assistants.Assistant | {
|
|
315
|
-
id: string;
|
|
316
|
-
}>;
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
declare const azureAgentsRunAdapter: ({ azureAiProject, }: {
|
|
320
|
-
azureAiProject: AIProjectClient;
|
|
321
|
-
}) => {
|
|
322
|
-
handleRun: ({ threadId, assistantId, instructions, tools, onEvent, }: {
|
|
323
|
-
threadId: string;
|
|
324
|
-
assistantId: string;
|
|
325
|
-
instructions?: string;
|
|
326
|
-
tools?: any[];
|
|
327
|
-
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
328
|
-
}) => Promise<void>;
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
export { anthropicClientAdapter, azureAgentsRunAdapter, azureAgentsStorageAdapter, azureAiProjectClientAdapter, azureOpenaiClientAdapter, azureResponsesStorageAdapter, completionsRunAdapter, googleClientAdapter, groqClientAdapter, humirisClientAdapter, mistralClientAdapter, ollamaClientAdapter, openRouterClientAdapter, openaiClientAdapter, perplexityClientAdapter, prismaStorageAdapter, responsesRunAdapter, responsesStorageAdapter, togetherClientAdapter };
|
|
2
|
+
export { }
|