@mastra/core 0.10.11 → 0.10.12-alpha.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.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/{base-DpaaEQWN.d.cts → base-CS5eSXbL.d.cts} +13 -16
- package/dist/{base-BBkhRGjp.d.ts → base-DBhKcre4.d.ts} +13 -16
- package/dist/{chunk-VNEHTPHO.js → chunk-2HDFKWFU.js} +1 -1
- package/dist/{chunk-FL4BYLDK.cjs → chunk-7MZNOW6W.cjs} +2 -2
- package/dist/{chunk-VUEY4BUU.cjs → chunk-E7AX3U6M.cjs} +8 -54
- package/dist/{chunk-XR7OX4ZC.js → chunk-EWCOOO3H.js} +26 -9
- package/dist/{chunk-WTC6DJHD.cjs → chunk-FBKJ3652.cjs} +27 -10
- package/dist/{chunk-QO6F3HHE.js → chunk-PA2YIVIT.js} +1 -1
- package/dist/{chunk-ZJSVUBYU.cjs → chunk-UX3B6S2I.cjs} +2 -2
- package/dist/{chunk-EJI2SQJP.js → chunk-YJEHXYK5.js} +8 -54
- package/dist/eval/index.d.cts +1 -1
- package/dist/eval/index.d.ts +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/integration/index.d.cts +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/llm/index.d.cts +1 -1
- package/dist/llm/index.d.ts +1 -1
- package/dist/mastra/index.d.cts +1 -1
- package/dist/mastra/index.d.ts +1 -1
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/memory/index.d.cts +1 -1
- package/dist/memory/index.d.ts +1 -1
- package/dist/network/index.cjs +2 -2
- package/dist/network/index.d.cts +1 -1
- package/dist/network/index.d.ts +1 -1
- package/dist/network/index.js +1 -1
- package/dist/network/vNext/index.cjs +13 -13
- package/dist/network/vNext/index.d.cts +1 -1
- package/dist/network/vNext/index.d.ts +1 -1
- package/dist/network/vNext/index.js +2 -2
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +1 -1
- package/dist/relevance/index.d.ts +1 -1
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/telemetry/index.d.cts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/tools/index.d.cts +2 -2
- package/dist/tools/index.d.ts +2 -2
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/voice/index.d.cts +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/workflows/index.cjs +10 -10
- package/dist/workflows/index.d.cts +2 -2
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.d.cts +2 -2
- package/dist/workflows/legacy/index.d.ts +2 -2
- package/dist/workflows/legacy/index.js +1 -1
- package/package.json +1 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFBKJ3652_cjs = require('../chunk-FBKJ3652.cjs');
|
|
4
4
|
var chunkQUSEDVYI_cjs = require('../chunk-QUSEDVYI.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "Agent", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkFBKJ3652_cjs.Agent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "MessageList", {
|
|
13
13
|
enumerable: true,
|
package/dist/agent/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-
|
|
4
|
+
export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-CS5eSXbL.cjs';
|
|
5
5
|
import '../base-B_y9sMg0.cjs';
|
|
6
6
|
import '../types-Bo1uigWx.cjs';
|
|
7
7
|
import '../runtime-context/index.cjs';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-
|
|
4
|
+
export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-DBhKcre4.js';
|
|
5
5
|
import '../base-ClrXcCRx.js';
|
|
6
6
|
import '../types-Bo1uigWx.js';
|
|
7
7
|
import '../runtime-context/index.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-EWCOOO3H.js';
|
|
2
2
|
export { MessageList } from '../chunk-4UBOJFSL.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Tool as Tool$2, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, TextStreamPart, UserContent, AssistantContent, ToolContent, EmbeddingModel, UIMessage, Message, IDGenerator as IDGenerator$1, CoreSystemMessage as CoreSystemMessage$1, LanguageModel as LanguageModel$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback } from 'ai';
|
|
1
|
+
import { Tool as Tool$2, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, TextStreamPart, UserContent, AssistantContent, ToolContent, EmbeddingModel, UIMessage, Message, IDGenerator as IDGenerator$1, CoreSystemMessage as CoreSystemMessage$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback } from 'ai';
|
|
3
2
|
import { M as MastraBase, a as Telemetry, O as OtelConfig, T as Trace } from './base-B_y9sMg0.cjs';
|
|
4
3
|
import { z, ZodSchema, ZodObject } from 'zod';
|
|
5
4
|
import { B as BaseLogMessage, R as RegisteredLogger, I as IMastraLogger, a as LogLevel } from './logger-B8XXh6ya.cjs';
|
|
@@ -2265,24 +2264,21 @@ declare abstract class MastraMemory extends MastraBase {
|
|
|
2265
2264
|
abstract getWorkingMemoryTemplate(): Promise<WorkingMemoryTemplate | null>;
|
|
2266
2265
|
}
|
|
2267
2266
|
|
|
2268
|
-
declare class MastraLLMBase extends MastraBase {
|
|
2269
|
-
|
|
2270
|
-
constructor({ name, model }: {
|
|
2267
|
+
declare abstract class MastraLLMBase extends MastraBase {
|
|
2268
|
+
constructor({ name }: {
|
|
2271
2269
|
name: string;
|
|
2272
|
-
model: LanguageModel$1;
|
|
2273
2270
|
});
|
|
2274
|
-
getProvider(): string;
|
|
2275
|
-
getModelId(): string;
|
|
2276
|
-
|
|
2271
|
+
abstract getProvider(): string;
|
|
2272
|
+
abstract getModelId(): string;
|
|
2273
|
+
abstract __registerMastra(p: Mastra): void;
|
|
2274
|
+
abstract __text<Z extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextOptions<Z>): Promise<GenerateTextResult<any, any>>;
|
|
2275
|
+
abstract __textObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextObjectOptions<T>): Promise<GenerateObjectResult<T>>;
|
|
2276
|
+
abstract generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<GenerateReturn<Z>>;
|
|
2277
|
+
abstract __stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(input: LLMInnerStreamOptions<Z>): StreamTextResult<any, any>;
|
|
2278
|
+
abstract __streamObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMStreamObjectOptions<T>): StreamObjectResult<DeepPartial<T>, T, never>;
|
|
2279
|
+
abstract stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): StreamReturn<Z>;
|
|
2277
2280
|
convertToMessages(messages: string | string[] | CoreMessage$1[]): CoreMessage$1[];
|
|
2278
2281
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
2279
|
-
__registerMastra(p: Mastra): void;
|
|
2280
|
-
__text<Z extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextOptions<Z>): Promise<GenerateTextResult<any, any>>;
|
|
2281
|
-
__textObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextObjectOptions<T>): Promise<GenerateObjectResult<T>>;
|
|
2282
|
-
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<GenerateReturn<Z>>;
|
|
2283
|
-
__stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(input: LLMInnerStreamOptions<Z>): Promise<StreamTextResult<any, any>>;
|
|
2284
|
-
__streamObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMStreamObjectOptions<T>): Promise<StreamObjectResult<DeepPartial<T>, T, never>>;
|
|
2285
|
-
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<StreamReturn<Z>>;
|
|
2286
2282
|
}
|
|
2287
2283
|
|
|
2288
2284
|
declare function createMockModel({ objectGenerationMode, mockText, spyGenerate, spyStream, }: {
|
|
@@ -3824,6 +3820,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
3824
3820
|
messages: CoreMessage$1[];
|
|
3825
3821
|
}>;
|
|
3826
3822
|
private getMemoryTools;
|
|
3823
|
+
private getMemoryMessages;
|
|
3827
3824
|
private getAssignedTools;
|
|
3828
3825
|
private getToolsets;
|
|
3829
3826
|
private getClientTools;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Tool as Tool$2, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, TextStreamPart, UserContent, AssistantContent, ToolContent, EmbeddingModel, UIMessage, Message, IDGenerator as IDGenerator$1, CoreSystemMessage as CoreSystemMessage$1, LanguageModel as LanguageModel$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback } from 'ai';
|
|
1
|
+
import { Tool as Tool$2, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, TextStreamPart, UserContent, AssistantContent, ToolContent, EmbeddingModel, UIMessage, Message, IDGenerator as IDGenerator$1, CoreSystemMessage as CoreSystemMessage$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback } from 'ai';
|
|
3
2
|
import { M as MastraBase, a as Telemetry, O as OtelConfig, T as Trace } from './base-ClrXcCRx.js';
|
|
4
3
|
import { z, ZodSchema, ZodObject } from 'zod';
|
|
5
4
|
import { B as BaseLogMessage, R as RegisteredLogger, I as IMastraLogger, a as LogLevel } from './logger-Bpa2oLL4.js';
|
|
@@ -2265,24 +2264,21 @@ declare abstract class MastraMemory extends MastraBase {
|
|
|
2265
2264
|
abstract getWorkingMemoryTemplate(): Promise<WorkingMemoryTemplate | null>;
|
|
2266
2265
|
}
|
|
2267
2266
|
|
|
2268
|
-
declare class MastraLLMBase extends MastraBase {
|
|
2269
|
-
|
|
2270
|
-
constructor({ name, model }: {
|
|
2267
|
+
declare abstract class MastraLLMBase extends MastraBase {
|
|
2268
|
+
constructor({ name }: {
|
|
2271
2269
|
name: string;
|
|
2272
|
-
model: LanguageModel$1;
|
|
2273
2270
|
});
|
|
2274
|
-
getProvider(): string;
|
|
2275
|
-
getModelId(): string;
|
|
2276
|
-
|
|
2271
|
+
abstract getProvider(): string;
|
|
2272
|
+
abstract getModelId(): string;
|
|
2273
|
+
abstract __registerMastra(p: Mastra): void;
|
|
2274
|
+
abstract __text<Z extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextOptions<Z>): Promise<GenerateTextResult<any, any>>;
|
|
2275
|
+
abstract __textObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextObjectOptions<T>): Promise<GenerateObjectResult<T>>;
|
|
2276
|
+
abstract generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<GenerateReturn<Z>>;
|
|
2277
|
+
abstract __stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(input: LLMInnerStreamOptions<Z>): StreamTextResult<any, any>;
|
|
2278
|
+
abstract __streamObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMStreamObjectOptions<T>): StreamObjectResult<DeepPartial<T>, T, never>;
|
|
2279
|
+
abstract stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): StreamReturn<Z>;
|
|
2277
2280
|
convertToMessages(messages: string | string[] | CoreMessage$1[]): CoreMessage$1[];
|
|
2278
2281
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
2279
|
-
__registerMastra(p: Mastra): void;
|
|
2280
|
-
__text<Z extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextOptions<Z>): Promise<GenerateTextResult<any, any>>;
|
|
2281
|
-
__textObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMTextObjectOptions<T>): Promise<GenerateObjectResult<T>>;
|
|
2282
|
-
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<GenerateReturn<Z>>;
|
|
2283
|
-
__stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(input: LLMInnerStreamOptions<Z>): Promise<StreamTextResult<any, any>>;
|
|
2284
|
-
__streamObject<T extends ZodSchema | JSONSchema7 | undefined>(input: LLMStreamObjectOptions<T>): Promise<StreamObjectResult<DeepPartial<T>, T, never>>;
|
|
2285
|
-
stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], options: LLMStreamOptions<Z>): Promise<StreamReturn<Z>>;
|
|
2286
2282
|
}
|
|
2287
2283
|
|
|
2288
2284
|
declare function createMockModel({ objectGenerationMode, mockText, spyGenerate, spyStream, }: {
|
|
@@ -3824,6 +3820,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
3824
3820
|
messages: CoreMessage$1[];
|
|
3825
3821
|
}>;
|
|
3826
3822
|
private getMemoryTools;
|
|
3823
|
+
private getMemoryMessages;
|
|
3827
3824
|
private getAssignedTools;
|
|
3828
3825
|
private getToolsets;
|
|
3829
3826
|
private getClientTools;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EMITTER_SYMBOL } from './chunk-Y7D2JLKS.js';
|
|
2
|
-
import { Agent } from './chunk-
|
|
2
|
+
import { Agent } from './chunk-EWCOOO3H.js';
|
|
3
3
|
import { Tool } from './chunk-C4LMN2IR.js';
|
|
4
4
|
import { MastraError } from './chunk-6UNGH46J.js';
|
|
5
5
|
import { MastraBase } from './chunk-5IEKR756.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkBB6DPGIV_cjs = require('./chunk-BB6DPGIV.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkFBKJ3652_cjs = require('./chunk-FBKJ3652.cjs');
|
|
5
5
|
var chunk4Z3OU5RY_cjs = require('./chunk-4Z3OU5RY.cjs');
|
|
6
6
|
var chunkB6TOBUS6_cjs = require('./chunk-B6TOBUS6.cjs');
|
|
7
7
|
var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
|
|
@@ -1301,7 +1301,7 @@ function mapVariable(config) {
|
|
|
1301
1301
|
return config;
|
|
1302
1302
|
}
|
|
1303
1303
|
function createStep(params) {
|
|
1304
|
-
if (params instanceof
|
|
1304
|
+
if (params instanceof chunkFBKJ3652_cjs.Agent) {
|
|
1305
1305
|
return {
|
|
1306
1306
|
id: params.name,
|
|
1307
1307
|
// @ts-ignore
|
|
@@ -10,24 +10,11 @@ var zod = require('zod');
|
|
|
10
10
|
|
|
11
11
|
// src/llm/model/base.ts
|
|
12
12
|
var MastraLLMBase = class extends chunkP3Q73CAW_cjs.MastraBase {
|
|
13
|
-
|
|
14
|
-
#mastra;
|
|
15
|
-
#model;
|
|
16
|
-
constructor({ name, model }) {
|
|
13
|
+
constructor({ name }) {
|
|
17
14
|
super({
|
|
18
15
|
component: chunkZIZ3CVHN_cjs.RegisteredLogger.LLM,
|
|
19
16
|
name
|
|
20
17
|
});
|
|
21
|
-
this.#model = model;
|
|
22
|
-
}
|
|
23
|
-
getProvider() {
|
|
24
|
-
return this.#model.provider;
|
|
25
|
-
}
|
|
26
|
-
getModelId() {
|
|
27
|
-
return this.#model.modelId;
|
|
28
|
-
}
|
|
29
|
-
getModel() {
|
|
30
|
-
return this.#model;
|
|
31
18
|
}
|
|
32
19
|
convertToMessages(messages) {
|
|
33
20
|
if (Array.isArray(messages)) {
|
|
@@ -56,33 +43,6 @@ var MastraLLMBase = class extends chunkP3Q73CAW_cjs.MastraBase {
|
|
|
56
43
|
this.__setLogger(p.logger);
|
|
57
44
|
}
|
|
58
45
|
}
|
|
59
|
-
__registerMastra(p) {
|
|
60
|
-
this.#mastra = p;
|
|
61
|
-
}
|
|
62
|
-
async __text(input) {
|
|
63
|
-
this.logger.debug(`[LLMs:${this.name}] Generating text.`, { input });
|
|
64
|
-
throw new Error("Method not implemented.");
|
|
65
|
-
}
|
|
66
|
-
async __textObject(input) {
|
|
67
|
-
this.logger.debug(`[LLMs:${this.name}] Generating object.`, { input });
|
|
68
|
-
throw new Error("Method not implemented.");
|
|
69
|
-
}
|
|
70
|
-
async generate(messages, options) {
|
|
71
|
-
this.logger.debug(`[LLMs:${this.name}] Generating text.`, { messages, options });
|
|
72
|
-
throw new Error("Method not implemented.");
|
|
73
|
-
}
|
|
74
|
-
async __stream(input) {
|
|
75
|
-
this.logger.debug(`[LLMs:${this.name}] Streaming text.`, { input });
|
|
76
|
-
throw new Error("Method not implemented.");
|
|
77
|
-
}
|
|
78
|
-
async __streamObject(input) {
|
|
79
|
-
this.logger.debug(`[LLMs:${this.name}] Streaming object.`, { input });
|
|
80
|
-
throw new Error("Method not implemented.");
|
|
81
|
-
}
|
|
82
|
-
async stream(messages, options) {
|
|
83
|
-
this.logger.debug(`[LLMs:${this.name}] Streaming text.`, { messages, options });
|
|
84
|
-
throw new Error("Method not implemented.");
|
|
85
|
-
}
|
|
86
46
|
};
|
|
87
47
|
|
|
88
48
|
// src/llm/model/model.ts
|
|
@@ -90,7 +50,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
90
50
|
#model;
|
|
91
51
|
#mastra;
|
|
92
52
|
constructor({ model, mastra }) {
|
|
93
|
-
super({ name: "aisdk"
|
|
53
|
+
super({ name: "aisdk" });
|
|
94
54
|
this.#model = model;
|
|
95
55
|
if (mastra) {
|
|
96
56
|
this.#mastra = mastra;
|
|
@@ -194,7 +154,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
194
154
|
},
|
|
195
155
|
e
|
|
196
156
|
);
|
|
197
|
-
this.logger.trackException(mastraError);
|
|
198
157
|
throw mastraError;
|
|
199
158
|
}
|
|
200
159
|
this.logger.debug("[LLM] - Step Change:", {
|
|
@@ -254,7 +213,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
254
213
|
},
|
|
255
214
|
e
|
|
256
215
|
);
|
|
257
|
-
this.logger.trackException(mastraError);
|
|
258
216
|
throw mastraError;
|
|
259
217
|
}
|
|
260
218
|
}
|
|
@@ -305,7 +263,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
305
263
|
},
|
|
306
264
|
e
|
|
307
265
|
);
|
|
308
|
-
this.logger.trackException(mastraError);
|
|
309
266
|
throw mastraError;
|
|
310
267
|
}
|
|
311
268
|
this.logger.debug("[LLM] - Step Change:", {
|
|
@@ -356,11 +313,10 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
356
313
|
},
|
|
357
314
|
e
|
|
358
315
|
);
|
|
359
|
-
this.logger.trackException(mastraError);
|
|
360
316
|
throw mastraError;
|
|
361
317
|
}
|
|
362
318
|
}
|
|
363
|
-
|
|
319
|
+
__stream({
|
|
364
320
|
messages,
|
|
365
321
|
onStepFinish,
|
|
366
322
|
onFinish,
|
|
@@ -487,7 +443,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
487
443
|
}
|
|
488
444
|
}
|
|
489
445
|
try {
|
|
490
|
-
return
|
|
446
|
+
return ai.streamText({
|
|
491
447
|
messages,
|
|
492
448
|
...argsForExecute,
|
|
493
449
|
experimental_telemetry: {
|
|
@@ -514,11 +470,10 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
514
470
|
},
|
|
515
471
|
e
|
|
516
472
|
);
|
|
517
|
-
this.logger.trackException(mastraError);
|
|
518
473
|
throw mastraError;
|
|
519
474
|
}
|
|
520
475
|
}
|
|
521
|
-
|
|
476
|
+
__streamObject({
|
|
522
477
|
messages,
|
|
523
478
|
runId,
|
|
524
479
|
tools = {},
|
|
@@ -664,7 +619,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
664
619
|
},
|
|
665
620
|
e
|
|
666
621
|
);
|
|
667
|
-
this.logger.trackException(mastraError);
|
|
668
622
|
throw mastraError;
|
|
669
623
|
}
|
|
670
624
|
}
|
|
@@ -684,16 +638,16 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
684
638
|
...rest
|
|
685
639
|
});
|
|
686
640
|
}
|
|
687
|
-
|
|
641
|
+
stream(messages, { maxSteps = 5, output, ...rest }) {
|
|
688
642
|
const msgs = this.convertToMessages(messages);
|
|
689
643
|
if (!output) {
|
|
690
|
-
return
|
|
644
|
+
return this.__stream({
|
|
691
645
|
messages: msgs,
|
|
692
646
|
maxSteps,
|
|
693
647
|
...rest
|
|
694
648
|
});
|
|
695
649
|
}
|
|
696
|
-
return
|
|
650
|
+
return this.__streamObject({
|
|
697
651
|
messages: msgs,
|
|
698
652
|
structuredOutput: output,
|
|
699
653
|
maxSteps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultVoice } from './chunk-5HTMDAXP.js';
|
|
2
2
|
import { MessageList } from './chunk-4UBOJFSL.js';
|
|
3
3
|
import { executeHook } from './chunk-BB4KXGBU.js';
|
|
4
|
-
import { MastraLLM } from './chunk-
|
|
4
|
+
import { MastraLLM } from './chunk-YJEHXYK5.js';
|
|
5
5
|
import { InstrumentClass } from './chunk-TC2SCOTE.js';
|
|
6
6
|
import { ensureToolProperties, makeCoreTool, createMastraProxy } from './chunk-DFFVEKIG.js';
|
|
7
7
|
import { MastraError } from './chunk-6UNGH46J.js';
|
|
@@ -853,6 +853,24 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
853
853
|
}
|
|
854
854
|
return convertedMemoryTools;
|
|
855
855
|
}
|
|
856
|
+
async getMemoryMessages({
|
|
857
|
+
resourceId,
|
|
858
|
+
threadId,
|
|
859
|
+
vectorMessageSearch,
|
|
860
|
+
memoryConfig
|
|
861
|
+
}) {
|
|
862
|
+
const memory = this.getMemory();
|
|
863
|
+
if (!memory) {
|
|
864
|
+
return [];
|
|
865
|
+
}
|
|
866
|
+
return memory.rememberMessages({
|
|
867
|
+
threadId,
|
|
868
|
+
resourceId,
|
|
869
|
+
config: memoryConfig,
|
|
870
|
+
// The new user messages aren't in the list yet cause we add memory messages first to try to make sure ordering is correct (memory comes before new user messages)
|
|
871
|
+
vectorMessageSearch
|
|
872
|
+
}).then(r => r.messagesV2);
|
|
873
|
+
}
|
|
856
874
|
async getAssignedTools({
|
|
857
875
|
runtimeContext,
|
|
858
876
|
runId,
|
|
@@ -1232,17 +1250,16 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1232
1250
|
resourceId
|
|
1233
1251
|
});
|
|
1234
1252
|
}
|
|
1235
|
-
let [memoryMessages, memorySystemMessage] = thread.id && memory ? await Promise.all([
|
|
1236
|
-
threadId: threadObject.id,
|
|
1253
|
+
let [memoryMessages, memorySystemMessage] = thread.id && memory ? await Promise.all([this.getMemoryMessages({
|
|
1237
1254
|
resourceId,
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
})
|
|
1255
|
+
threadId: threadObject.id,
|
|
1256
|
+
vectorMessageSearch: new MessageList().add(messages, `user`).getLatestUserContent() || "",
|
|
1257
|
+
memoryConfig
|
|
1258
|
+
}), memory.getSystemMessage({
|
|
1242
1259
|
threadId: threadObject.id,
|
|
1243
1260
|
resourceId,
|
|
1244
1261
|
memoryConfig
|
|
1245
|
-
})]) : [[], null
|
|
1262
|
+
})]) : [[], null];
|
|
1246
1263
|
this.logger.debug("Fetched messages from memory", {
|
|
1247
1264
|
threadId: threadObject.id,
|
|
1248
1265
|
runId,
|
|
@@ -1672,7 +1689,7 @@ ${JSON.stringify(
|
|
|
1672
1689
|
this.logger.debug(`Starting agent ${this.name} llm stream call`, {
|
|
1673
1690
|
runId
|
|
1674
1691
|
});
|
|
1675
|
-
const streamResult =
|
|
1692
|
+
const streamResult = llm.__stream({
|
|
1676
1693
|
messages: messageObjects,
|
|
1677
1694
|
temperature,
|
|
1678
1695
|
tools: convertedTools,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chunkZPOUMTTH_cjs = require('./chunk-ZPOUMTTH.cjs');
|
|
4
4
|
var chunkQUSEDVYI_cjs = require('./chunk-QUSEDVYI.cjs');
|
|
5
5
|
var chunkST5RMVLG_cjs = require('./chunk-ST5RMVLG.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkE7AX3U6M_cjs = require('./chunk-E7AX3U6M.cjs');
|
|
7
7
|
var chunkQQ5K5TZE_cjs = require('./chunk-QQ5K5TZE.cjs');
|
|
8
8
|
var chunk7F6BQXE2_cjs = require('./chunk-7F6BQXE2.cjs');
|
|
9
9
|
var chunkB6TOBUS6_cjs = require('./chunk-B6TOBUS6.cjs');
|
|
@@ -565,7 +565,7 @@ exports.Agent = class Agent extends (_a = chunkP3Q73CAW_cjs.MastraBase) {
|
|
|
565
565
|
runtimeContext
|
|
566
566
|
});
|
|
567
567
|
return resolveMaybePromise(modelToUse, resolvedModel => {
|
|
568
|
-
const llm = new
|
|
568
|
+
const llm = new chunkE7AX3U6M_cjs.MastraLLM({
|
|
569
569
|
model: resolvedModel,
|
|
570
570
|
mastra: this.#mastra
|
|
571
571
|
});
|
|
@@ -860,6 +860,24 @@ exports.Agent = class Agent extends (_a = chunkP3Q73CAW_cjs.MastraBase) {
|
|
|
860
860
|
}
|
|
861
861
|
return convertedMemoryTools;
|
|
862
862
|
}
|
|
863
|
+
async getMemoryMessages({
|
|
864
|
+
resourceId,
|
|
865
|
+
threadId,
|
|
866
|
+
vectorMessageSearch,
|
|
867
|
+
memoryConfig
|
|
868
|
+
}) {
|
|
869
|
+
const memory = this.getMemory();
|
|
870
|
+
if (!memory) {
|
|
871
|
+
return [];
|
|
872
|
+
}
|
|
873
|
+
return memory.rememberMessages({
|
|
874
|
+
threadId,
|
|
875
|
+
resourceId,
|
|
876
|
+
config: memoryConfig,
|
|
877
|
+
// The new user messages aren't in the list yet cause we add memory messages first to try to make sure ordering is correct (memory comes before new user messages)
|
|
878
|
+
vectorMessageSearch
|
|
879
|
+
}).then(r => r.messagesV2);
|
|
880
|
+
}
|
|
863
881
|
async getAssignedTools({
|
|
864
882
|
runtimeContext,
|
|
865
883
|
runId,
|
|
@@ -1239,17 +1257,16 @@ exports.Agent = class Agent extends (_a = chunkP3Q73CAW_cjs.MastraBase) {
|
|
|
1239
1257
|
resourceId
|
|
1240
1258
|
});
|
|
1241
1259
|
}
|
|
1242
|
-
let [memoryMessages, memorySystemMessage] = thread.id && memory ? await Promise.all([
|
|
1243
|
-
threadId: threadObject.id,
|
|
1260
|
+
let [memoryMessages, memorySystemMessage] = thread.id && memory ? await Promise.all([this.getMemoryMessages({
|
|
1244
1261
|
resourceId,
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
})
|
|
1262
|
+
threadId: threadObject.id,
|
|
1263
|
+
vectorMessageSearch: new chunkQUSEDVYI_cjs.MessageList().add(messages, `user`).getLatestUserContent() || "",
|
|
1264
|
+
memoryConfig
|
|
1265
|
+
}), memory.getSystemMessage({
|
|
1249
1266
|
threadId: threadObject.id,
|
|
1250
1267
|
resourceId,
|
|
1251
1268
|
memoryConfig
|
|
1252
|
-
})]) : [[], null
|
|
1269
|
+
})]) : [[], null];
|
|
1253
1270
|
this.logger.debug("Fetched messages from memory", {
|
|
1254
1271
|
threadId: threadObject.id,
|
|
1255
1272
|
runId,
|
|
@@ -1679,7 +1696,7 @@ ${JSON.stringify(
|
|
|
1679
1696
|
this.logger.debug(`Starting agent ${this.name} llm stream call`, {
|
|
1680
1697
|
runId
|
|
1681
1698
|
});
|
|
1682
|
-
const streamResult =
|
|
1699
|
+
const streamResult = llm.__stream({
|
|
1683
1700
|
messages: messageObjects,
|
|
1684
1701
|
temperature,
|
|
1685
1702
|
tools: convertedTools,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFBKJ3652_cjs = require('./chunk-FBKJ3652.cjs');
|
|
4
4
|
var cohereAi = require('cohere-ai');
|
|
5
5
|
|
|
6
6
|
var CohereRelevanceScorer = class {
|
|
@@ -38,7 +38,7 @@ Relevance score (0-1):`;
|
|
|
38
38
|
var MastraAgentRelevanceScorer = class {
|
|
39
39
|
agent;
|
|
40
40
|
constructor(name, model) {
|
|
41
|
-
this.agent = new
|
|
41
|
+
this.agent = new chunkFBKJ3652_cjs.Agent({
|
|
42
42
|
name: `Relevance Scorer ${name}`,
|
|
43
43
|
instructions: `You are a specialized agent for evaluating the relevance of text to queries.
|
|
44
44
|
Your task is to rate how well a text passage answers a given query.
|
|
@@ -8,24 +8,11 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// src/llm/model/base.ts
|
|
10
10
|
var MastraLLMBase = class extends MastraBase {
|
|
11
|
-
|
|
12
|
-
#mastra;
|
|
13
|
-
#model;
|
|
14
|
-
constructor({ name, model }) {
|
|
11
|
+
constructor({ name }) {
|
|
15
12
|
super({
|
|
16
13
|
component: RegisteredLogger.LLM,
|
|
17
14
|
name
|
|
18
15
|
});
|
|
19
|
-
this.#model = model;
|
|
20
|
-
}
|
|
21
|
-
getProvider() {
|
|
22
|
-
return this.#model.provider;
|
|
23
|
-
}
|
|
24
|
-
getModelId() {
|
|
25
|
-
return this.#model.modelId;
|
|
26
|
-
}
|
|
27
|
-
getModel() {
|
|
28
|
-
return this.#model;
|
|
29
16
|
}
|
|
30
17
|
convertToMessages(messages) {
|
|
31
18
|
if (Array.isArray(messages)) {
|
|
@@ -54,33 +41,6 @@ var MastraLLMBase = class extends MastraBase {
|
|
|
54
41
|
this.__setLogger(p.logger);
|
|
55
42
|
}
|
|
56
43
|
}
|
|
57
|
-
__registerMastra(p) {
|
|
58
|
-
this.#mastra = p;
|
|
59
|
-
}
|
|
60
|
-
async __text(input) {
|
|
61
|
-
this.logger.debug(`[LLMs:${this.name}] Generating text.`, { input });
|
|
62
|
-
throw new Error("Method not implemented.");
|
|
63
|
-
}
|
|
64
|
-
async __textObject(input) {
|
|
65
|
-
this.logger.debug(`[LLMs:${this.name}] Generating object.`, { input });
|
|
66
|
-
throw new Error("Method not implemented.");
|
|
67
|
-
}
|
|
68
|
-
async generate(messages, options) {
|
|
69
|
-
this.logger.debug(`[LLMs:${this.name}] Generating text.`, { messages, options });
|
|
70
|
-
throw new Error("Method not implemented.");
|
|
71
|
-
}
|
|
72
|
-
async __stream(input) {
|
|
73
|
-
this.logger.debug(`[LLMs:${this.name}] Streaming text.`, { input });
|
|
74
|
-
throw new Error("Method not implemented.");
|
|
75
|
-
}
|
|
76
|
-
async __streamObject(input) {
|
|
77
|
-
this.logger.debug(`[LLMs:${this.name}] Streaming object.`, { input });
|
|
78
|
-
throw new Error("Method not implemented.");
|
|
79
|
-
}
|
|
80
|
-
async stream(messages, options) {
|
|
81
|
-
this.logger.debug(`[LLMs:${this.name}] Streaming text.`, { messages, options });
|
|
82
|
-
throw new Error("Method not implemented.");
|
|
83
|
-
}
|
|
84
44
|
};
|
|
85
45
|
|
|
86
46
|
// src/llm/model/model.ts
|
|
@@ -88,7 +48,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
88
48
|
#model;
|
|
89
49
|
#mastra;
|
|
90
50
|
constructor({ model, mastra }) {
|
|
91
|
-
super({ name: "aisdk"
|
|
51
|
+
super({ name: "aisdk" });
|
|
92
52
|
this.#model = model;
|
|
93
53
|
if (mastra) {
|
|
94
54
|
this.#mastra = mastra;
|
|
@@ -192,7 +152,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
192
152
|
},
|
|
193
153
|
e
|
|
194
154
|
);
|
|
195
|
-
this.logger.trackException(mastraError);
|
|
196
155
|
throw mastraError;
|
|
197
156
|
}
|
|
198
157
|
this.logger.debug("[LLM] - Step Change:", {
|
|
@@ -252,7 +211,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
252
211
|
},
|
|
253
212
|
e
|
|
254
213
|
);
|
|
255
|
-
this.logger.trackException(mastraError);
|
|
256
214
|
throw mastraError;
|
|
257
215
|
}
|
|
258
216
|
}
|
|
@@ -303,7 +261,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
303
261
|
},
|
|
304
262
|
e
|
|
305
263
|
);
|
|
306
|
-
this.logger.trackException(mastraError);
|
|
307
264
|
throw mastraError;
|
|
308
265
|
}
|
|
309
266
|
this.logger.debug("[LLM] - Step Change:", {
|
|
@@ -354,11 +311,10 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
354
311
|
},
|
|
355
312
|
e
|
|
356
313
|
);
|
|
357
|
-
this.logger.trackException(mastraError);
|
|
358
314
|
throw mastraError;
|
|
359
315
|
}
|
|
360
316
|
}
|
|
361
|
-
|
|
317
|
+
__stream({
|
|
362
318
|
messages,
|
|
363
319
|
onStepFinish,
|
|
364
320
|
onFinish,
|
|
@@ -485,7 +441,7 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
485
441
|
}
|
|
486
442
|
}
|
|
487
443
|
try {
|
|
488
|
-
return
|
|
444
|
+
return streamText({
|
|
489
445
|
messages,
|
|
490
446
|
...argsForExecute,
|
|
491
447
|
experimental_telemetry: {
|
|
@@ -512,11 +468,10 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
512
468
|
},
|
|
513
469
|
e
|
|
514
470
|
);
|
|
515
|
-
this.logger.trackException(mastraError);
|
|
516
471
|
throw mastraError;
|
|
517
472
|
}
|
|
518
473
|
}
|
|
519
|
-
|
|
474
|
+
__streamObject({
|
|
520
475
|
messages,
|
|
521
476
|
runId,
|
|
522
477
|
tools = {},
|
|
@@ -662,7 +617,6 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
662
617
|
},
|
|
663
618
|
e
|
|
664
619
|
);
|
|
665
|
-
this.logger.trackException(mastraError);
|
|
666
620
|
throw mastraError;
|
|
667
621
|
}
|
|
668
622
|
}
|
|
@@ -682,16 +636,16 @@ var MastraLLM = class extends MastraLLMBase {
|
|
|
682
636
|
...rest
|
|
683
637
|
});
|
|
684
638
|
}
|
|
685
|
-
|
|
639
|
+
stream(messages, { maxSteps = 5, output, ...rest }) {
|
|
686
640
|
const msgs = this.convertToMessages(messages);
|
|
687
641
|
if (!output) {
|
|
688
|
-
return
|
|
642
|
+
return this.__stream({
|
|
689
643
|
messages: msgs,
|
|
690
644
|
maxSteps,
|
|
691
645
|
...rest
|
|
692
646
|
});
|
|
693
647
|
}
|
|
694
|
-
return
|
|
648
|
+
return this.__streamObject({
|
|
695
649
|
messages: msgs,
|
|
696
650
|
structuredOutput: output,
|
|
697
651
|
maxSteps,
|
package/dist/eval/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as Metric, T as TestInfo, E as EvaluationResult } from '../types-Bo1uigWx.cjs';
|
|
2
2
|
export { a as MetricResult } from '../types-Bo1uigWx.cjs';
|
|
3
|
-
import { A as Agent } from '../base-
|
|
3
|
+
import { A as Agent } from '../base-CS5eSXbL.cjs';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-B_y9sMg0.cjs';
|
|
6
6
|
import '@opentelemetry/api';
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as Metric, T as TestInfo, E as EvaluationResult } from '../types-Bo1uigWx.js';
|
|
2
2
|
export { a as MetricResult } from '../types-Bo1uigWx.js';
|
|
3
|
-
import { A as Agent } from '../base-
|
|
3
|
+
import { A as Agent } from '../base-DBhKcre4.js';
|
|
4
4
|
import 'ai';
|
|
5
5
|
import '../base-ClrXcCRx.js';
|
|
6
6
|
import '@opentelemetry/api';
|