n8n-nodes-unitalk-router 0.1.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.
Files changed (31) hide show
  1. package/README.md +73 -0
  2. package/dist/credentials/UnitalkAiRouterApi.credentials.d.ts +10 -0
  3. package/dist/credentials/UnitalkAiRouterApi.credentials.js +79 -0
  4. package/dist/credentials/UnitalkAiRouterApi.credentials.js.map +1 -0
  5. package/dist/icons/unitalk.dark.svg +11 -0
  6. package/dist/icons/unitalk.png +0 -0
  7. package/dist/icons/unitalk.svg +11 -0
  8. package/dist/nodes/UnitalkAIRouter/ChatDescription.d.ts +3 -0
  9. package/dist/nodes/UnitalkAIRouter/ChatDescription.js +390 -0
  10. package/dist/nodes/UnitalkAIRouter/ChatDescription.js.map +1 -0
  11. package/dist/nodes/UnitalkAIRouter/GenericFunctions.d.ts +2 -0
  12. package/dist/nodes/UnitalkAIRouter/GenericFunctions.js +11 -0
  13. package/dist/nodes/UnitalkAIRouter/GenericFunctions.js.map +1 -0
  14. package/dist/nodes/UnitalkAIRouter/ImageDescription.d.ts +3 -0
  15. package/dist/nodes/UnitalkAIRouter/ImageDescription.js +389 -0
  16. package/dist/nodes/UnitalkAIRouter/ImageDescription.js.map +1 -0
  17. package/dist/nodes/UnitalkAIRouter/TextDescription.d.ts +3 -0
  18. package/dist/nodes/UnitalkAIRouter/TextDescription.js +476 -0
  19. package/dist/nodes/UnitalkAIRouter/TextDescription.js.map +1 -0
  20. package/dist/nodes/UnitalkAIRouter/UnitalkAiRouter.node.d.ts +4 -0
  21. package/dist/nodes/UnitalkAIRouter/UnitalkAiRouter.node.js +68 -0
  22. package/dist/nodes/UnitalkAIRouter/UnitalkAiRouter.node.js.map +1 -0
  23. package/dist/nodes/UnitalkAIRouter/UnitalkAiRouter.node.json +18 -0
  24. package/dist/nodes/UnitalkAIRouter/__schema__/v1.0.0/chat/chat.json +9 -0
  25. package/dist/nodes/UnitalkAIRouter/__schema__/v1.0.0/image/create.json +9 -0
  26. package/dist/nodes/UnitalkAIRouter/__schema__/v1.1.0/chat/complete.json +29 -0
  27. package/dist/nodes/UnitalkAIRouter/__schema__/v1.1.0/text/chat.json +9 -0
  28. package/dist/nodes/UnitalkAIRouter/__schema__/v1.1.0/text/complete.json +15 -0
  29. package/dist/package.json +54 -0
  30. package/dist/tsconfig.tsbuildinfo +1 -0
  31. package/package.json +54 -0
@@ -0,0 +1,476 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.textFields = exports.textOperations = void 0;
4
+ const GenericFunctions_1 = require("./GenericFunctions");
5
+ exports.textOperations = [
6
+ {
7
+ displayName: 'Operation',
8
+ name: 'operation',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ displayOptions: {
12
+ show: {
13
+ resource: ['text'],
14
+ },
15
+ },
16
+ options: [
17
+ {
18
+ name: 'Complete',
19
+ value: 'complete',
20
+ action: 'Create a completion',
21
+ description: 'Create one or more completions for a given text',
22
+ routing: {
23
+ request: {
24
+ method: 'POST',
25
+ url: '/v1/completions',
26
+ },
27
+ output: { postReceive: [GenericFunctions_1.sendErrorPostReceive] },
28
+ },
29
+ },
30
+ {
31
+ name: 'Edit',
32
+ value: 'edit',
33
+ action: 'Create an edit',
34
+ description: 'Create an edited version for a given text',
35
+ routing: {
36
+ request: {
37
+ method: 'POST',
38
+ url: '/v1/edits',
39
+ },
40
+ output: { postReceive: [GenericFunctions_1.sendErrorPostReceive] },
41
+ },
42
+ },
43
+ {
44
+ name: 'Moderate',
45
+ value: 'moderate',
46
+ action: 'Create a moderation',
47
+ description: "Classify if a text violates Unitalk AI's content policy",
48
+ routing: {
49
+ request: {
50
+ method: 'POST',
51
+ url: '/v1/moderations',
52
+ },
53
+ output: { postReceive: [GenericFunctions_1.sendErrorPostReceive] },
54
+ },
55
+ },
56
+ ],
57
+ default: 'complete',
58
+ },
59
+ ];
60
+ const completeOperations = [
61
+ {
62
+ displayName: 'Model',
63
+ name: 'model',
64
+ type: 'options',
65
+ description: 'The model which will generate the completion. <a href="https://unitalk.ai">Learn more</a>.',
66
+ displayOptions: {
67
+ show: {
68
+ operation: ['complete'],
69
+ resource: ['text'],
70
+ },
71
+ },
72
+ typeOptions: {
73
+ loadOptions: {
74
+ routing: {
75
+ request: {
76
+ method: 'GET',
77
+ url: '/v1/models',
78
+ },
79
+ output: {
80
+ postReceive: [
81
+ {
82
+ type: 'rootProperty',
83
+ properties: {
84
+ property: 'data',
85
+ },
86
+ },
87
+ {
88
+ type: 'filter',
89
+ properties: {
90
+ pass: "={{ !$responseItem.id.startsWith('audio-') && ($responseItem.id === 'gpt-3.5-turbo-instruct' || !$responseItem.id.startsWith('gpt-') ) && !$responseItem.id.startsWith('dall-') && !$responseItem.id.startsWith('tts-') && !$responseItem.id.startsWith('whisper-') && !['cushman:2020-05-03', 'davinci-if:3.0.0', 'davinci-instruct-beta:2.0.0', 'if'].includes($responseItem.id) && !$responseItem.id.includes('-edit-') && !$responseItem.id.endsWith(':001') }}",
91
+ },
92
+ },
93
+ {
94
+ type: 'setKeyValue',
95
+ properties: {
96
+ name: '={{$responseItem.id}}',
97
+ value: '={{$responseItem.id}}',
98
+ },
99
+ },
100
+ {
101
+ type: 'sort',
102
+ properties: {
103
+ key: 'name',
104
+ },
105
+ },
106
+ ],
107
+ },
108
+ },
109
+ },
110
+ },
111
+ routing: {
112
+ send: {
113
+ type: 'body',
114
+ property: 'model',
115
+ },
116
+ },
117
+ default: '',
118
+ },
119
+ {
120
+ displayName: 'Prompt',
121
+ name: 'prompt',
122
+ type: 'string',
123
+ description: 'The prompt to generate completion(s) for',
124
+ placeholder: 'e.g. Say this is a test',
125
+ displayOptions: {
126
+ show: {
127
+ resource: ['text'],
128
+ operation: ['complete'],
129
+ },
130
+ },
131
+ default: '',
132
+ typeOptions: {
133
+ rows: 2,
134
+ },
135
+ routing: {
136
+ send: {
137
+ type: 'body',
138
+ property: 'prompt',
139
+ },
140
+ },
141
+ },
142
+ ];
143
+ const editOperations = [
144
+ {
145
+ displayName: 'Model',
146
+ name: 'model',
147
+ type: 'options',
148
+ description: 'The model which will generate the edited version. <a href="https://unitalk.ai">Learn more</a>.',
149
+ displayOptions: {
150
+ show: {
151
+ operation: ['edit'],
152
+ resource: ['text'],
153
+ },
154
+ },
155
+ options: [
156
+ {
157
+ name: 'code-davinci-edit-001',
158
+ value: 'code-davinci-edit-001',
159
+ },
160
+ {
161
+ name: 'text-davinci-edit-001',
162
+ value: 'text-davinci-edit-001',
163
+ },
164
+ ],
165
+ routing: {
166
+ send: {
167
+ type: 'body',
168
+ property: 'model',
169
+ },
170
+ },
171
+ default: 'text-davinci-edit-001',
172
+ },
173
+ {
174
+ displayName: 'Input',
175
+ name: 'input',
176
+ type: 'string',
177
+ placeholder: 'e.g. What day of the wek is it?',
178
+ description: 'The input text to be edited',
179
+ displayOptions: {
180
+ show: {
181
+ resource: ['text'],
182
+ operation: ['edit'],
183
+ },
184
+ },
185
+ default: '',
186
+ routing: {
187
+ send: {
188
+ type: 'body',
189
+ property: 'input',
190
+ },
191
+ },
192
+ },
193
+ {
194
+ displayName: 'Instruction',
195
+ name: 'instruction',
196
+ type: 'string',
197
+ placeholder: 'e.g. Fix the spelling mistakes',
198
+ description: 'The instruction that tells the model how to edit the input text',
199
+ displayOptions: {
200
+ show: {
201
+ resource: ['text'],
202
+ operation: ['edit'],
203
+ },
204
+ },
205
+ default: '',
206
+ routing: {
207
+ send: {
208
+ type: 'body',
209
+ property: 'instruction',
210
+ },
211
+ },
212
+ },
213
+ ];
214
+ const moderateOperations = [
215
+ {
216
+ displayName: 'Model',
217
+ name: 'model',
218
+ type: 'options',
219
+ description: 'The model which will classify the text. <a href="https://unitalk.ai">Learn more</a>.',
220
+ displayOptions: {
221
+ show: {
222
+ resource: ['text'],
223
+ operation: ['moderate'],
224
+ },
225
+ },
226
+ options: [
227
+ {
228
+ name: 'text-moderation-stable',
229
+ value: 'text-moderation-stable',
230
+ },
231
+ {
232
+ name: 'text-moderation-latest',
233
+ value: 'text-moderation-latest',
234
+ },
235
+ ],
236
+ routing: {
237
+ send: {
238
+ type: 'body',
239
+ property: 'model',
240
+ },
241
+ },
242
+ default: 'text-moderation-latest',
243
+ },
244
+ {
245
+ displayName: 'Input',
246
+ name: 'input',
247
+ type: 'string',
248
+ placeholder: 'e.g. My cat is adorable ❤️❤️',
249
+ description: 'The input text to classify',
250
+ displayOptions: {
251
+ show: {
252
+ resource: ['text'],
253
+ operation: ['moderate'],
254
+ },
255
+ },
256
+ default: '',
257
+ routing: {
258
+ send: {
259
+ type: 'body',
260
+ property: 'input',
261
+ },
262
+ },
263
+ },
264
+ {
265
+ displayName: 'Simplify',
266
+ name: 'simplifyOutput',
267
+ type: 'boolean',
268
+ default: true,
269
+ displayOptions: {
270
+ show: {
271
+ operation: ['moderate'],
272
+ resource: ['text'],
273
+ },
274
+ },
275
+ routing: {
276
+ output: {
277
+ postReceive: [
278
+ {
279
+ type: 'set',
280
+ enabled: '={{$value}}',
281
+ properties: {
282
+ value: '={{ { "data": $response.body.results } }}',
283
+ },
284
+ },
285
+ {
286
+ type: 'rootProperty',
287
+ enabled: '={{$value}}',
288
+ properties: {
289
+ property: 'data',
290
+ },
291
+ },
292
+ ],
293
+ },
294
+ },
295
+ description: 'Whether to return a simplified version of the response instead of the raw data',
296
+ },
297
+ ];
298
+ const sharedOperations = [
299
+ {
300
+ displayName: 'Simplify',
301
+ name: 'simplifyOutput',
302
+ type: 'boolean',
303
+ default: true,
304
+ displayOptions: {
305
+ show: {
306
+ operation: ['complete', 'edit'],
307
+ resource: ['text'],
308
+ },
309
+ },
310
+ routing: {
311
+ output: {
312
+ postReceive: [
313
+ {
314
+ type: 'set',
315
+ enabled: '={{$value}}',
316
+ properties: {
317
+ value: '={{ { "data": $response.body.choices } }}',
318
+ },
319
+ },
320
+ {
321
+ type: 'rootProperty',
322
+ enabled: '={{$value}}',
323
+ properties: {
324
+ property: 'data',
325
+ },
326
+ },
327
+ async function (items) {
328
+ if (this.getNode().parameters.simplifyOutput === false) {
329
+ return items;
330
+ }
331
+ return items.map((item) => {
332
+ return {
333
+ json: {
334
+ ...item.json,
335
+ text: item.json.text.trim(),
336
+ },
337
+ };
338
+ });
339
+ },
340
+ ],
341
+ },
342
+ },
343
+ description: 'Whether to return a simplified version of the response instead of the raw data',
344
+ },
345
+ {
346
+ displayName: 'Options',
347
+ name: 'options',
348
+ placeholder: 'Add option',
349
+ description: 'Additional options to add',
350
+ type: 'collection',
351
+ default: {},
352
+ displayOptions: {
353
+ show: {
354
+ operation: ['complete', 'edit'],
355
+ resource: ['text'],
356
+ },
357
+ },
358
+ options: [
359
+ {
360
+ displayName: 'Echo Prompt',
361
+ name: 'echo',
362
+ type: 'boolean',
363
+ description: 'Whether the prompt should be echo back in addition to the completion',
364
+ default: false,
365
+ displayOptions: {
366
+ show: {
367
+ '/operation': ['complete'],
368
+ },
369
+ },
370
+ routing: {
371
+ send: {
372
+ type: 'body',
373
+ property: 'echo',
374
+ },
375
+ },
376
+ },
377
+ {
378
+ displayName: 'Frequency Penalty',
379
+ name: 'frequency_penalty',
380
+ default: 0,
381
+ typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
382
+ description: "Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim",
383
+ type: 'number',
384
+ routing: {
385
+ send: {
386
+ type: 'body',
387
+ property: 'frequency_penalty',
388
+ },
389
+ },
390
+ },
391
+ {
392
+ displayName: 'Maximum Number of Tokens',
393
+ name: 'maxTokens',
394
+ default: 16,
395
+ description: 'The maximum number of tokens to generate in the completion. Most models have a context length of 2048 tokens (except for the newest models, which support 32,768).',
396
+ type: 'number',
397
+ displayOptions: {
398
+ show: {
399
+ '/operation': ['complete'],
400
+ },
401
+ },
402
+ typeOptions: {
403
+ maxValue: 32768,
404
+ },
405
+ routing: {
406
+ send: {
407
+ type: 'body',
408
+ property: 'max_tokens',
409
+ },
410
+ },
411
+ },
412
+ {
413
+ displayName: 'Number of Completions',
414
+ name: 'n',
415
+ default: 1,
416
+ description: 'How many completions to generate for each prompt. Note: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop.',
417
+ type: 'number',
418
+ routing: {
419
+ send: {
420
+ type: 'body',
421
+ property: 'n',
422
+ },
423
+ },
424
+ },
425
+ {
426
+ displayName: 'Presence Penalty',
427
+ name: 'presence_penalty',
428
+ default: 0,
429
+ typeOptions: { maxValue: 2, minValue: -2, numberPrecision: 1 },
430
+ description: "Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics",
431
+ type: 'number',
432
+ routing: {
433
+ send: {
434
+ type: 'body',
435
+ property: 'presence_penalty',
436
+ },
437
+ },
438
+ },
439
+ {
440
+ displayName: 'Sampling Temperature',
441
+ name: 'temperature',
442
+ default: 1,
443
+ typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
444
+ description: 'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',
445
+ type: 'number',
446
+ routing: {
447
+ send: {
448
+ type: 'body',
449
+ property: 'temperature',
450
+ },
451
+ },
452
+ },
453
+ {
454
+ displayName: 'Top P',
455
+ name: 'topP',
456
+ default: 1,
457
+ typeOptions: { maxValue: 1, minValue: 0, numberPrecision: 1 },
458
+ description: 'Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered. We generally recommend altering this or temperature but not both.',
459
+ type: 'number',
460
+ routing: {
461
+ send: {
462
+ type: 'body',
463
+ property: 'top_p',
464
+ },
465
+ },
466
+ },
467
+ ],
468
+ },
469
+ ];
470
+ exports.textFields = [
471
+ ...completeOperations,
472
+ ...editOperations,
473
+ ...moderateOperations,
474
+ ...sharedOperations,
475
+ ];
476
+ //# sourceMappingURL=TextDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextDescription.js","sourceRoot":"","sources":["../../../nodes/UnitalkAIRouter/TextDescription.ts"],"names":[],"mappings":";;;AAEA,y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Q,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE;gBAC7D,WAAW,EACV,8KAA8K;gBAC/K,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE;oBACR,IAAI,EAAE;wBACL,IAAI,EAAE,MAAM;wBACZ,QAAQ,EAAE,OAAO;qBACjB;iBACD;aACD;SACD;KACD;CACD,CAAC;AAEW,QAAA,UAAU,GAAsB;IAI5C,GAAG,kBAAkB;IAKrB,GAAG,cAAc;IAKjB,GAAG,kBAAkB;IAKrB,GAAG,gBAAgB;CACnB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class UnitalkAiRouter implements INodeType {
3
+ description: INodeTypeDescription;
4
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnitalkAiRouter = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const ChatDescription_1 = require("./ChatDescription");
6
+ const ImageDescription_1 = require("./ImageDescription");
7
+ const TextDescription_1 = require("./TextDescription");
8
+ class UnitalkAiRouter {
9
+ constructor() {
10
+ this.description = {
11
+ displayName: 'Unitalk AI',
12
+ name: 'unitalkAiRouter',
13
+ hidden: true,
14
+ icon: { light: 'file:../../icons/unitalk.svg', dark: 'file:../../icons/unitalk.dark.svg' },
15
+ group: ['transform'],
16
+ version: [1, 1.1],
17
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
18
+ description: 'Consume Open AI',
19
+ defaults: {
20
+ name: 'Unitalk AI Router',
21
+ },
22
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
23
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
24
+ credentials: [
25
+ {
26
+ name: 'unitalkAiRouterApi',
27
+ required: true,
28
+ },
29
+ ],
30
+ requestDefaults: {
31
+ ignoreHttpStatusErrors: true,
32
+ baseURL: '={{ $credentials.url?.split("/").slice(0,-1).join("/") ?? "https://api.openai.com" }}',
33
+ },
34
+ properties: [
35
+ {
36
+ displayName: 'Resource',
37
+ name: 'resource',
38
+ type: 'options',
39
+ noDataExpression: true,
40
+ options: [
41
+ {
42
+ name: 'Chat',
43
+ value: 'chat',
44
+ },
45
+ {
46
+ name: 'Image',
47
+ value: 'image',
48
+ },
49
+ {
50
+ name: 'Text',
51
+ value: 'text',
52
+ },
53
+ ],
54
+ default: 'text',
55
+ },
56
+ ...ChatDescription_1.chatOperations,
57
+ ...ChatDescription_1.chatFields,
58
+ ...ImageDescription_1.imageOperations,
59
+ ...ImageDescription_1.imageFields,
60
+ ...TextDescription_1.textOperations,
61
+ ...TextDescription_1.textFields,
62
+ ],
63
+ usableAsTool: true,
64
+ };
65
+ }
66
+ }
67
+ exports.UnitalkAiRouter = UnitalkAiRouter;
68
+ //# sourceMappingURL=UnitalkAiRouter.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnitalkAiRouter.node.js","sourceRoot":"","sources":["../../../nodes/UnitalkAIRouter/UnitalkAiRouter.node.ts"],"names":[],"mappings":";;;AACA,+CAAmD;AAEnD,uDAA+D;AAC/D,yDAAkE;AAClE,uDAA+D;AAE/D,MAAa,eAAe;IAA5B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,iBAAiB;YACvB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,mCAAmC,EAAE;YAC1F,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;YACjB,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE;gBACT,IAAI,EAAE,mBAAmB;aACzB;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,oBAAoB;oBAC1B,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,sBAAsB,EAAE,IAAI;gBAC5B,OAAO,EACN,uFAAuF;aACxF;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;yBACb;wBACD;4BACC,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,OAAO;yBACd;wBACD;4BACC,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,MAAM;yBACb;qBACD;oBACD,OAAO,EAAE,MAAM;iBACf;gBAED,GAAG,gCAAc;gBACjB,GAAG,4BAAU;gBAEb,GAAG,kCAAe;gBAClB,GAAG,8BAAW;gBAEd,GAAG,gCAAc;gBACjB,GAAG,4BAAU;aACb;YACD,YAAY,EAAE,IAAI;SAClB,CAAC;IACH,CAAC;CAAA;AA5DD,0CA4DC"}
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "n8n-nodes-base.unitalkAIRouter",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Utility"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://docs.n8n.io/integrations/builtin/credentials/openai/"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.openai/"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "message": {
5
+ "type": "string"
6
+ }
7
+ },
8
+ "version": 1
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "url": {
5
+ "type": "string"
6
+ }
7
+ },
8
+ "version": 1
9
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "finish_reason": {
5
+ "type": "string"
6
+ },
7
+ "index": {
8
+ "type": "integer"
9
+ },
10
+ "logprobs": {
11
+ "type": "null"
12
+ },
13
+ "message": {
14
+ "type": "object",
15
+ "properties": {
16
+ "content": {
17
+ "type": "string"
18
+ },
19
+ "refusal": {
20
+ "type": "null"
21
+ },
22
+ "role": {
23
+ "type": "string"
24
+ }
25
+ }
26
+ }
27
+ },
28
+ "version": 4
29
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "message": {
5
+ "type": "string"
6
+ }
7
+ },
8
+ "version": 1
9
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "finish_reason": {
5
+ "type": "string"
6
+ },
7
+ "index": {
8
+ "type": "integer"
9
+ },
10
+ "text": {
11
+ "type": "string"
12
+ }
13
+ },
14
+ "version": 1
15
+ }