@mastra/openai 1.0.1-alpha.2 → 1.0.1-alpha.21
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/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/schemas.gen.d.ts +8048 -0
- package/dist/client/schemas.gen.d.ts.map +1 -0
- package/dist/client/service-comments.d.ts +379 -0
- package/dist/client/service-comments.d.ts.map +1 -0
- package/dist/client/services.gen.d.ts +425 -0
- package/dist/client/services.gen.d.ts.map +1 -0
- package/dist/client/types.gen.d.ts +6662 -0
- package/dist/client/types.gen.d.ts.map +1 -0
- package/dist/client/zodSchema.d.ts +62327 -0
- package/dist/client/zodSchema.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/openai.cjs.development.js +4956 -0
- package/dist/openai.cjs.development.js.map +1 -0
- package/dist/openai.cjs.production.min.js +2 -0
- package/dist/openai.cjs.production.min.js.map +1 -0
- package/dist/openai.esm.js +4952 -0
- package/dist/openai.esm.js.map +1 -0
- package/dist/toolset.d.ts +397 -0
- package/dist/toolset.d.ts.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/client/types.gen.ts +231 -231
- package/src/index.ts +10 -38
- package/src/toolset.ts +55 -0
- package/src/types.ts +4 -0
package/src/client/types.gen.ts
CHANGED
|
@@ -1335,30 +1335,30 @@ export type CreateAssistantRequest = {
|
|
|
1335
1335
|
*
|
|
1336
1336
|
*/
|
|
1337
1337
|
model:
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1338
|
+
| string
|
|
1339
|
+
| 'gpt-4o'
|
|
1340
|
+
| 'gpt-4o-2024-08-06'
|
|
1341
|
+
| 'gpt-4o-2024-05-13'
|
|
1342
|
+
| 'gpt-4o-mini'
|
|
1343
|
+
| 'gpt-4o-mini-2024-07-18'
|
|
1344
|
+
| 'gpt-4-turbo'
|
|
1345
|
+
| 'gpt-4-turbo-2024-04-09'
|
|
1346
|
+
| 'gpt-4-0125-preview'
|
|
1347
|
+
| 'gpt-4-turbo-preview'
|
|
1348
|
+
| 'gpt-4-1106-preview'
|
|
1349
|
+
| 'gpt-4-vision-preview'
|
|
1350
|
+
| 'gpt-4'
|
|
1351
|
+
| 'gpt-4-0314'
|
|
1352
|
+
| 'gpt-4-0613'
|
|
1353
|
+
| 'gpt-4-32k'
|
|
1354
|
+
| 'gpt-4-32k-0314'
|
|
1355
|
+
| 'gpt-4-32k-0613'
|
|
1356
|
+
| 'gpt-3.5-turbo'
|
|
1357
|
+
| 'gpt-3.5-turbo-16k'
|
|
1358
|
+
| 'gpt-3.5-turbo-0613'
|
|
1359
|
+
| 'gpt-3.5-turbo-1106'
|
|
1360
|
+
| 'gpt-3.5-turbo-0125'
|
|
1361
|
+
| 'gpt-3.5-turbo-16k-0613';
|
|
1362
1362
|
/**
|
|
1363
1363
|
* The name of the assistant. The maximum length is 256 characters.
|
|
1364
1364
|
*
|
|
@@ -1411,31 +1411,31 @@ export type CreateAssistantRequest = {
|
|
|
1411
1411
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
|
|
1412
1412
|
*/
|
|
1413
1413
|
chunking_strategy?:
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1414
|
+
| {
|
|
1415
|
+
/**
|
|
1416
|
+
* Always `auto`.
|
|
1417
|
+
*/
|
|
1418
|
+
type: 'auto';
|
|
1419
|
+
}
|
|
1420
|
+
| {
|
|
1421
|
+
/**
|
|
1422
|
+
* Always `static`.
|
|
1423
|
+
*/
|
|
1424
|
+
type: 'static';
|
|
1425
|
+
static: {
|
|
1426
|
+
/**
|
|
1427
|
+
* The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
|
|
1428
|
+
*/
|
|
1429
|
+
max_chunk_size_tokens: number;
|
|
1430
|
+
/**
|
|
1431
|
+
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
1432
|
+
*
|
|
1433
|
+
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
1434
|
+
*
|
|
1435
|
+
*/
|
|
1436
|
+
chunk_overlap_tokens: number;
|
|
1437
|
+
};
|
|
1438
|
+
};
|
|
1439
1439
|
/**
|
|
1440
1440
|
* Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.
|
|
1441
1441
|
*
|
|
@@ -1530,31 +1530,31 @@ export type CreateChatCompletionRequest = {
|
|
|
1530
1530
|
* ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API.
|
|
1531
1531
|
*/
|
|
1532
1532
|
model:
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1533
|
+
| string
|
|
1534
|
+
| 'gpt-4o'
|
|
1535
|
+
| 'gpt-4o-2024-08-06'
|
|
1536
|
+
| 'gpt-4o-2024-05-13'
|
|
1537
|
+
| 'gpt-4o-mini'
|
|
1538
|
+
| 'gpt-4o-mini-2024-07-18'
|
|
1539
|
+
| 'gpt-4-turbo'
|
|
1540
|
+
| 'gpt-4-turbo-2024-04-09'
|
|
1541
|
+
| 'gpt-4-0125-preview'
|
|
1542
|
+
| 'gpt-4-turbo-preview'
|
|
1543
|
+
| 'gpt-4-1106-preview'
|
|
1544
|
+
| 'gpt-4-vision-preview'
|
|
1545
|
+
| 'gpt-4'
|
|
1546
|
+
| 'gpt-4-0314'
|
|
1547
|
+
| 'gpt-4-0613'
|
|
1548
|
+
| 'gpt-4-32k'
|
|
1549
|
+
| 'gpt-4-32k-0314'
|
|
1550
|
+
| 'gpt-4-32k-0613'
|
|
1551
|
+
| 'gpt-3.5-turbo'
|
|
1552
|
+
| 'gpt-3.5-turbo-16k'
|
|
1553
|
+
| 'gpt-3.5-turbo-0301'
|
|
1554
|
+
| 'gpt-3.5-turbo-0613'
|
|
1555
|
+
| 'gpt-3.5-turbo-1106'
|
|
1556
|
+
| 'gpt-3.5-turbo-0125'
|
|
1557
|
+
| 'gpt-3.5-turbo-16k-0613';
|
|
1558
1558
|
/**
|
|
1559
1559
|
* Number between -2.0 and 2.0. 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.
|
|
1560
1560
|
*
|
|
@@ -2366,8 +2366,8 @@ export type CreateMessageRequest = {
|
|
|
2366
2366
|
*/
|
|
2367
2367
|
role: 'user' | 'assistant';
|
|
2368
2368
|
content:
|
|
2369
|
-
|
|
2370
|
-
|
|
2369
|
+
| string
|
|
2370
|
+
| Array<MessageContentImageFileObject | MessageContentImageUrlObject | MessageRequestContentTextObject>;
|
|
2371
2371
|
/**
|
|
2372
2372
|
* A list of files attached to the message, and the tools they should be added to.
|
|
2373
2373
|
*/
|
|
@@ -2542,33 +2542,33 @@ export type CreateRunRequest = {
|
|
|
2542
2542
|
* The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
|
|
2543
2543
|
*/
|
|
2544
2544
|
model?:
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2545
|
+
| (
|
|
2546
|
+
| string
|
|
2547
|
+
| 'gpt-4o'
|
|
2548
|
+
| 'gpt-4o-2024-08-06'
|
|
2549
|
+
| 'gpt-4o-2024-05-13'
|
|
2550
|
+
| 'gpt-4o-mini'
|
|
2551
|
+
| 'gpt-4o-mini-2024-07-18'
|
|
2552
|
+
| 'gpt-4-turbo'
|
|
2553
|
+
| 'gpt-4-turbo-2024-04-09'
|
|
2554
|
+
| 'gpt-4-0125-preview'
|
|
2555
|
+
| 'gpt-4-turbo-preview'
|
|
2556
|
+
| 'gpt-4-1106-preview'
|
|
2557
|
+
| 'gpt-4-vision-preview'
|
|
2558
|
+
| 'gpt-4'
|
|
2559
|
+
| 'gpt-4-0314'
|
|
2560
|
+
| 'gpt-4-0613'
|
|
2561
|
+
| 'gpt-4-32k'
|
|
2562
|
+
| 'gpt-4-32k-0314'
|
|
2563
|
+
| 'gpt-4-32k-0613'
|
|
2564
|
+
| 'gpt-3.5-turbo'
|
|
2565
|
+
| 'gpt-3.5-turbo-16k'
|
|
2566
|
+
| 'gpt-3.5-turbo-0613'
|
|
2567
|
+
| 'gpt-3.5-turbo-1106'
|
|
2568
|
+
| 'gpt-3.5-turbo-0125'
|
|
2569
|
+
| 'gpt-3.5-turbo-16k-0613'
|
|
2570
|
+
)
|
|
2571
|
+
| null;
|
|
2572
2572
|
/**
|
|
2573
2573
|
* Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis.
|
|
2574
2574
|
*/
|
|
@@ -2665,33 +2665,33 @@ export type CreateThreadAndRunRequest = {
|
|
|
2665
2665
|
* The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
|
|
2666
2666
|
*/
|
|
2667
2667
|
model?:
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2668
|
+
| (
|
|
2669
|
+
| string
|
|
2670
|
+
| 'gpt-4o'
|
|
2671
|
+
| 'gpt-4o-2024-08-06'
|
|
2672
|
+
| 'gpt-4o-2024-05-13'
|
|
2673
|
+
| 'gpt-4o-mini'
|
|
2674
|
+
| 'gpt-4o-mini-2024-07-18'
|
|
2675
|
+
| 'gpt-4-turbo'
|
|
2676
|
+
| 'gpt-4-turbo-2024-04-09'
|
|
2677
|
+
| 'gpt-4-0125-preview'
|
|
2678
|
+
| 'gpt-4-turbo-preview'
|
|
2679
|
+
| 'gpt-4-1106-preview'
|
|
2680
|
+
| 'gpt-4-vision-preview'
|
|
2681
|
+
| 'gpt-4'
|
|
2682
|
+
| 'gpt-4-0314'
|
|
2683
|
+
| 'gpt-4-0613'
|
|
2684
|
+
| 'gpt-4-32k'
|
|
2685
|
+
| 'gpt-4-32k-0314'
|
|
2686
|
+
| 'gpt-4-32k-0613'
|
|
2687
|
+
| 'gpt-3.5-turbo'
|
|
2688
|
+
| 'gpt-3.5-turbo-16k'
|
|
2689
|
+
| 'gpt-3.5-turbo-0613'
|
|
2690
|
+
| 'gpt-3.5-turbo-1106'
|
|
2691
|
+
| 'gpt-3.5-turbo-0125'
|
|
2692
|
+
| 'gpt-3.5-turbo-16k-0613'
|
|
2693
|
+
)
|
|
2694
|
+
| null;
|
|
2695
2695
|
/**
|
|
2696
2696
|
* Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
|
|
2697
2697
|
*/
|
|
@@ -2793,31 +2793,31 @@ export type CreateThreadRequest = {
|
|
|
2793
2793
|
* The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy.
|
|
2794
2794
|
*/
|
|
2795
2795
|
chunking_strategy?:
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2796
|
+
| {
|
|
2797
|
+
/**
|
|
2798
|
+
* Always `auto`.
|
|
2799
|
+
*/
|
|
2800
|
+
type: 'auto';
|
|
2801
|
+
}
|
|
2802
|
+
| {
|
|
2803
|
+
/**
|
|
2804
|
+
* Always `static`.
|
|
2805
|
+
*/
|
|
2806
|
+
type: 'static';
|
|
2807
|
+
static: {
|
|
2808
|
+
/**
|
|
2809
|
+
* The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`.
|
|
2810
|
+
*/
|
|
2811
|
+
max_chunk_size_tokens: number;
|
|
2812
|
+
/**
|
|
2813
|
+
* The number of tokens that overlap between chunks. The default value is `400`.
|
|
2814
|
+
*
|
|
2815
|
+
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
|
|
2816
|
+
*
|
|
2817
|
+
*/
|
|
2818
|
+
chunk_overlap_tokens: number;
|
|
2819
|
+
};
|
|
2820
|
+
};
|
|
2821
2821
|
/**
|
|
2822
2822
|
* Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.
|
|
2823
2823
|
*
|
|
@@ -4078,25 +4078,25 @@ export type MessageRequestContentTextObject = {
|
|
|
4078
4078
|
|
|
4079
4079
|
export type MessageStreamEvent =
|
|
4080
4080
|
| {
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4081
|
+
event: 'thread.message.created';
|
|
4082
|
+
data: MessageObject;
|
|
4083
|
+
}
|
|
4084
4084
|
| {
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4085
|
+
event: 'thread.message.in_progress';
|
|
4086
|
+
data: MessageObject;
|
|
4087
|
+
}
|
|
4088
4088
|
| {
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4089
|
+
event: 'thread.message.delta';
|
|
4090
|
+
data: MessageDeltaObject;
|
|
4091
|
+
}
|
|
4092
4092
|
| {
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4093
|
+
event: 'thread.message.completed';
|
|
4094
|
+
data: MessageObject;
|
|
4095
|
+
}
|
|
4096
4096
|
| {
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4097
|
+
event: 'thread.message.incomplete';
|
|
4098
|
+
data: MessageObject;
|
|
4099
|
+
};
|
|
4100
4100
|
|
|
4101
4101
|
export type event3 = 'thread.message.created';
|
|
4102
4102
|
|
|
@@ -4639,7 +4639,7 @@ export type type17 = 'json_schema';
|
|
|
4639
4639
|
/**
|
|
4640
4640
|
* The schema for the response format, described as a JSON Schema object.
|
|
4641
4641
|
*/
|
|
4642
|
-
|
|
4642
|
+
type ResponseFormatJsonSchemaSchema = {
|
|
4643
4643
|
[key: string]: unknown;
|
|
4644
4644
|
};
|
|
4645
4645
|
|
|
@@ -4696,15 +4696,15 @@ export type RunObject = {
|
|
|
4696
4696
|
* The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`.
|
|
4697
4697
|
*/
|
|
4698
4698
|
status:
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4699
|
+
| 'queued'
|
|
4700
|
+
| 'in_progress'
|
|
4701
|
+
| 'requires_action'
|
|
4702
|
+
| 'cancelling'
|
|
4703
|
+
| 'cancelled'
|
|
4704
|
+
| 'failed'
|
|
4705
|
+
| 'completed'
|
|
4706
|
+
| 'incomplete'
|
|
4707
|
+
| 'expired';
|
|
4708
4708
|
/**
|
|
4709
4709
|
* Details on the action required to continue the run. Will be `null` if no action is required.
|
|
4710
4710
|
*/
|
|
@@ -5300,77 +5300,77 @@ export type code2 = 'server_error' | 'rate_limit_exceeded';
|
|
|
5300
5300
|
|
|
5301
5301
|
export type RunStepStreamEvent =
|
|
5302
5302
|
| {
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5303
|
+
event: 'thread.run.step.created';
|
|
5304
|
+
data: RunStepObject;
|
|
5305
|
+
}
|
|
5306
5306
|
| {
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5307
|
+
event: 'thread.run.step.in_progress';
|
|
5308
|
+
data: RunStepObject;
|
|
5309
|
+
}
|
|
5310
5310
|
| {
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5311
|
+
event: 'thread.run.step.delta';
|
|
5312
|
+
data: RunStepDeltaObject;
|
|
5313
|
+
}
|
|
5314
5314
|
| {
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5315
|
+
event: 'thread.run.step.completed';
|
|
5316
|
+
data: RunStepObject;
|
|
5317
|
+
}
|
|
5318
5318
|
| {
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5319
|
+
event: 'thread.run.step.failed';
|
|
5320
|
+
data: RunStepObject;
|
|
5321
|
+
}
|
|
5322
5322
|
| {
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5323
|
+
event: 'thread.run.step.cancelled';
|
|
5324
|
+
data: RunStepObject;
|
|
5325
|
+
}
|
|
5326
5326
|
| {
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5327
|
+
event: 'thread.run.step.expired';
|
|
5328
|
+
data: RunStepObject;
|
|
5329
|
+
};
|
|
5330
5330
|
|
|
5331
5331
|
export type event4 = 'thread.run.step.created';
|
|
5332
5332
|
|
|
5333
5333
|
export type RunStreamEvent =
|
|
5334
5334
|
| {
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5335
|
+
event: 'thread.run.created';
|
|
5336
|
+
data: RunObject;
|
|
5337
|
+
}
|
|
5338
5338
|
| {
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5339
|
+
event: 'thread.run.queued';
|
|
5340
|
+
data: RunObject;
|
|
5341
|
+
}
|
|
5342
5342
|
| {
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5343
|
+
event: 'thread.run.in_progress';
|
|
5344
|
+
data: RunObject;
|
|
5345
|
+
}
|
|
5346
5346
|
| {
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5347
|
+
event: 'thread.run.requires_action';
|
|
5348
|
+
data: RunObject;
|
|
5349
|
+
}
|
|
5350
5350
|
| {
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5351
|
+
event: 'thread.run.completed';
|
|
5352
|
+
data: RunObject;
|
|
5353
|
+
}
|
|
5354
5354
|
| {
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5355
|
+
event: 'thread.run.incomplete';
|
|
5356
|
+
data: RunObject;
|
|
5357
|
+
}
|
|
5358
5358
|
| {
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5359
|
+
event: 'thread.run.failed';
|
|
5360
|
+
data: RunObject;
|
|
5361
|
+
}
|
|
5362
5362
|
| {
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5363
|
+
event: 'thread.run.cancelling';
|
|
5364
|
+
data: RunObject;
|
|
5365
|
+
}
|
|
5366
5366
|
| {
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5367
|
+
event: 'thread.run.cancelled';
|
|
5368
|
+
data: RunObject;
|
|
5369
|
+
}
|
|
5370
5370
|
| {
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5371
|
+
event: 'thread.run.expired';
|
|
5372
|
+
data: RunObject;
|
|
5373
|
+
};
|
|
5374
5374
|
|
|
5375
5375
|
export type event5 = 'thread.run.created';
|
|
5376
5376
|
|
package/src/index.ts
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { Integration
|
|
1
|
+
import { Integration } from '@mastra/core';
|
|
2
|
+
import * as integrationClient from './client/services.gen';
|
|
2
3
|
|
|
3
4
|
// @ts-ignore
|
|
4
5
|
import OpenaiLogo from './assets/openai.png';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import * as zodSchema from './client/zodSchema';
|
|
8
|
-
|
|
9
|
-
type OpenaiConfig = {
|
|
10
|
-
API_KEY: string;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
6
|
+
import { OpenaiConfig } from './types';
|
|
7
|
+
import { OpenaiToolset } from './toolset';
|
|
13
8
|
|
|
14
|
-
export class OpenaiIntegration extends Integration {
|
|
9
|
+
export class OpenaiIntegration extends Integration<void, typeof integrationClient> {
|
|
15
10
|
readonly name = 'OPENAI';
|
|
16
11
|
readonly logoUrl = OpenaiLogo;
|
|
17
12
|
config: OpenaiConfig;
|
|
18
|
-
readonly tools: Record<Exclude<keyof typeof integrationClient, 'client'>, ToolApi>;
|
|
19
13
|
categories = ['ai'];
|
|
20
14
|
description =
|
|
21
15
|
'OpenAI is an artificial intelligence platform that provides a set of tools and APIs for building AI-powered applications.';
|
|
@@ -24,36 +18,14 @@ export class OpenaiIntegration extends Integration {
|
|
|
24
18
|
super();
|
|
25
19
|
|
|
26
20
|
this.config = config;
|
|
27
|
-
this.tools = this._generateIntegrationTools<typeof this.tools>();
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
getStaticTools() {
|
|
24
|
+
const openapi = new OpenaiToolset({
|
|
25
|
+
config: this.config,
|
|
26
|
+
})
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
return comments;
|
|
36
|
-
}
|
|
28
|
+
return openapi.tools;
|
|
37
29
|
|
|
38
|
-
protected get baseClient() {
|
|
39
|
-
integrationClient.client.setConfig({
|
|
40
|
-
baseUrl: `https://api.openai.com/v1`,
|
|
41
|
-
});
|
|
42
|
-
return integrationClient;
|
|
43
30
|
}
|
|
44
|
-
|
|
45
|
-
getApiClient = async () => {
|
|
46
|
-
const value = {
|
|
47
|
-
API_KEY: this.config?.['API_KEY'],
|
|
48
|
-
} as Record<string, any>;
|
|
49
|
-
|
|
50
|
-
const baseClient = this.baseClient;
|
|
51
|
-
|
|
52
|
-
baseClient.client.interceptors.request.use((request, options) => {
|
|
53
|
-
request.headers.set('Authorization', `Bearer ${value?.['API_KEY']}`);
|
|
54
|
-
return request;
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return integrationClient;
|
|
58
|
-
};
|
|
59
31
|
}
|