const agent = new Agent({
...
tools: async ({ runtimeContext, mastra }) => {
// How can I read the messages here that were passed to createCompletion?
return {};
},
memory: new Memory({
storage: new PostgresStore({
connectionString: process.env.DATABASE_URL,
}),
vector: new PgVector({
connectionString: process.env.DATABASE_URL,
}),
embedder: openai.embedding("text-embedding-3-small"),
options: {
lastMessages: 2,
semanticRecall: {
topK: 3,
messageRange: 2,
scope: "thread",
indexConfig: {
type: "hnsw",
metric: "dotproduct",
m: 16,
efConstruction: 64,
},
},
threads: {
generateTitle: true,
},
},
}),
});
const agent = new Agent({
...
tools: async ({ runtimeContext, mastra }) => {
// How can I read the messages here that were passed to createCompletion?
return {};
},
memory: new Memory({
storage: new PostgresStore({
connectionString: process.env.DATABASE_URL,
}),
vector: new PgVector({
connectionString: process.env.DATABASE_URL,
}),
embedder: openai.embedding("text-embedding-3-small"),
options: {
lastMessages: 2,
semanticRecall: {
topK: 3,
messageRange: 2,
scope: "thread",
indexConfig: {
type: "hnsw",
metric: "dotproduct",
m: 16,
efConstruction: 64,
},
},
threads: {
generateTitle: true,
},
},
}),
});