mastra 0.1.53 → 0.1.54

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/admin",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "scripts": {
5
5
  "dev": "next dev --turbo",
6
6
  "start": "next start",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@hello-pangea/dnd": "^16.6.0",
31
31
  "@hookform/resolvers": "^3.9.0",
32
- "@mastra/core": "^0.1.17",
32
+ "@mastra/core": "^0.1.23",
33
33
  "@paralleldrive/cuid2": "^2.2.2",
34
34
  "@prisma/client": "^5.18.0",
35
35
  "@radix-ui/react-avatar": "^1.1.0",
@@ -4,6 +4,8 @@ import { IntegrationApi } from '@mastra/core';
4
4
  import path from 'path';
5
5
  import zodToJsonSchema from 'zod-to-json-schema';
6
6
 
7
+ import { Assistant } from 'next/font/google';
8
+
7
9
  import { framework } from '@/lib/framework-utils';
8
10
 
9
11
  import { AgentWriterService } from '@/service/service.agentWriter';
@@ -59,11 +61,13 @@ export const createOpenAiAssitant = async ({
59
61
  instructions,
60
62
  model,
61
63
  tools,
64
+ response_format = null,
62
65
  }: {
63
66
  name: string;
64
67
  instructions: string;
65
68
  model: string;
66
69
  tools: Record<string, boolean>;
70
+ response_format?: any;
67
71
  }) => {
68
72
  const arrMap = Array.from(framework?.getApis() ?? []);
69
73
 
@@ -96,6 +100,7 @@ export const createOpenAiAssitant = async ({
96
100
  instructions,
97
101
  model,
98
102
  tools: toolMap,
103
+ response_format,
99
104
  });
100
105
 
101
106
  return { id: assitant?.id! };
@@ -107,12 +112,14 @@ export const updateOpenAiAssitant = async ({
107
112
  instructions,
108
113
  model,
109
114
  tools,
115
+ response_format = null,
110
116
  }: {
111
117
  id: string;
112
118
  name: string;
113
119
  instructions: string;
114
120
  model: string;
115
121
  tools: Record<string, boolean>;
122
+ response_format?: any;
116
123
  }) => {
117
124
  const arrMap = Array.from(framework?.getApis() ?? []);
118
125
 
@@ -146,5 +153,6 @@ export const updateOpenAiAssitant = async ({
146
153
  instructions,
147
154
  model,
148
155
  tools: toolMap,
156
+ response_format,
149
157
  });
150
158
  };
@@ -54,7 +54,7 @@ export async function sendAgentMessage({
54
54
  const run = await executor.watchRun({ threadId: tId });
55
55
 
56
56
  const text = run?.content?.[0]?.text?.value || run?.message;
57
- const answer = JSON.stringify(run?.content?.find((m: any) => m.toolName === 'answer').args, null, 2);
57
+ const answer = JSON.stringify(run?.content?.find((m: any) => m.toolName === 'answer')?.args, null, 2);
58
58
 
59
59
  return {
60
60
  id: messageId,
@@ -221,6 +221,7 @@ export const AgentInfoForm = () => {
221
221
  const prompt = form.getValues('ragPrompt');
222
222
  const apiKey = form.getValues('apiKey');
223
223
  const structuredResponse = form.getValues('structuredResponse');
224
+ console.log('structuredResponse', structuredResponse);
224
225
  const structuredResponseType = form.getValues('structuredResponseType');
225
226
  if (!name) {
226
227
  toast.error('Please fill out the name of the agent');
@@ -261,6 +262,17 @@ export const AgentInfoForm = () => {
261
262
 
262
263
  //if OPEN_AI_ASSISTANT,create the assistant in openAi
263
264
  if (updateAgentInfo.model.provider === 'OPEN_AI_ASSISTANT') {
265
+ let jsonSchema = {};
266
+ if (structuredResponseType) {
267
+ jsonSchema = {
268
+ type: 'json_schema',
269
+ json_schema: {
270
+ name: 'response',
271
+ schema: { ...structuredResponse },
272
+ },
273
+ };
274
+ console.log('jsonSchema', jsonSchema);
275
+ }
264
276
  if (agentId) {
265
277
  await updateOpenAiAssitant({
266
278
  id,
@@ -268,6 +280,7 @@ export const AgentInfoForm = () => {
268
280
  instructions: updateAgentInfo.agentInstructions,
269
281
  model: updateAgentInfo.model.name,
270
282
  tools: tools as Record<string, boolean>,
283
+ response_format: structuredResponseType ? jsonSchema : 'auto',
271
284
  });
272
285
  } else {
273
286
  const openAiAssitant = await createOpenAiAssitant({
@@ -275,6 +288,7 @@ export const AgentInfoForm = () => {
275
288
  instructions: updateAgentInfo.agentInstructions,
276
289
  model: updateAgentInfo.model.name,
277
290
  tools: tools as Record<string, boolean>,
291
+ response_format: structuredResponseType ? jsonSchema : 'auto',
278
292
  });
279
293
 
280
294
  id = openAiAssitant?.id!;
@@ -36,7 +36,11 @@ export async function triggerFrameworkEvent({ eventKey, payload, connectionId, i
36
36
  },
37
37
  });
38
38
 
39
- return { ok: true, data: stringify(res) };
39
+ const { workflowEvent } = res;
40
+
41
+ const resp = await workflowEvent.subscribe();
42
+
43
+ return { ok: true, data: stringify(resp) };
40
44
  } catch (e) {
41
45
  //TODO: resend proper event errors
42
46
  return { ok: false, error: getErrorMessage(e) };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { up } from './commands/up.js';
8
8
  import { validateNextJsRoot } from './utils.js';
9
9
  const program = new Command();
10
10
  program
11
- .version('0.1.53')
11
+ .version('0.1.54')
12
12
  .description('CLI for Mastra')
13
13
  .action(() => {
14
14
  validateNextJsRoot();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mastra",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "license": "MIT",
5
5
  "description": "",
6
6
  "main": "dist/index.js",