@narrative.io/data-collaboration-sdk-ts 0.0.82 → 0.0.83
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/build/index.d.ts +2 -2
- package/build/index.js +2 -2
- package/build/rosetta/types.d.ts +158 -117
- package/build/rosetta/types.js +9 -16
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -25,9 +25,9 @@ import { convertNqlObjectToForecastBody } from './nql/DataRulesConverter';
|
|
|
25
25
|
import { AuthenticationApi, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse } from './authentication';
|
|
26
26
|
import { AppsApi, type App } from './apps';
|
|
27
27
|
import type { ForecastBody } from './nql/types';
|
|
28
|
-
import { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOtMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, isConversationMessageFunctionCall } from './rosetta/types';
|
|
28
|
+
import { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOtMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, isConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, isConversationAssistantMessageWithFunctionCall } from './rosetta/types';
|
|
29
29
|
declare class NarrativeApi extends BaseApi {
|
|
30
30
|
}
|
|
31
31
|
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi {
|
|
32
32
|
}
|
|
33
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, type App, type Resource, type UploadsResponse, type PingStatus, type Attribute, type RefAttribute, type SubAttribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOtMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall };
|
|
33
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, type App, type Resource, type UploadsResponse, type PingStatus, type Attribute, type RefAttribute, type SubAttribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOtMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall };
|
package/build/index.js
CHANGED
|
@@ -18,8 +18,8 @@ import { getNqlObject, buildNql } from './nql/NQLParser';
|
|
|
18
18
|
import { convertNqlObjectToForecastBody } from './nql/DataRulesConverter';
|
|
19
19
|
import { AuthenticationApi } from './authentication';
|
|
20
20
|
import { AppsApi } from './apps';
|
|
21
|
-
import { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall } from './rosetta/types';
|
|
21
|
+
import { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall } from './rosetta/types';
|
|
22
22
|
class NarrativeApi extends BaseApi {
|
|
23
23
|
}
|
|
24
24
|
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi]);
|
|
25
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall };
|
|
25
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall };
|
package/build/rosetta/types.d.ts
CHANGED
|
@@ -6,24 +6,24 @@ declare const ChatCompletionRequestMessageName: z.ZodEffects<z.ZodString, string
|
|
|
6
6
|
type ConversationMessageName = z.infer<typeof ChatCompletionRequestMessageName>;
|
|
7
7
|
declare const isConversationMessageName: (input: unknown) => input is string;
|
|
8
8
|
declare const ChatCompletionRequestUserMessageSchema: z.ZodObject<{
|
|
9
|
-
role: z.
|
|
9
|
+
role: z.ZodEnum<["user"]>;
|
|
10
10
|
content: z.ZodString;
|
|
11
11
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
12
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
role: "
|
|
14
|
+
role: "user";
|
|
15
15
|
content: string;
|
|
16
16
|
name?: string | undefined;
|
|
17
17
|
timestamp?: number | undefined;
|
|
18
18
|
}, {
|
|
19
|
-
role: "
|
|
19
|
+
role: "user";
|
|
20
20
|
content: string;
|
|
21
21
|
name?: string | undefined;
|
|
22
22
|
timestamp?: number | undefined;
|
|
23
23
|
}>;
|
|
24
24
|
type ConversationUserMessage = z.infer<typeof ChatCompletionRequestUserMessageSchema>;
|
|
25
25
|
declare const isConversationUserMessage: (input: unknown) => input is {
|
|
26
|
-
role: "
|
|
26
|
+
role: "user";
|
|
27
27
|
content: string;
|
|
28
28
|
name?: string | undefined;
|
|
29
29
|
timestamp?: number | undefined;
|
|
@@ -43,20 +43,61 @@ declare const isConversationMessageFunctionCall: (input: unknown) => input is {
|
|
|
43
43
|
name: string;
|
|
44
44
|
arguments: string;
|
|
45
45
|
};
|
|
46
|
+
declare const ChatCompletionRequestAssistantMessageWithFunctionCall: z.ZodObject<{
|
|
47
|
+
role: z.ZodEnum<["assistant"]>;
|
|
48
|
+
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
49
|
+
function_call: z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
arguments: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
name: string;
|
|
54
|
+
arguments: string;
|
|
55
|
+
}, {
|
|
56
|
+
name: string;
|
|
57
|
+
arguments: string;
|
|
58
|
+
}>;
|
|
59
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
role: "assistant";
|
|
62
|
+
content: string | null;
|
|
63
|
+
function_call: {
|
|
64
|
+
name: string;
|
|
65
|
+
arguments: string;
|
|
66
|
+
};
|
|
67
|
+
timestamp?: number | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
role: "assistant";
|
|
70
|
+
content: string | null;
|
|
71
|
+
function_call: {
|
|
72
|
+
name: string;
|
|
73
|
+
arguments: string;
|
|
74
|
+
};
|
|
75
|
+
timestamp?: number | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
type ConversationAssistantMessageWithFunctionCall = z.infer<typeof ChatCompletionRequestAssistantMessageWithFunctionCall>;
|
|
78
|
+
declare const isConversationAssistantMessageWithFunctionCall: (input: unknown) => input is {
|
|
79
|
+
role: "assistant";
|
|
80
|
+
content: string | null;
|
|
81
|
+
function_call: {
|
|
82
|
+
name: string;
|
|
83
|
+
arguments: string;
|
|
84
|
+
};
|
|
85
|
+
timestamp?: number | undefined;
|
|
86
|
+
};
|
|
46
87
|
declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
47
|
-
role: z.
|
|
88
|
+
role: z.ZodEnum<["assistant"]>;
|
|
48
89
|
content: z.ZodString;
|
|
49
90
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
50
91
|
}, "strict", z.ZodTypeAny, {
|
|
51
|
-
role: "
|
|
92
|
+
role: "assistant";
|
|
52
93
|
content: string;
|
|
53
94
|
timestamp?: number | undefined;
|
|
54
95
|
}, {
|
|
55
|
-
role: "
|
|
96
|
+
role: "assistant";
|
|
56
97
|
content: string;
|
|
57
98
|
timestamp?: number | undefined;
|
|
58
99
|
}>, z.ZodObject<{
|
|
59
|
-
role: z.
|
|
100
|
+
role: z.ZodEnum<["assistant"]>;
|
|
60
101
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
61
102
|
function_call: z.ZodObject<{
|
|
62
103
|
name: z.ZodString;
|
|
@@ -70,7 +111,7 @@ declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
|
70
111
|
}>;
|
|
71
112
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
72
113
|
}, "strict", z.ZodTypeAny, {
|
|
73
|
-
role: "
|
|
114
|
+
role: "assistant";
|
|
74
115
|
content: string | null;
|
|
75
116
|
function_call: {
|
|
76
117
|
name: string;
|
|
@@ -78,7 +119,7 @@ declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
|
78
119
|
};
|
|
79
120
|
timestamp?: number | undefined;
|
|
80
121
|
}, {
|
|
81
|
-
role: "
|
|
122
|
+
role: "assistant";
|
|
82
123
|
content: string | null;
|
|
83
124
|
function_call: {
|
|
84
125
|
name: string;
|
|
@@ -88,7 +129,7 @@ declare const ChatCompletionAssistantMessage: z.ZodUnion<[z.ZodObject<{
|
|
|
88
129
|
}>]>;
|
|
89
130
|
type ConversationAssistantMessage = z.infer<typeof ChatCompletionAssistantMessage>;
|
|
90
131
|
declare const isConversationAssistantMessage: (input: unknown) => input is {
|
|
91
|
-
role: "
|
|
132
|
+
role: "assistant";
|
|
92
133
|
content: string | null;
|
|
93
134
|
function_call: {
|
|
94
135
|
name: string;
|
|
@@ -96,73 +137,73 @@ declare const isConversationAssistantMessage: (input: unknown) => input is {
|
|
|
96
137
|
};
|
|
97
138
|
timestamp?: number | undefined;
|
|
98
139
|
} | {
|
|
99
|
-
role: "
|
|
140
|
+
role: "assistant";
|
|
100
141
|
content: string;
|
|
101
142
|
timestamp?: number | undefined;
|
|
102
143
|
};
|
|
103
144
|
declare const ChatCompletionSystemMessageSchema: z.ZodObject<{
|
|
104
|
-
role: z.
|
|
145
|
+
role: z.ZodEnum<["system"]>;
|
|
105
146
|
content: z.ZodString;
|
|
106
147
|
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
role: "
|
|
148
|
+
role: "system";
|
|
108
149
|
content: string;
|
|
109
150
|
}, {
|
|
110
|
-
role: "
|
|
151
|
+
role: "system";
|
|
111
152
|
content: string;
|
|
112
153
|
}>;
|
|
113
154
|
type ConversationSystemMessage = z.infer<typeof ChatCompletionSystemMessageSchema>;
|
|
114
155
|
declare const isConversationSystemMessage: (input: unknown) => input is {
|
|
115
|
-
role: "
|
|
156
|
+
role: "system";
|
|
116
157
|
content: string;
|
|
117
158
|
};
|
|
118
159
|
declare const ChatCompletionFunctionMessageSchema: z.ZodObject<{
|
|
119
|
-
role: z.
|
|
160
|
+
role: z.ZodEnum<["function"]>;
|
|
120
161
|
content: z.ZodString;
|
|
121
162
|
name: z.ZodString;
|
|
122
163
|
}, "strip", z.ZodTypeAny, {
|
|
123
164
|
name: string;
|
|
124
|
-
role: "function"
|
|
165
|
+
role: "function";
|
|
125
166
|
content: string;
|
|
126
167
|
}, {
|
|
127
168
|
name: string;
|
|
128
|
-
role: "function"
|
|
169
|
+
role: "function";
|
|
129
170
|
content: string;
|
|
130
171
|
}>;
|
|
131
172
|
type ConversationFunctionMessage = z.infer<typeof ChatCompletionFunctionMessageSchema>;
|
|
132
173
|
declare const isConversationFunctionMessage: (input: unknown) => input is {
|
|
133
174
|
name: string;
|
|
134
|
-
role: "function"
|
|
175
|
+
role: "function";
|
|
135
176
|
content: string;
|
|
136
177
|
};
|
|
137
178
|
declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
138
|
-
role: z.
|
|
179
|
+
role: z.ZodEnum<["user"]>;
|
|
139
180
|
content: z.ZodString;
|
|
140
181
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
141
182
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
142
183
|
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
role: "
|
|
184
|
+
role: "user";
|
|
144
185
|
content: string;
|
|
145
186
|
name?: string | undefined;
|
|
146
187
|
timestamp?: number | undefined;
|
|
147
188
|
}, {
|
|
148
|
-
role: "
|
|
189
|
+
role: "user";
|
|
149
190
|
content: string;
|
|
150
191
|
name?: string | undefined;
|
|
151
192
|
timestamp?: number | undefined;
|
|
152
193
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
153
|
-
role: z.
|
|
194
|
+
role: z.ZodEnum<["assistant"]>;
|
|
154
195
|
content: z.ZodString;
|
|
155
196
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
156
197
|
}, "strict", z.ZodTypeAny, {
|
|
157
|
-
role: "
|
|
198
|
+
role: "assistant";
|
|
158
199
|
content: string;
|
|
159
200
|
timestamp?: number | undefined;
|
|
160
201
|
}, {
|
|
161
|
-
role: "
|
|
202
|
+
role: "assistant";
|
|
162
203
|
content: string;
|
|
163
204
|
timestamp?: number | undefined;
|
|
164
205
|
}>, z.ZodObject<{
|
|
165
|
-
role: z.
|
|
206
|
+
role: z.ZodEnum<["assistant"]>;
|
|
166
207
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
167
208
|
function_call: z.ZodObject<{
|
|
168
209
|
name: z.ZodString;
|
|
@@ -176,7 +217,7 @@ declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
176
217
|
}>;
|
|
177
218
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
178
219
|
}, "strict", z.ZodTypeAny, {
|
|
179
|
-
role: "
|
|
220
|
+
role: "assistant";
|
|
180
221
|
content: string | null;
|
|
181
222
|
function_call: {
|
|
182
223
|
name: string;
|
|
@@ -184,7 +225,7 @@ declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
184
225
|
};
|
|
185
226
|
timestamp?: number | undefined;
|
|
186
227
|
}, {
|
|
187
|
-
role: "
|
|
228
|
+
role: "assistant";
|
|
188
229
|
content: string | null;
|
|
189
230
|
function_call: {
|
|
190
231
|
name: string;
|
|
@@ -192,35 +233,35 @@ declare const ChatCompletionRequestMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
192
233
|
};
|
|
193
234
|
timestamp?: number | undefined;
|
|
194
235
|
}>]>, z.ZodObject<{
|
|
195
|
-
role: z.
|
|
236
|
+
role: z.ZodEnum<["system"]>;
|
|
196
237
|
content: z.ZodString;
|
|
197
238
|
}, "strip", z.ZodTypeAny, {
|
|
198
|
-
role: "
|
|
239
|
+
role: "system";
|
|
199
240
|
content: string;
|
|
200
241
|
}, {
|
|
201
|
-
role: "
|
|
242
|
+
role: "system";
|
|
202
243
|
content: string;
|
|
203
244
|
}>, z.ZodObject<{
|
|
204
|
-
role: z.
|
|
245
|
+
role: z.ZodEnum<["function"]>;
|
|
205
246
|
content: z.ZodString;
|
|
206
247
|
name: z.ZodString;
|
|
207
248
|
}, "strip", z.ZodTypeAny, {
|
|
208
249
|
name: string;
|
|
209
|
-
role: "function"
|
|
250
|
+
role: "function";
|
|
210
251
|
content: string;
|
|
211
252
|
}, {
|
|
212
253
|
name: string;
|
|
213
|
-
role: "function"
|
|
254
|
+
role: "function";
|
|
214
255
|
content: string;
|
|
215
256
|
}>]>;
|
|
216
257
|
type ConversationMessage = z.infer<typeof ChatCompletionRequestMessageSchema>;
|
|
217
258
|
declare const isConversationMessage: (input: unknown) => input is {
|
|
218
|
-
role: "
|
|
259
|
+
role: "user";
|
|
219
260
|
content: string;
|
|
220
261
|
name?: string | undefined;
|
|
221
262
|
timestamp?: number | undefined;
|
|
222
263
|
} | {
|
|
223
|
-
role: "
|
|
264
|
+
role: "assistant";
|
|
224
265
|
content: string | null;
|
|
225
266
|
function_call: {
|
|
226
267
|
name: string;
|
|
@@ -228,46 +269,46 @@ declare const isConversationMessage: (input: unknown) => input is {
|
|
|
228
269
|
};
|
|
229
270
|
timestamp?: number | undefined;
|
|
230
271
|
} | {
|
|
231
|
-
role: "
|
|
272
|
+
role: "assistant";
|
|
232
273
|
content: string;
|
|
233
274
|
timestamp?: number | undefined;
|
|
234
275
|
} | {
|
|
235
|
-
role: "
|
|
276
|
+
role: "system";
|
|
236
277
|
content: string;
|
|
237
278
|
} | {
|
|
238
279
|
name: string;
|
|
239
|
-
role: "function"
|
|
280
|
+
role: "function";
|
|
240
281
|
content: string;
|
|
241
282
|
};
|
|
242
283
|
declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
243
|
-
role: z.
|
|
284
|
+
role: z.ZodEnum<["user"]>;
|
|
244
285
|
content: z.ZodString;
|
|
245
286
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
246
287
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
247
288
|
}, "strip", z.ZodTypeAny, {
|
|
248
|
-
role: "
|
|
289
|
+
role: "user";
|
|
249
290
|
content: string;
|
|
250
291
|
name?: string | undefined;
|
|
251
292
|
timestamp?: number | undefined;
|
|
252
293
|
}, {
|
|
253
|
-
role: "
|
|
294
|
+
role: "user";
|
|
254
295
|
content: string;
|
|
255
296
|
name?: string | undefined;
|
|
256
297
|
timestamp?: number | undefined;
|
|
257
298
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
258
|
-
role: z.
|
|
299
|
+
role: z.ZodEnum<["assistant"]>;
|
|
259
300
|
content: z.ZodString;
|
|
260
301
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
261
302
|
}, "strict", z.ZodTypeAny, {
|
|
262
|
-
role: "
|
|
303
|
+
role: "assistant";
|
|
263
304
|
content: string;
|
|
264
305
|
timestamp?: number | undefined;
|
|
265
306
|
}, {
|
|
266
|
-
role: "
|
|
307
|
+
role: "assistant";
|
|
267
308
|
content: string;
|
|
268
309
|
timestamp?: number | undefined;
|
|
269
310
|
}>, z.ZodObject<{
|
|
270
|
-
role: z.
|
|
311
|
+
role: z.ZodEnum<["assistant"]>;
|
|
271
312
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
272
313
|
function_call: z.ZodObject<{
|
|
273
314
|
name: z.ZodString;
|
|
@@ -281,7 +322,7 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
281
322
|
}>;
|
|
282
323
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
283
324
|
}, "strict", z.ZodTypeAny, {
|
|
284
|
-
role: "
|
|
325
|
+
role: "assistant";
|
|
285
326
|
content: string | null;
|
|
286
327
|
function_call: {
|
|
287
328
|
name: string;
|
|
@@ -289,7 +330,7 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
289
330
|
};
|
|
290
331
|
timestamp?: number | undefined;
|
|
291
332
|
}, {
|
|
292
|
-
role: "
|
|
333
|
+
role: "assistant";
|
|
293
334
|
content: string | null;
|
|
294
335
|
function_call: {
|
|
295
336
|
name: string;
|
|
@@ -297,33 +338,33 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
297
338
|
};
|
|
298
339
|
timestamp?: number | undefined;
|
|
299
340
|
}>]>, z.ZodObject<{
|
|
300
|
-
role: z.
|
|
341
|
+
role: z.ZodEnum<["system"]>;
|
|
301
342
|
content: z.ZodString;
|
|
302
343
|
}, "strip", z.ZodTypeAny, {
|
|
303
|
-
role: "
|
|
344
|
+
role: "system";
|
|
304
345
|
content: string;
|
|
305
346
|
}, {
|
|
306
|
-
role: "
|
|
347
|
+
role: "system";
|
|
307
348
|
content: string;
|
|
308
349
|
}>, z.ZodObject<{
|
|
309
|
-
role: z.
|
|
350
|
+
role: z.ZodEnum<["function"]>;
|
|
310
351
|
content: z.ZodString;
|
|
311
352
|
name: z.ZodString;
|
|
312
353
|
}, "strip", z.ZodTypeAny, {
|
|
313
354
|
name: string;
|
|
314
|
-
role: "function"
|
|
355
|
+
role: "function";
|
|
315
356
|
content: string;
|
|
316
357
|
}, {
|
|
317
358
|
name: string;
|
|
318
|
-
role: "function"
|
|
359
|
+
role: "function";
|
|
319
360
|
content: string;
|
|
320
361
|
}>]>, "many">, ({
|
|
321
|
-
role: "
|
|
362
|
+
role: "user";
|
|
322
363
|
content: string;
|
|
323
364
|
name?: string | undefined;
|
|
324
365
|
timestamp?: number | undefined;
|
|
325
366
|
} | {
|
|
326
|
-
role: "
|
|
367
|
+
role: "assistant";
|
|
327
368
|
content: string | null;
|
|
328
369
|
function_call: {
|
|
329
370
|
name: string;
|
|
@@ -331,23 +372,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
331
372
|
};
|
|
332
373
|
timestamp?: number | undefined;
|
|
333
374
|
} | {
|
|
334
|
-
role: "
|
|
375
|
+
role: "assistant";
|
|
335
376
|
content: string;
|
|
336
377
|
timestamp?: number | undefined;
|
|
337
378
|
} | {
|
|
338
|
-
role: "
|
|
379
|
+
role: "system";
|
|
339
380
|
content: string;
|
|
340
381
|
} | {
|
|
341
382
|
name: string;
|
|
342
|
-
role: "function"
|
|
383
|
+
role: "function";
|
|
343
384
|
content: string;
|
|
344
385
|
})[], ({
|
|
345
|
-
role: "
|
|
386
|
+
role: "user";
|
|
346
387
|
content: string;
|
|
347
388
|
name?: string | undefined;
|
|
348
389
|
timestamp?: number | undefined;
|
|
349
390
|
} | {
|
|
350
|
-
role: "
|
|
391
|
+
role: "assistant";
|
|
351
392
|
content: string | null;
|
|
352
393
|
function_call: {
|
|
353
394
|
name: string;
|
|
@@ -355,23 +396,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
355
396
|
};
|
|
356
397
|
timestamp?: number | undefined;
|
|
357
398
|
} | {
|
|
358
|
-
role: "
|
|
399
|
+
role: "assistant";
|
|
359
400
|
content: string;
|
|
360
401
|
timestamp?: number | undefined;
|
|
361
402
|
} | {
|
|
362
|
-
role: "
|
|
403
|
+
role: "system";
|
|
363
404
|
content: string;
|
|
364
405
|
} | {
|
|
365
406
|
name: string;
|
|
366
|
-
role: "function"
|
|
407
|
+
role: "function";
|
|
367
408
|
content: string;
|
|
368
409
|
})[]>, ({
|
|
369
|
-
role: "
|
|
410
|
+
role: "user";
|
|
370
411
|
content: string;
|
|
371
412
|
name?: string | undefined;
|
|
372
413
|
timestamp?: number | undefined;
|
|
373
414
|
} | {
|
|
374
|
-
role: "
|
|
415
|
+
role: "assistant";
|
|
375
416
|
content: string | null;
|
|
376
417
|
function_call: {
|
|
377
418
|
name: string;
|
|
@@ -379,23 +420,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
379
420
|
};
|
|
380
421
|
timestamp?: number | undefined;
|
|
381
422
|
} | {
|
|
382
|
-
role: "
|
|
423
|
+
role: "assistant";
|
|
383
424
|
content: string;
|
|
384
425
|
timestamp?: number | undefined;
|
|
385
426
|
} | {
|
|
386
|
-
role: "
|
|
427
|
+
role: "system";
|
|
387
428
|
content: string;
|
|
388
429
|
} | {
|
|
389
430
|
name: string;
|
|
390
|
-
role: "function"
|
|
431
|
+
role: "function";
|
|
391
432
|
content: string;
|
|
392
433
|
})[], ({
|
|
393
|
-
role: "
|
|
434
|
+
role: "user";
|
|
394
435
|
content: string;
|
|
395
436
|
name?: string | undefined;
|
|
396
437
|
timestamp?: number | undefined;
|
|
397
438
|
} | {
|
|
398
|
-
role: "
|
|
439
|
+
role: "assistant";
|
|
399
440
|
content: string | null;
|
|
400
441
|
function_call: {
|
|
401
442
|
name: string;
|
|
@@ -403,23 +444,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
403
444
|
};
|
|
404
445
|
timestamp?: number | undefined;
|
|
405
446
|
} | {
|
|
406
|
-
role: "
|
|
447
|
+
role: "assistant";
|
|
407
448
|
content: string;
|
|
408
449
|
timestamp?: number | undefined;
|
|
409
450
|
} | {
|
|
410
|
-
role: "
|
|
451
|
+
role: "system";
|
|
411
452
|
content: string;
|
|
412
453
|
} | {
|
|
413
454
|
name: string;
|
|
414
|
-
role: "function"
|
|
455
|
+
role: "function";
|
|
415
456
|
content: string;
|
|
416
457
|
})[]>, ({
|
|
417
|
-
role: "
|
|
458
|
+
role: "user";
|
|
418
459
|
content: string;
|
|
419
460
|
name?: string | undefined;
|
|
420
461
|
timestamp?: number | undefined;
|
|
421
462
|
} | {
|
|
422
|
-
role: "
|
|
463
|
+
role: "assistant";
|
|
423
464
|
content: string | null;
|
|
424
465
|
function_call: {
|
|
425
466
|
name: string;
|
|
@@ -427,23 +468,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
427
468
|
};
|
|
428
469
|
timestamp?: number | undefined;
|
|
429
470
|
} | {
|
|
430
|
-
role: "
|
|
471
|
+
role: "assistant";
|
|
431
472
|
content: string;
|
|
432
473
|
timestamp?: number | undefined;
|
|
433
474
|
} | {
|
|
434
|
-
role: "
|
|
475
|
+
role: "system";
|
|
435
476
|
content: string;
|
|
436
477
|
} | {
|
|
437
478
|
name: string;
|
|
438
|
-
role: "function"
|
|
479
|
+
role: "function";
|
|
439
480
|
content: string;
|
|
440
481
|
})[], ({
|
|
441
|
-
role: "
|
|
482
|
+
role: "user";
|
|
442
483
|
content: string;
|
|
443
484
|
name?: string | undefined;
|
|
444
485
|
timestamp?: number | undefined;
|
|
445
486
|
} | {
|
|
446
|
-
role: "
|
|
487
|
+
role: "assistant";
|
|
447
488
|
content: string | null;
|
|
448
489
|
function_call: {
|
|
449
490
|
name: string;
|
|
@@ -451,23 +492,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
451
492
|
};
|
|
452
493
|
timestamp?: number | undefined;
|
|
453
494
|
} | {
|
|
454
|
-
role: "
|
|
495
|
+
role: "assistant";
|
|
455
496
|
content: string;
|
|
456
497
|
timestamp?: number | undefined;
|
|
457
498
|
} | {
|
|
458
|
-
role: "
|
|
499
|
+
role: "system";
|
|
459
500
|
content: string;
|
|
460
501
|
} | {
|
|
461
502
|
name: string;
|
|
462
|
-
role: "function"
|
|
503
|
+
role: "function";
|
|
463
504
|
content: string;
|
|
464
505
|
})[]>, ({
|
|
465
|
-
role: "
|
|
506
|
+
role: "user";
|
|
466
507
|
content: string;
|
|
467
508
|
name?: string | undefined;
|
|
468
509
|
timestamp?: number | undefined;
|
|
469
510
|
} | {
|
|
470
|
-
role: "
|
|
511
|
+
role: "assistant";
|
|
471
512
|
content: string | null;
|
|
472
513
|
function_call: {
|
|
473
514
|
name: string;
|
|
@@ -475,23 +516,23 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
475
516
|
};
|
|
476
517
|
timestamp?: number | undefined;
|
|
477
518
|
} | {
|
|
478
|
-
role: "
|
|
519
|
+
role: "assistant";
|
|
479
520
|
content: string;
|
|
480
521
|
timestamp?: number | undefined;
|
|
481
522
|
} | {
|
|
482
|
-
role: "
|
|
523
|
+
role: "system";
|
|
483
524
|
content: string;
|
|
484
525
|
} | {
|
|
485
526
|
name: string;
|
|
486
|
-
role: "function"
|
|
527
|
+
role: "function";
|
|
487
528
|
content: string;
|
|
488
529
|
})[], ({
|
|
489
|
-
role: "
|
|
530
|
+
role: "user";
|
|
490
531
|
content: string;
|
|
491
532
|
name?: string | undefined;
|
|
492
533
|
timestamp?: number | undefined;
|
|
493
534
|
} | {
|
|
494
|
-
role: "
|
|
535
|
+
role: "assistant";
|
|
495
536
|
content: string | null;
|
|
496
537
|
function_call: {
|
|
497
538
|
name: string;
|
|
@@ -499,25 +540,25 @@ declare const ChatCompletionRequestMessagesSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
499
540
|
};
|
|
500
541
|
timestamp?: number | undefined;
|
|
501
542
|
} | {
|
|
502
|
-
role: "
|
|
543
|
+
role: "assistant";
|
|
503
544
|
content: string;
|
|
504
545
|
timestamp?: number | undefined;
|
|
505
546
|
} | {
|
|
506
|
-
role: "
|
|
547
|
+
role: "system";
|
|
507
548
|
content: string;
|
|
508
549
|
} | {
|
|
509
550
|
name: string;
|
|
510
|
-
role: "function"
|
|
551
|
+
role: "function";
|
|
511
552
|
content: string;
|
|
512
553
|
})[]>;
|
|
513
554
|
type ConversationMessages = z.infer<typeof ChatCompletionRequestMessagesSchema>;
|
|
514
555
|
declare const isConversationMessages: (input: unknown) => input is ({
|
|
515
|
-
role: "
|
|
556
|
+
role: "user";
|
|
516
557
|
content: string;
|
|
517
558
|
name?: string | undefined;
|
|
518
559
|
timestamp?: number | undefined;
|
|
519
560
|
} | {
|
|
520
|
-
role: "
|
|
561
|
+
role: "assistant";
|
|
521
562
|
content: string | null;
|
|
522
563
|
function_call: {
|
|
523
564
|
name: string;
|
|
@@ -525,46 +566,46 @@ declare const isConversationMessages: (input: unknown) => input is ({
|
|
|
525
566
|
};
|
|
526
567
|
timestamp?: number | undefined;
|
|
527
568
|
} | {
|
|
528
|
-
role: "
|
|
569
|
+
role: "assistant";
|
|
529
570
|
content: string;
|
|
530
571
|
timestamp?: number | undefined;
|
|
531
572
|
} | {
|
|
532
|
-
role: "
|
|
573
|
+
role: "system";
|
|
533
574
|
content: string;
|
|
534
575
|
} | {
|
|
535
576
|
name: string;
|
|
536
|
-
role: "function"
|
|
577
|
+
role: "function";
|
|
537
578
|
content: string;
|
|
538
579
|
})[];
|
|
539
580
|
declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
540
|
-
role: z.
|
|
581
|
+
role: z.ZodEnum<["user"]>;
|
|
541
582
|
content: z.ZodString;
|
|
542
583
|
name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
543
584
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
544
585
|
}, "strip", z.ZodTypeAny, {
|
|
545
|
-
role: "
|
|
586
|
+
role: "user";
|
|
546
587
|
content: string;
|
|
547
588
|
name?: string | undefined;
|
|
548
589
|
timestamp?: number | undefined;
|
|
549
590
|
}, {
|
|
550
|
-
role: "
|
|
591
|
+
role: "user";
|
|
551
592
|
content: string;
|
|
552
593
|
name?: string | undefined;
|
|
553
594
|
timestamp?: number | undefined;
|
|
554
595
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
555
|
-
role: z.
|
|
596
|
+
role: z.ZodEnum<["assistant"]>;
|
|
556
597
|
content: z.ZodString;
|
|
557
598
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
558
599
|
}, "strict", z.ZodTypeAny, {
|
|
559
|
-
role: "
|
|
600
|
+
role: "assistant";
|
|
560
601
|
content: string;
|
|
561
602
|
timestamp?: number | undefined;
|
|
562
603
|
}, {
|
|
563
|
-
role: "
|
|
604
|
+
role: "assistant";
|
|
564
605
|
content: string;
|
|
565
606
|
timestamp?: number | undefined;
|
|
566
607
|
}>, z.ZodObject<{
|
|
567
|
-
role: z.
|
|
608
|
+
role: z.ZodEnum<["assistant"]>;
|
|
568
609
|
content: z.ZodUnion<[z.ZodNull, z.ZodString]>;
|
|
569
610
|
function_call: z.ZodObject<{
|
|
570
611
|
name: z.ZodString;
|
|
@@ -578,7 +619,7 @@ declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
578
619
|
}>;
|
|
579
620
|
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
580
621
|
}, "strict", z.ZodTypeAny, {
|
|
581
|
-
role: "
|
|
622
|
+
role: "assistant";
|
|
582
623
|
content: string | null;
|
|
583
624
|
function_call: {
|
|
584
625
|
name: string;
|
|
@@ -586,7 +627,7 @@ declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
586
627
|
};
|
|
587
628
|
timestamp?: number | undefined;
|
|
588
629
|
}, {
|
|
589
|
-
role: "
|
|
630
|
+
role: "assistant";
|
|
590
631
|
content: string | null;
|
|
591
632
|
function_call: {
|
|
592
633
|
name: string;
|
|
@@ -594,26 +635,26 @@ declare const ChatCompletionRequestInputMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
594
635
|
};
|
|
595
636
|
timestamp?: number | undefined;
|
|
596
637
|
}>]>, z.ZodObject<{
|
|
597
|
-
role: z.
|
|
638
|
+
role: z.ZodEnum<["function"]>;
|
|
598
639
|
content: z.ZodString;
|
|
599
640
|
name: z.ZodString;
|
|
600
641
|
}, "strip", z.ZodTypeAny, {
|
|
601
642
|
name: string;
|
|
602
|
-
role: "function"
|
|
643
|
+
role: "function";
|
|
603
644
|
content: string;
|
|
604
645
|
}, {
|
|
605
646
|
name: string;
|
|
606
|
-
role: "function"
|
|
647
|
+
role: "function";
|
|
607
648
|
content: string;
|
|
608
649
|
}>]>;
|
|
609
650
|
type ConversationIOtMessage = z.infer<typeof ChatCompletionRequestInputMessageSchema>;
|
|
610
651
|
declare const isConversationInputMessage: (input: unknown) => input is {
|
|
611
|
-
role: "
|
|
652
|
+
role: "user";
|
|
612
653
|
content: string;
|
|
613
654
|
name?: string | undefined;
|
|
614
655
|
timestamp?: number | undefined;
|
|
615
656
|
} | {
|
|
616
|
-
role: "
|
|
657
|
+
role: "assistant";
|
|
617
658
|
content: string | null;
|
|
618
659
|
function_call: {
|
|
619
660
|
name: string;
|
|
@@ -621,12 +662,12 @@ declare const isConversationInputMessage: (input: unknown) => input is {
|
|
|
621
662
|
};
|
|
622
663
|
timestamp?: number | undefined;
|
|
623
664
|
} | {
|
|
624
|
-
role: "
|
|
665
|
+
role: "assistant";
|
|
625
666
|
content: string;
|
|
626
667
|
timestamp?: number | undefined;
|
|
627
668
|
} | {
|
|
628
669
|
name: string;
|
|
629
|
-
role: "function"
|
|
670
|
+
role: "function";
|
|
630
671
|
content: string;
|
|
631
672
|
};
|
|
632
673
|
interface AddMessageEvent {
|
|
@@ -665,4 +706,4 @@ interface RosettaResponseMessageEvent extends MessageEvent {
|
|
|
665
706
|
data: RosettaResponseMessage;
|
|
666
707
|
}
|
|
667
708
|
declare function isType<T>(input: unknown, schema: z.ZodType<T>): input is T;
|
|
668
|
-
export { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOtMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, isConversationMessageFunctionCall };
|
|
709
|
+
export { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOtMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaMessageEvent, type RosettaResponseMessageEvent, type ConversationMessageFunctionCall, isConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, isConversationAssistantMessageWithFunctionCall };
|
package/build/rosetta/types.js
CHANGED
|
@@ -21,9 +21,7 @@ const ChatCompletionRequestMessageTimestamp = z.number().int().min(1670112000000
|
|
|
21
21
|
// User Message
|
|
22
22
|
/// ///////////////////
|
|
23
23
|
const ChatCompletionRequestUserMessageSchema = z.object({
|
|
24
|
-
role:
|
|
25
|
-
message: 'Role must be user'
|
|
26
|
-
}),
|
|
24
|
+
role: z.enum(['user']),
|
|
27
25
|
content: z.string().min(1),
|
|
28
26
|
name: ChatCompletionRequestMessageName.optional(),
|
|
29
27
|
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
@@ -45,17 +43,16 @@ const isConversationMessageFunctionCall = (input) => {
|
|
|
45
43
|
// Assistant Message
|
|
46
44
|
/// ///////////////////
|
|
47
45
|
const ChatCompletionRequestAssistantMessageWithFunctionCall = z.object({
|
|
48
|
-
role:
|
|
49
|
-
message: 'Role must be assistant'
|
|
50
|
-
}),
|
|
46
|
+
role: z.enum(['assistant']),
|
|
51
47
|
content: z.null().or(z.string()),
|
|
52
48
|
function_call: ChatCompletionRequestMessageFunctionCall,
|
|
53
49
|
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
54
50
|
}).strict();
|
|
51
|
+
const isConversationAssistantMessageWithFunctionCall = (input) => {
|
|
52
|
+
return ChatCompletionRequestAssistantMessageWithFunctionCall.safeParse(input).success;
|
|
53
|
+
};
|
|
55
54
|
const ChatCompletionRequestAssistantMessage = z.object({
|
|
56
|
-
role:
|
|
57
|
-
message: 'Role must be assistant'
|
|
58
|
-
}),
|
|
55
|
+
role: z.enum(['assistant']),
|
|
59
56
|
content: z.string(),
|
|
60
57
|
timestamp: ChatCompletionRequestMessageTimestamp.optional()
|
|
61
58
|
}).strict();
|
|
@@ -67,9 +64,7 @@ const isConversationAssistantMessage = (input) => {
|
|
|
67
64
|
// System Message
|
|
68
65
|
/// ///////////////////
|
|
69
66
|
const ChatCompletionSystemMessageSchema = z.object({
|
|
70
|
-
role:
|
|
71
|
-
message: 'Role must be system'
|
|
72
|
-
}),
|
|
67
|
+
role: z.enum(['system']),
|
|
73
68
|
content: z.string()
|
|
74
69
|
});
|
|
75
70
|
const isConversationSystemMessage = (input) => {
|
|
@@ -79,9 +74,7 @@ const isConversationSystemMessage = (input) => {
|
|
|
79
74
|
// Function Message
|
|
80
75
|
/// ///////////////////
|
|
81
76
|
const ChatCompletionFunctionMessageSchema = z.object({
|
|
82
|
-
role:
|
|
83
|
-
message: 'Role must be function'
|
|
84
|
-
}),
|
|
77
|
+
role: z.enum(['function']),
|
|
85
78
|
content: z.string(),
|
|
86
79
|
name: z.string()
|
|
87
80
|
});
|
|
@@ -167,4 +160,4 @@ function isType(input, schema) {
|
|
|
167
160
|
/// ///////////////////
|
|
168
161
|
// Exports
|
|
169
162
|
/// ///////////////////
|
|
170
|
-
export { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall };
|
|
163
|
+
export { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall };
|