supercompat 1.3.0 → 1.5.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 +27 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +27 -13
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -7,9 +7,9 @@ import { MessageWithRun, StorageAdapterArgs } from './types/index.cjs';
|
|
|
7
7
|
import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
|
|
8
8
|
import * as openai_lib_AssistantStream from 'openai/lib/AssistantStream';
|
|
9
9
|
import * as openai_streaming from 'openai/streaming';
|
|
10
|
-
import * as
|
|
10
|
+
import * as openai_resources_beta_assistants from 'openai/resources/beta/assistants';
|
|
11
11
|
import * as openai_resources_beta_threads_runs_runs from 'openai/resources/beta/threads/runs/runs';
|
|
12
|
-
import * as
|
|
12
|
+
import * as openai_resources_beta_threads_messages from 'openai/resources/beta/threads/messages';
|
|
13
13
|
import * as openai_resources_beta_threads_threads from 'openai/resources/beta/threads/threads';
|
|
14
14
|
import * as openai_core from 'openai/core';
|
|
15
15
|
import { PrismaClient } from '@prisma/client';
|
|
@@ -47,11 +47,12 @@ declare const anthropicClientAdapter: ({ anthropic, }: {
|
|
|
47
47
|
declare const completionsRunAdapter: ({ messagesHistoryLength, maxTokens, }: {
|
|
48
48
|
messagesHistoryLength?: number | undefined;
|
|
49
49
|
maxTokens?: number | undefined;
|
|
50
|
-
}) => ({ client, run, onEvent, getMessages, }: {
|
|
50
|
+
}) => ({ client, run, onEvent, getMessages, responseFormat, }: {
|
|
51
51
|
client: OpenAI;
|
|
52
52
|
run: OpenAI.Beta.Threads.Run;
|
|
53
53
|
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
54
54
|
getMessages: () => Promise<MessageWithRun[]>;
|
|
55
|
+
responseFormat?: OpenAI.Beta.Threads.AssistantResponseFormatOption | null | undefined;
|
|
55
56
|
}) => Promise<any>;
|
|
56
57
|
|
|
57
58
|
declare const anthropicRunAdapter: ({ messagesHistoryLength, maxTokens, }: {
|
|
@@ -71,14 +72,14 @@ declare const prismaStorageAdapter: ({ prisma, }: {
|
|
|
71
72
|
threads: {
|
|
72
73
|
create: (options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_threads.Thread>>;
|
|
73
74
|
messages: {
|
|
74
|
-
list: (threadId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<
|
|
75
|
-
create: (threadId: string, body:
|
|
75
|
+
list: (threadId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<openai_resources_beta_threads_messages.MessagesPage, openai_resources_beta_threads_messages.Message>>;
|
|
76
|
+
create: (threadId: string, body: openai_resources_beta_threads_messages.MessageCreateParams, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_messages.Message>>;
|
|
76
77
|
};
|
|
77
78
|
runs: {
|
|
78
79
|
list: (threadId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<openai_resources_beta_threads_runs_runs.RunsPage, openai_resources_beta_threads_runs_runs.Run>>;
|
|
79
|
-
create: (threadId: string, body: openai_resources_beta_threads_runs_runs.RunCreateParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<
|
|
80
|
+
create: (threadId: string, body: openai_resources_beta_threads_runs_runs.RunCreateParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<openai_resources_beta_assistants.AssistantStreamEvent>>>;
|
|
80
81
|
createAndStream: (threadId: string, body: openai_lib_AssistantStream.RunCreateParamsBaseStream, options?: openai_core.RequestOptions<unknown> | undefined) => openai_lib_AssistantStream.AssistantStream;
|
|
81
|
-
submitToolOutputs: (threadId: string, runId: string, body: openai_resources_beta_threads_runs_runs.RunSubmitToolOutputsParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<
|
|
82
|
+
submitToolOutputs: (threadId: string, runId: string, body: openai_resources_beta_threads_runs_runs.RunSubmitToolOutputsParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<openai_resources_beta_assistants.AssistantStreamEvent>>>;
|
|
82
83
|
submitToolOutputsStream: (threadId: string, runId: string, body: openai_lib_AssistantStream.RunSubmitToolOutputsParamsStream, options?: openai_core.RequestOptions<unknown> | undefined) => openai_lib_AssistantStream.AssistantStream;
|
|
83
84
|
steps: {
|
|
84
85
|
list: (threadId: string, runId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<openai_resources_beta_threads_runs_steps.RunStepsPage, openai_resources_beta_threads_runs_steps.RunStep>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { MessageWithRun, StorageAdapterArgs } from './types/index.js';
|
|
|
7
7
|
import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
|
|
8
8
|
import * as openai_lib_AssistantStream from 'openai/lib/AssistantStream';
|
|
9
9
|
import * as openai_streaming from 'openai/streaming';
|
|
10
|
-
import * as
|
|
10
|
+
import * as openai_resources_beta_assistants from 'openai/resources/beta/assistants';
|
|
11
11
|
import * as openai_resources_beta_threads_runs_runs from 'openai/resources/beta/threads/runs/runs';
|
|
12
|
-
import * as
|
|
12
|
+
import * as openai_resources_beta_threads_messages from 'openai/resources/beta/threads/messages';
|
|
13
13
|
import * as openai_resources_beta_threads_threads from 'openai/resources/beta/threads/threads';
|
|
14
14
|
import * as openai_core from 'openai/core';
|
|
15
15
|
import { PrismaClient } from '@prisma/client';
|
|
@@ -47,11 +47,12 @@ declare const anthropicClientAdapter: ({ anthropic, }: {
|
|
|
47
47
|
declare const completionsRunAdapter: ({ messagesHistoryLength, maxTokens, }: {
|
|
48
48
|
messagesHistoryLength?: number | undefined;
|
|
49
49
|
maxTokens?: number | undefined;
|
|
50
|
-
}) => ({ client, run, onEvent, getMessages, }: {
|
|
50
|
+
}) => ({ client, run, onEvent, getMessages, responseFormat, }: {
|
|
51
51
|
client: OpenAI;
|
|
52
52
|
run: OpenAI.Beta.Threads.Run;
|
|
53
53
|
onEvent: (event: OpenAI.Beta.AssistantStreamEvent) => Promise<any>;
|
|
54
54
|
getMessages: () => Promise<MessageWithRun[]>;
|
|
55
|
+
responseFormat?: OpenAI.Beta.Threads.AssistantResponseFormatOption | null | undefined;
|
|
55
56
|
}) => Promise<any>;
|
|
56
57
|
|
|
57
58
|
declare const anthropicRunAdapter: ({ messagesHistoryLength, maxTokens, }: {
|
|
@@ -71,14 +72,14 @@ declare const prismaStorageAdapter: ({ prisma, }: {
|
|
|
71
72
|
threads: {
|
|
72
73
|
create: (options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_threads.Thread>>;
|
|
73
74
|
messages: {
|
|
74
|
-
list: (threadId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<
|
|
75
|
-
create: (threadId: string, body:
|
|
75
|
+
list: (threadId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<openai_resources_beta_threads_messages.MessagesPage, openai_resources_beta_threads_messages.Message>>;
|
|
76
|
+
create: (threadId: string, body: openai_resources_beta_threads_messages.MessageCreateParams, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_messages.Message>>;
|
|
76
77
|
};
|
|
77
78
|
runs: {
|
|
78
79
|
list: (threadId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<openai_resources_beta_threads_runs_runs.RunsPage, openai_resources_beta_threads_runs_runs.Run>>;
|
|
79
|
-
create: (threadId: string, body: openai_resources_beta_threads_runs_runs.RunCreateParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<
|
|
80
|
+
create: (threadId: string, body: openai_resources_beta_threads_runs_runs.RunCreateParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<openai_resources_beta_assistants.AssistantStreamEvent>>>;
|
|
80
81
|
createAndStream: (threadId: string, body: openai_lib_AssistantStream.RunCreateParamsBaseStream, options?: openai_core.RequestOptions<unknown> | undefined) => openai_lib_AssistantStream.AssistantStream;
|
|
81
|
-
submitToolOutputs: (threadId: string, runId: string, body: openai_resources_beta_threads_runs_runs.RunSubmitToolOutputsParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<
|
|
82
|
+
submitToolOutputs: (threadId: string, runId: string, body: openai_resources_beta_threads_runs_runs.RunSubmitToolOutputsParamsBase, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.APIPromise<openai_resources_beta_threads_runs_runs.Run | openai_streaming.Stream<openai_resources_beta_assistants.AssistantStreamEvent>>>;
|
|
82
83
|
submitToolOutputsStream: (threadId: string, runId: string, body: openai_lib_AssistantStream.RunSubmitToolOutputsParamsStream, options?: openai_core.RequestOptions<unknown> | undefined) => openai_lib_AssistantStream.AssistantStream;
|
|
83
84
|
steps: {
|
|
84
85
|
list: (threadId: string, runId: string, options?: openai_core.RequestOptions<unknown> | undefined) => Promise<openai_core.PagePromise<openai_resources_beta_threads_runs_steps.RunStepsPage, openai_resources_beta_threads_runs_steps.RunStep>>;
|
package/dist/index.js
CHANGED
|
@@ -590,11 +590,11 @@ var completionsRunAdapter = function(param) {
|
|
|
590
590
|
var _param_messagesHistoryLength = param.messagesHistoryLength, messagesHistoryLength = _param_messagesHistoryLength === void 0 ? 10 : _param_messagesHistoryLength, _param_maxTokens = param.maxTokens, maxTokens = _param_maxTokens === void 0 ? void 0 : _param_maxTokens;
|
|
591
591
|
return function() {
|
|
592
592
|
var _ref = _async_to_generator(function(param) {
|
|
593
|
-
var client, run, onEvent2, getMessages2, opts, _tmp, providerResponse, e, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, delta, _delta_content, err;
|
|
593
|
+
var client, run, onEvent2, getMessages2, responseFormat, opts, _tmp, providerResponse, e, message, toolCallsRunStep, currentContent, currentToolCalls, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, delta, _delta_content, err;
|
|
594
594
|
return _ts_generator(this, function(_state) {
|
|
595
595
|
switch(_state.label){
|
|
596
596
|
case 0:
|
|
597
|
-
client = param.client, run = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages;
|
|
597
|
+
client = param.client, run = param.run, onEvent2 = param.onEvent, getMessages2 = param.getMessages, responseFormat = param.responseFormat;
|
|
598
598
|
if (run.status !== "queued") return [
|
|
599
599
|
2
|
|
600
600
|
];
|
|
@@ -616,6 +616,9 @@ var completionsRunAdapter = function(param) {
|
|
|
616
616
|
case 1:
|
|
617
617
|
opts = _object_spread.apply(void 0, [
|
|
618
618
|
(_tmp.messages = _state.sent(), _tmp.model = run.model, _tmp.stream = true, _tmp),
|
|
619
|
+
responseFormat ? {
|
|
620
|
+
response_format: responseFormat
|
|
621
|
+
} : {},
|
|
619
622
|
maxTokens ? {
|
|
620
623
|
max_tokens: maxTokens
|
|
621
624
|
} : {},
|
|
@@ -675,7 +678,7 @@ var completionsRunAdapter = function(param) {
|
|
|
675
678
|
incomplete_at: null,
|
|
676
679
|
incomplete_details: null,
|
|
677
680
|
metadata: {},
|
|
678
|
-
|
|
681
|
+
attachments: [],
|
|
679
682
|
thread_id: run.thread_id,
|
|
680
683
|
content: [
|
|
681
684
|
{
|
|
@@ -1174,7 +1177,7 @@ var anthropicRunAdapter = function(param) {
|
|
|
1174
1177
|
incomplete_at: null,
|
|
1175
1178
|
incomplete_details: null,
|
|
1176
1179
|
metadata: {},
|
|
1177
|
-
|
|
1180
|
+
attachments: [],
|
|
1178
1181
|
thread_id: run.thread_id,
|
|
1179
1182
|
content: [
|
|
1180
1183
|
{
|
|
@@ -1453,7 +1456,9 @@ var serializeThread = function(param) {
|
|
|
1453
1456
|
id: thread.id,
|
|
1454
1457
|
object: "thread",
|
|
1455
1458
|
created_at: dayjs3(thread.createdAt).unix(),
|
|
1456
|
-
metadata: thread.metadata
|
|
1459
|
+
metadata: thread.metadata,
|
|
1460
|
+
// TODO
|
|
1461
|
+
tool_resources: null
|
|
1457
1462
|
};
|
|
1458
1463
|
};
|
|
1459
1464
|
// src/adapters/storage/prismaStorageAdapter/beta/threads/create.ts
|
|
@@ -1494,7 +1499,7 @@ var create = function(param) {
|
|
|
1494
1499
|
}
|
|
1495
1500
|
}
|
|
1496
1501
|
],
|
|
1497
|
-
|
|
1502
|
+
attachments: message.attachments,
|
|
1498
1503
|
metadata: message.metadata,
|
|
1499
1504
|
createdAt: dayjs4(initialCreatedAt).add(index, "seconds").toDate()
|
|
1500
1505
|
};
|
|
@@ -1535,7 +1540,7 @@ var serializeMessage3 = function(param) {
|
|
|
1535
1540
|
content: message.content,
|
|
1536
1541
|
assistant_id: message.assistantId,
|
|
1537
1542
|
run_id: message.runId,
|
|
1538
|
-
|
|
1543
|
+
attachments: message.attachments,
|
|
1539
1544
|
status: message.status.toLowerCase(),
|
|
1540
1545
|
metadata: assign2((_message_metadata = message.metadata) !== null && _message_metadata !== void 0 ? _message_metadata : {}, message.toolCalls ? {
|
|
1541
1546
|
toolCalls: message.toolCalls
|
|
@@ -1687,11 +1692,19 @@ var serializeRun = function(param) {
|
|
|
1687
1692
|
completed_at: run.completedAt ? dayjs6(run.completedAt).unix() : null,
|
|
1688
1693
|
model: run.model,
|
|
1689
1694
|
instructions: run.instructions,
|
|
1690
|
-
// @ts-ignore-next-line
|
|
1691
1695
|
tools: run.tools,
|
|
1692
|
-
file_ids: run.fileIds,
|
|
1693
1696
|
metadata: run.metadata,
|
|
1694
|
-
usage: run.usage
|
|
1697
|
+
usage: run.usage,
|
|
1698
|
+
// TODO
|
|
1699
|
+
incomplete_details: null,
|
|
1700
|
+
max_completion_tokens: null,
|
|
1701
|
+
max_prompt_tokens: null,
|
|
1702
|
+
response_format: "auto",
|
|
1703
|
+
tool_choice: "auto",
|
|
1704
|
+
truncation_strategy: {
|
|
1705
|
+
type: "auto",
|
|
1706
|
+
last_messages: null
|
|
1707
|
+
}
|
|
1695
1708
|
};
|
|
1696
1709
|
};
|
|
1697
1710
|
// src/adapters/storage/prismaStorageAdapter/beta/threads/runs/list.ts
|
|
@@ -2187,7 +2200,7 @@ var createAndStream = function(param) {
|
|
|
2187
2200
|
start: function start(controller) {
|
|
2188
2201
|
return _async_to_generator(function() {
|
|
2189
2202
|
var threadId, assistant_id, assistant, _assign6, model, instructions, // additional_instructions,
|
|
2190
|
-
tools, metadata, run, data;
|
|
2203
|
+
tools, metadata, response_format, run, data;
|
|
2191
2204
|
return _ts_generator(this, function(_state) {
|
|
2192
2205
|
switch(_state.label){
|
|
2193
2206
|
case 0:
|
|
@@ -2210,7 +2223,7 @@ var createAndStream = function(param) {
|
|
|
2210
2223
|
model: assistant.modelSlug,
|
|
2211
2224
|
instructions: "",
|
|
2212
2225
|
additional_instructions: null
|
|
2213
|
-
}, args[1]), model = _assign6.model, instructions = _assign6.instructions, tools = _assign6.tools, metadata = _assign6.metadata;
|
|
2226
|
+
}, args[1]), model = _assign6.model, instructions = _assign6.instructions, tools = _assign6.tools, metadata = _assign6.metadata, response_format = _assign6.response_format;
|
|
2214
2227
|
return [
|
|
2215
2228
|
4,
|
|
2216
2229
|
prisma.run.create({
|
|
@@ -2258,7 +2271,8 @@ var createAndStream = function(param) {
|
|
|
2258
2271
|
getMessages: getMessages({
|
|
2259
2272
|
prisma: prisma,
|
|
2260
2273
|
run: run
|
|
2261
|
-
})
|
|
2274
|
+
}),
|
|
2275
|
+
responseFormat: response_format
|
|
2262
2276
|
})
|
|
2263
2277
|
];
|
|
2264
2278
|
case 3:
|