@mastra/pg 1.7.1 → 1.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - - Fixed experiment pending count showing negative values when experiments are triggered from the Studio ([#13831](https://github.com/mastra-ai/mastra/pull/13831))
8
+ - Fixed scorer prompt metadata (analysis context, generated prompts) being lost when saving experiment scores
9
+ - Updated dependencies [[`41e48c1`](https://github.com/mastra-ai/mastra/commit/41e48c198eee846478e60c02ec432c19d322a517), [`82469d3`](https://github.com/mastra-ai/mastra/commit/82469d3135d5a49dd8dc8feec0ff398b4e0225a0), [`33e2fd5`](https://github.com/mastra-ai/mastra/commit/33e2fd5088f83666df17401e2da68c943dbc0448), [`7ef6e2c`](https://github.com/mastra-ai/mastra/commit/7ef6e2c61be5a42e26f55d15b5902866fc76634f), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`fa37d39`](https://github.com/mastra-ai/mastra/commit/fa37d39910421feaf8847716292e3d65dd4f30c2), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`71c38bf`](https://github.com/mastra-ai/mastra/commit/71c38bf905905148ecd0e75c07c1f9825d299b76), [`f993c38`](https://github.com/mastra-ai/mastra/commit/f993c3848c97479b813231be872443bedeced6ab), [`f51849a`](https://github.com/mastra-ai/mastra/commit/f51849a568935122b5100b7ee69704e6d680cf7b), [`9bf3a0d`](https://github.com/mastra-ai/mastra/commit/9bf3a0dac602787925f1762f1f0387d7b4a59620), [`cafa045`](https://github.com/mastra-ai/mastra/commit/cafa0453c9de141ad50c09a13894622dffdd9978), [`1fd9ddb`](https://github.com/mastra-ai/mastra/commit/1fd9ddbb3fe83b281b12bd2e27e426ae86288266), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443), [`d9d228c`](https://github.com/mastra-ai/mastra/commit/d9d228c0c6ae82ae6ce3b540a3a56b2b1c2b8d98), [`5576507`](https://github.com/mastra-ai/mastra/commit/55765071e360fb97e443aa0a91ccf7e1cd8d92aa), [`79d69c9`](https://github.com/mastra-ai/mastra/commit/79d69c9d5f842ff1c31352fb6026f04c1f6190f3), [`94f44b8`](https://github.com/mastra-ai/mastra/commit/94f44b827ce57b179e50f4916a84c0fa6e7f3b8c), [`13187db`](https://github.com/mastra-ai/mastra/commit/13187dbac880174232dedc5a501ff6c5d0fe59bc), [`2ae5311`](https://github.com/mastra-ai/mastra/commit/2ae531185fff66a80fa165c0999e3d801900e89d), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443)]:
10
+ - @mastra/core@1.10.0
11
+
12
+ ## 1.7.2-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - - Fixed experiment pending count showing negative values when experiments are triggered from the Studio ([#13831](https://github.com/mastra-ai/mastra/pull/13831))
17
+ - Fixed scorer prompt metadata (analysis context, generated prompts) being lost when saving experiment scores
18
+ - Updated dependencies [[`41e48c1`](https://github.com/mastra-ai/mastra/commit/41e48c198eee846478e60c02ec432c19d322a517), [`82469d3`](https://github.com/mastra-ai/mastra/commit/82469d3135d5a49dd8dc8feec0ff398b4e0225a0), [`33e2fd5`](https://github.com/mastra-ai/mastra/commit/33e2fd5088f83666df17401e2da68c943dbc0448), [`7ef6e2c`](https://github.com/mastra-ai/mastra/commit/7ef6e2c61be5a42e26f55d15b5902866fc76634f), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`fa37d39`](https://github.com/mastra-ai/mastra/commit/fa37d39910421feaf8847716292e3d65dd4f30c2), [`b12d2a5`](https://github.com/mastra-ai/mastra/commit/b12d2a59a48be0477cabae66eb6cf0fc94a7d40d), [`71c38bf`](https://github.com/mastra-ai/mastra/commit/71c38bf905905148ecd0e75c07c1f9825d299b76), [`f993c38`](https://github.com/mastra-ai/mastra/commit/f993c3848c97479b813231be872443bedeced6ab), [`f51849a`](https://github.com/mastra-ai/mastra/commit/f51849a568935122b5100b7ee69704e6d680cf7b), [`9bf3a0d`](https://github.com/mastra-ai/mastra/commit/9bf3a0dac602787925f1762f1f0387d7b4a59620), [`cafa045`](https://github.com/mastra-ai/mastra/commit/cafa0453c9de141ad50c09a13894622dffdd9978), [`1fd9ddb`](https://github.com/mastra-ai/mastra/commit/1fd9ddbb3fe83b281b12bd2e27e426ae86288266), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443), [`d9d228c`](https://github.com/mastra-ai/mastra/commit/d9d228c0c6ae82ae6ce3b540a3a56b2b1c2b8d98), [`5576507`](https://github.com/mastra-ai/mastra/commit/55765071e360fb97e443aa0a91ccf7e1cd8d92aa), [`79d69c9`](https://github.com/mastra-ai/mastra/commit/79d69c9d5f842ff1c31352fb6026f04c1f6190f3), [`94f44b8`](https://github.com/mastra-ai/mastra/commit/94f44b827ce57b179e50f4916a84c0fa6e7f3b8c), [`13187db`](https://github.com/mastra-ai/mastra/commit/13187dbac880174232dedc5a501ff6c5d0fe59bc), [`2ae5311`](https://github.com/mastra-ai/mastra/commit/2ae531185fff66a80fa165c0999e3d801900e89d), [`6135ef4`](https://github.com/mastra-ai/mastra/commit/6135ef4f5288652bf45f616ec590607e4c95f443)]:
19
+ - @mastra/core@1.10.0-alpha.0
20
+
3
21
  ## 1.7.1
4
22
 
5
23
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.7.1"
6
+ version: "1.7.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.1",
2
+ "version": "1.7.2",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -147,8 +147,24 @@ Supported embedding models:
147
147
 
148
148
  - **OpenAI**: `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`
149
149
  - **Google**: `gemini-embedding-001`
150
+ - **OpenRouter**: Access embedding models from various providers
150
151
 
151
- The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`).
152
+ ```ts
153
+ import { Agent } from '@mastra/core/agent'
154
+ import { Memory } from '@mastra/memory'
155
+ import { ModelRouterEmbeddingModel } from '@mastra/core/llm'
156
+
157
+ const agent = new Agent({
158
+ memory: new Memory({
159
+ embedder: new ModelRouterEmbeddingModel({
160
+ providerId: 'openrouter',
161
+ modelId: 'openai/text-embedding-3-small',
162
+ }),
163
+ }),
164
+ })
165
+ ```
166
+
167
+ The model router automatically handles API key detection from environment variables (`OPENAI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`, `OPENROUTER_API_KEY`).
152
168
 
153
169
  ### Using AI SDK Packages
154
170
 
@@ -22,35 +22,33 @@ export const agent = new Agent({
22
22
  })
23
23
  ```
24
24
 
25
- > To enable `workingMemory` on an agent, you’ll need a storage provider configured on your main Mastra instance. See [Mastra class](https://mastra.ai/reference/core/mastra-class) for more information.
25
+ > **Note:** To enable `workingMemory` on an agent, you’ll need a storage provider configured on your main Mastra instance. See [Mastra class](https://mastra.ai/reference/core/mastra-class) for more information.
26
26
 
27
27
  ## Constructor parameters
28
28
 
29
- **storage?:** (`MastraCompositeStore`): Storage implementation for persisting memory data. Defaults to \`new DefaultStorage({ config: { url: "file:memory.db" } })\` if not provided.
29
+ **storage** (`MastraCompositeStore`): Storage implementation for persisting memory data. Defaults to \`new DefaultStorage({ config: { url: "file:memory.db" } })\` if not provided.
30
30
 
31
- **vector?:** (`MastraVector | false`): Vector store for semantic search capabilities. Set to \`false\` to disable vector operations.
31
+ **vector** (`MastraVector | false`): Vector store for semantic search capabilities. Set to \`false\` to disable vector operations.
32
32
 
33
- **embedder?:** (`EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder instance for vector embeddings. Required when semantic recall is enabled.
33
+ **embedder** (`EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder instance for vector embeddings. Required when semantic recall is enabled.
34
34
 
35
- **options?:** (`MemoryConfig`): Memory configuration options.
35
+ **options** (`MemoryConfig`): Memory configuration options.
36
36
 
37
- ### Options parameters
37
+ **options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to \`false\` to disable loading conversation history into context. Use \`Number.MAX\_SAFE\_INTEGER\` to retrieve all messages with no limit. To prevent saving new messages, use the \`readOnly\` option instead.
38
38
 
39
- **lastMessages?:** (`number | false`): Number of most recent messages to include in context. Set to \`false\` to disable loading conversation history into context. Use \`Number.MAX\_SAFE\_INTEGER\` to retrieve all messages with no limit. To prevent saving new messages, use the \`readOnly\` option instead. (Default: `10`)
39
+ **options.readOnly** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory.
40
40
 
41
- **readOnly?:** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory. (Default: `false`)
41
+ **options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires both vector store and embedder to be configured. Default topK is 4, default messageRange is {before: 1, after: 1}.
42
42
 
43
- **semanticRecall?:** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires both vector store and embedder to be configured. Default topK is 4, default messageRange is {before: 1, after: 1}. (Default: `false`)
43
+ **options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be \`{ enabled: boolean; template?: string; schema?: ZodObject\<any> | JSONSchema7; scope?: 'thread' | 'resource' }\` or \`{ enabled: boolean }\` to disable.
44
44
 
45
- **workingMemory?:** (`WorkingMemory`): Configuration for working memory feature. Can be \`{ enabled: boolean; template?: string; schema?: ZodObject\<any> | JSONSchema7; scope?: 'thread' | 'resource' }\` or \`{ enabled: boolean }\` to disable. (Default: `{ enabled: false, template: '# User Information\n- **First Name**:\n- **Last Name**:\n...' }`)
45
+ **options.observationalMemory** (`boolean | ObservationalMemoryOptions`): Enable Observational Memory for long-context agentic memory. Set to \`true\` for defaults, or pass a config object to customize token budgets, models, and scope. See \[Observational Memory reference]\(/reference/memory/observational-memory) for configuration details.
46
46
 
47
- **observationalMemory?:** (`boolean | ObservationalMemoryOptions`): Enable Observational Memory for long-context agentic memory. Set to \`true\` for defaults, or pass a config object to customize token budgets, models, and scope. See \[Observational Memory reference]\(/reference/memory/observational-memory) for configuration details. (Default: `false`)
48
-
49
- **generateTitle?:** (`boolean | { model: DynamicArgument<MastraLanguageModel>; instructions?: DynamicArgument<string> }`): Controls automatic thread title generation from the user's first message. Can be a boolean or an object with custom model and instructions. (Default: `false`)
47
+ **options.generateTitle** (`boolean | { model: DynamicArgument<MastraLanguageModel>; instructions?: DynamicArgument<string> }`): Controls automatic thread title generation from the user's first message. Can be a boolean or an object with custom model and instructions.
50
48
 
51
49
  ## Returns
52
50
 
53
- **memory:** (`Memory`): A new Memory instance with the specified configuration.
51
+ **memory** (`Memory`): A new Memory instance with the specified configuration.
54
52
 
55
53
  ## Extended usage example
56
54
 
@@ -15,23 +15,21 @@ const processor = new MessageHistory({
15
15
 
16
16
  ## Constructor parameters
17
17
 
18
- **options:** (`MessageHistoryOptions`): Configuration options for the message history processor
18
+ **options** (`MessageHistoryOptions`): Configuration options for the message history processor
19
19
 
20
- ### Options
20
+ **options.storage** (`MemoryStorage`): Storage instance for retrieving and persisting messages
21
21
 
22
- **storage:** (`MemoryStorage`): Storage instance for retrieving and persisting messages
23
-
24
- **lastMessages?:** (`number`): Maximum number of historical messages to retrieve. If not specified, retrieves all messages
22
+ **options.lastMessages** (`number`): Maximum number of historical messages to retrieve. If not specified, retrieves all messages
25
23
 
26
24
  ## Returns
27
25
 
28
- **id:** (`string`): Processor identifier set to 'message-history'
26
+ **id** (`string`): Processor identifier set to 'message-history'
29
27
 
30
- **name:** (`string`): Processor display name set to 'MessageHistory'
28
+ **name** (`string`): Processor display name set to 'MessageHistory'
31
29
 
32
- **processInput:** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Fetches historical messages from storage and adds them to the message list
30
+ **processInput** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Fetches historical messages from storage and adds them to the message list
33
31
 
34
- **processOutputResult:** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList>`): Persists new messages (user input and assistant response) to storage, excluding system messages
32
+ **processOutputResult** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList>`): Persists new messages (user input and assistant response) to storage, excluding system messages
35
33
 
36
34
  ## Extended usage example
37
35
 
@@ -20,37 +20,35 @@ const processor = new SemanticRecall({
20
20
 
21
21
  ## Constructor parameters
22
22
 
23
- **options:** (`SemanticRecallOptions`): Configuration options for the semantic recall processor
23
+ **options** (`SemanticRecallOptions`): Configuration options for the semantic recall processor
24
24
 
25
- ### Options
25
+ **options.storage** (`MemoryStorage`): Storage instance for retrieving messages
26
26
 
27
- **storage:** (`MemoryStorage`): Storage instance for retrieving messages
27
+ **options.vector** (`MastraVector`): Vector store for semantic search
28
28
 
29
- **vector:** (`MastraVector`): Vector store for semantic search
29
+ **options.embedder** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings
30
30
 
31
- **embedder:** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings
31
+ **options.topK** (`number`): Number of most similar messages to retrieve
32
32
 
33
- **topK?:** (`number`): Number of most similar messages to retrieve
33
+ **options.messageRange** (`number | { before: number; after: number }`): Number of context messages to include before/after each match. Can be a single number (same for both) or an object with separate values
34
34
 
35
- **messageRange?:** (`number | { before: number; after: number }`): Number of context messages to include before/after each match. Can be a single number (same for both) or an object with separate values
35
+ **options.scope** (`'thread' | 'resource'`): Scope of semantic search. 'thread' searches within the current thread only. 'resource' searches across all threads for the resource
36
36
 
37
- **scope?:** (`'thread' | 'resource'`): Scope of semantic search. 'thread' searches within the current thread only. 'resource' searches across all threads for the resource
37
+ **options.threshold** (`number`): Minimum similarity score threshold (0-1). Messages below this threshold are filtered out
38
38
 
39
- **threshold?:** (`number`): Minimum similarity score threshold (0-1). Messages below this threshold are filtered out
39
+ **options.indexName** (`string`): Index name for the vector store. If not provided, auto-generated based on embedder model
40
40
 
41
- **indexName?:** (`string`): Index name for the vector store. If not provided, auto-generated based on embedder model
42
-
43
- **logger?:** (`IMastraLogger`): Optional logger instance for structured logging
41
+ **options.logger** (`IMastraLogger`): Optional logger instance for structured logging
44
42
 
45
43
  ## Returns
46
44
 
47
- **id:** (`string`): Processor identifier set to 'semantic-recall'
45
+ **id** (`string`): Processor identifier set to 'semantic-recall'
48
46
 
49
- **name:** (`string`): Processor display name set to 'SemanticRecall'
47
+ **name** (`string`): Processor display name set to 'SemanticRecall'
50
48
 
51
- **processInput:** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Performs semantic search on historical messages and adds relevant context to the message list
49
+ **processInput** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Performs semantic search on historical messages and adds relevant context to the message list
52
50
 
53
- **processOutputResult:** (`(args: { messages: MastraDBMessage[]; messageList?: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Creates embeddings for new messages to enable future semantic search
51
+ **processOutputResult** (`(args: { messages: MastraDBMessage[]; messageList?: MessageList; abort: (reason?: string) => never; tracingContext?: TracingContext; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Creates embeddings for new messages to enable future semantic search
54
52
 
55
53
  ## Extended usage example
56
54
 
@@ -23,39 +23,35 @@ const processor = new WorkingMemory({
23
23
 
24
24
  ## Constructor parameters
25
25
 
26
- **options:** (`Options`): Configuration options for the working memory processor
26
+ **options** (`Options`): Configuration options for the working memory processor
27
27
 
28
- ### Options
28
+ **options.storage** (`MemoryStorage`): Storage instance for retrieving working memory data
29
29
 
30
- **storage:** (`MemoryStorage`): Storage instance for retrieving working memory data
30
+ **options.template** (`WorkingMemoryTemplate`): Template defining the format and structure of working memory
31
31
 
32
- **template?:** (`WorkingMemoryTemplate`): Template defining the format and structure of working memory
32
+ **options.template.format** (`'markdown' | 'json'`): Format of the working memory content
33
33
 
34
- **scope?:** (`'thread' | 'resource'`): Scope of working memory. 'thread' scopes to current thread, 'resource' shares across all threads for the resource
34
+ **options.template.content** (`string`): Template content defining the structure of working memory data
35
35
 
36
- **useVNext?:** (`boolean`): Use the next-generation instruction format with improved guidelines
36
+ **options.scope** (`'thread' | 'resource'`): Scope of working memory. 'thread' scopes to current thread, 'resource' shares across all threads for the resource
37
37
 
38
- **readOnly?:** (`boolean`): When true, working memory is provided as read-only context. The data is injected into the conversation but without the updateWorkingMemory tool or update instructions. Useful for agents that should reference working memory without modifying it.
38
+ **options.useVNext** (`boolean`): Use the next-generation instruction format with improved guidelines
39
39
 
40
- **templateProvider?:** (`{ getWorkingMemoryTemplate(args: { memoryConfig?: MemoryConfig }): Promise<WorkingMemoryTemplate | null> }`): Dynamic template provider for runtime template resolution
40
+ **options.readOnly** (`boolean`): When true, working memory is provided as read-only context. The data is injected into the conversation but without the updateWorkingMemory tool or update instructions. Useful for agents that should reference working memory without modifying it.
41
41
 
42
- **logger?:** (`IMastraLogger`): Optional logger instance for structured logging
42
+ **options.templateProvider** (`{ getWorkingMemoryTemplate(args: { memoryConfig?: MemoryConfig }): Promise<WorkingMemoryTemplate | null> }`): Dynamic template provider for runtime template resolution
43
43
 
44
- ### WorkingMemoryTemplate
45
-
46
- **format:** (`'markdown' | 'json'`): Format of the working memory content
47
-
48
- **content:** (`string`): Template content defining the structure of working memory data
44
+ **options.logger** (`IMastraLogger`): Optional logger instance for structured logging
49
45
 
50
46
  ## Returns
51
47
 
52
- **id:** (`string`): Processor identifier set to 'working-memory'
48
+ **id** (`string`): Processor identifier set to 'working-memory'
53
49
 
54
- **name:** (`string`): Processor display name set to 'WorkingMemory'
50
+ **name** (`string`): Processor display name set to 'WorkingMemory'
55
51
 
56
- **defaultWorkingMemoryTemplate:** (`string`): The default markdown template used when no custom template is provided
52
+ **defaultWorkingMemoryTemplate** (`string`): The default markdown template used when no custom template is provided
57
53
 
58
- **processInput:** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Retrieves working memory and adds it as a system message to the message list
54
+ **processInput** (`(args: { messages: MastraDBMessage[]; messageList: MessageList; abort: (reason?: string) => never; requestContext?: RequestContext }) => Promise<MessageList | MastraDBMessage[]>`): Retrieves working memory and adds it as a system message to the message list
59
55
 
60
56
  ## Extended usage example
61
57
 
@@ -120,23 +120,23 @@ export const mastra = new Mastra({
120
120
 
121
121
  ## Options
122
122
 
123
- **id:** (`string`): Unique identifier for this storage instance.
123
+ **id** (`string`): Unique identifier for this storage instance.
124
124
 
125
- **default?:** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in \`domains\` will use this storage's domains as fallbacks.
125
+ **default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in \`domains\` will use this storage's domains as fallbacks.
126
126
 
127
- **domains?:** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over the default storage.
127
+ **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over the default storage.
128
128
 
129
- **domains.memory?:** (`MemoryStorage`): Storage for threads, messages, and resources.
129
+ **domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
130
130
 
131
- **domains.workflows?:** (`WorkflowsStorage`): Storage for workflow snapshots.
131
+ **domains.workflows** (`WorkflowsStorage`): Storage for workflow snapshots.
132
132
 
133
- **domains.scores?:** (`ScoresStorage`): Storage for evaluation scores.
133
+ **domains.scores** (`ScoresStorage`): Storage for evaluation scores.
134
134
 
135
- **domains.observability?:** (`ObservabilityStorage`): Storage for traces and spans.
135
+ **domains.observability** (`ObservabilityStorage`): Storage for traces and spans.
136
136
 
137
- **domains.agents?:** (`AgentsStorage`): Storage for stored agent configurations.
137
+ **domains.agents** (`AgentsStorage`): Storage for stored agent configurations.
138
138
 
139
- **disableInit?:** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
139
+ **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
140
140
 
141
141
  ## Initialization
142
142
 
@@ -108,17 +108,17 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
108
108
 
109
109
  ## Parameters
110
110
 
111
- **id:** (`string`): Unique identifier for this storage instance.
111
+ **id** (`string`): Unique identifier for this storage instance.
112
112
 
113
- **config.tableName:** (`string`): The name of your DynamoDB table.
113
+ **config.tableName** (`string`): The name of your DynamoDB table.
114
114
 
115
- **config.region?:** (`string`): AWS region. Defaults to 'us-east-1'. For local development, can be set to 'localhost' or similar.
115
+ **config.region** (`string`): AWS region. Defaults to 'us-east-1'. For local development, can be set to 'localhost' or similar.
116
116
 
117
- **config.endpoint?:** (`string`): Custom endpoint for DynamoDB (e.g., 'http\://localhost:8000' for local development).
117
+ **config.endpoint** (`string`): Custom endpoint for DynamoDB (e.g., 'http\://localhost:8000' for local development).
118
118
 
119
- **config.credentials?:** (`object`): AWS credentials object with \`accessKeyId\` and \`secretAccessKey\`. If not provided, the AWS SDK will attempt to source credentials from environment variables, IAM roles (e.g., for EC2/Lambda), or the shared AWS credentials file.
119
+ **config.credentials** (`object`): AWS credentials object with \`accessKeyId\` and \`secretAccessKey\`. If not provided, the AWS SDK will attempt to source credentials from environment variables, IAM roles (e.g., for EC2/Lambda), or the shared AWS credentials file.
120
120
 
121
- **config.ttl?:** (`object`): TTL (Time To Live) configuration for automatic data expiration. Configure per entity type: thread, message, trace, eval, workflow\_snapshot, resource, score. Each entity config includes: enabled (boolean), attributeName (string, default: 'ttl'), defaultTtlSeconds (number).
121
+ **config.ttl** (`object`): TTL (Time To Live) configuration for automatic data expiration. Configure per entity type: thread, message, trace, eval, workflow\_snapshot, resource, score. Each entity config includes: enabled (boolean), attributeName (string, default: 'ttl'), defaultTtlSeconds (number).
122
122
 
123
123
  ## TTL (Time To Live) Configuration
124
124
 
@@ -188,11 +188,11 @@ TTL can be configured for these entity types:
188
188
 
189
189
  Each entity type accepts the following configuration:
190
190
 
191
- **enabled:** (`boolean`): Whether TTL is enabled for this entity type.
191
+ **enabled** (`boolean`): Whether TTL is enabled for this entity type.
192
192
 
193
- **attributeName?:** (`string`): The DynamoDB attribute name to use for TTL. Must match the TTL attribute configured on your DynamoDB table. Defaults to 'ttl'.
193
+ **attributeName** (`string`): The DynamoDB attribute name to use for TTL. Must match the TTL attribute configured on your DynamoDB table. Defaults to 'ttl'.
194
194
 
195
- **defaultTtlSeconds?:** (`number`): Default TTL in seconds from item creation time. Items will be automatically deleted by DynamoDB after this duration.
195
+ **defaultTtlSeconds** (`number`): Default TTL in seconds from item creation time. Items will be automatically deleted by DynamoDB after this duration.
196
196
 
197
197
  ### Enabling TTL on Your DynamoDB Table
198
198
 
@@ -41,35 +41,35 @@ const storage = new PostgresStore({
41
41
 
42
42
  ## Parameters
43
43
 
44
- **id:** (`string`): Unique identifier for this storage instance.
44
+ **id** (`string`): Unique identifier for this storage instance.
45
45
 
46
- **connectionString?:** (`string`): PostgreSQL connection string (e.g., postgresql://user:pass\@host:5432/dbname). Required unless using \`pool\` or individual host-based parameters (\`host\`, \`port\`, \`database\`, \`user\`, \`password\`).
46
+ **connectionString** (`string`): PostgreSQL connection string (e.g., postgresql://user:pass\@host:5432/dbname). Required unless using \`pool\` or individual host-based parameters (\`host\`, \`port\`, \`database\`, \`user\`, \`password\`).
47
47
 
48
- **host?:** (`string`): Database server hostname or IP address. Used with other host-based parameters as an alternative to connectionString.
48
+ **host** (`string`): Database server hostname or IP address. Used with other host-based parameters as an alternative to connectionString.
49
49
 
50
- **port?:** (`number`): Database server port number. Defaults to 5432 if not specified.
50
+ **port** (`number`): Database server port number. Defaults to 5432 if not specified.
51
51
 
52
- **database?:** (`string`): Name of the database to connect to.
52
+ **database** (`string`): Name of the database to connect to.
53
53
 
54
- **user?:** (`string`): Database user for authentication.
54
+ **user** (`string`): Database user for authentication.
55
55
 
56
- **password?:** (`string`): Password for the database user.
56
+ **password** (`string`): Password for the database user.
57
57
 
58
- **pool?:** (`pg.Pool`): Pre-configured pg.Pool instance. Use this to reuse an existing connection pool. When provided, Mastra will not create its own pool and will not close it when \`store.close()\` is called.
58
+ **pool** (`pg.Pool`): Pre-configured pg.Pool instance. Use this to reuse an existing connection pool. When provided, Mastra will not create its own pool and will not close it when \`store.close()\` is called.
59
59
 
60
- **schemaName?:** (`string`): The name of the schema you want the storage to use. Defaults to 'public'.
60
+ **schemaName** (`string`): The name of the schema you want the storage to use. Defaults to 'public'.
61
61
 
62
- **ssl?:** (`boolean | ConnectionOptions`): SSL configuration for the connection; set to true to use default SSL or provide a ConnectionOptions object for custom SSL settings.
62
+ **ssl** (`boolean | ConnectionOptions`): SSL configuration for the connection; set to true to use default SSL or provide a ConnectionOptions object for custom SSL settings.
63
63
 
64
- **max?:** (`number`): Maximum number of connections in the pool. Defaults to 20.
64
+ **max** (`number`): Maximum number of connections in the pool. Defaults to 20.
65
65
 
66
- **idleTimeoutMillis?:** (`number`): How long a connection can sit idle before being closed. Defaults to 30000 (30 seconds).
66
+ **idleTimeoutMillis** (`number`): How long a connection can sit idle before being closed. Defaults to 30000 (30 seconds).
67
67
 
68
- **disableInit?:** (`boolean`): When true, automatic table creation/migrations are disabled. Useful for CI/CD pipelines where migrations are run separately.
68
+ **disableInit** (`boolean`): When true, automatic table creation/migrations are disabled. Useful for CI/CD pipelines where migrations are run separately.
69
69
 
70
- **skipDefaultIndexes?:** (`boolean`): When true, default indexes will not be created during initialization.
70
+ **skipDefaultIndexes** (`boolean`): When true, default indexes will not be created during initialization.
71
71
 
72
- **indexes?:** (`CreateIndexOptions[]`): Custom indexes to create during initialization.
72
+ **indexes** (`CreateIndexOptions[]`): Custom indexes to create during initialization.
73
73
 
74
74
  ## Constructor Examples
75
75
 
@@ -448,25 +448,25 @@ For advanced index types, you can specify additional options:
448
448
 
449
449
  ### Index Options
450
450
 
451
- **name:** (`string`): Unique name for the index
451
+ **name** (`string`): Unique name for the index
452
452
 
453
- **table:** (`string`): Table name (e.g., 'mastra\_threads')
453
+ **table** (`string`): Table name (e.g., 'mastra\_threads')
454
454
 
455
- **columns:** (`string[]`): Array of column names with optional sort order (e.g., \['id', 'createdAt DESC'])
455
+ **columns** (`string[]`): Array of column names with optional sort order (e.g., \['id', 'createdAt DESC'])
456
456
 
457
- **unique?:** (`boolean`): Creates a unique constraint index
457
+ **unique** (`boolean`): Creates a unique constraint index
458
458
 
459
- **concurrent?:** (`boolean`): Creates index without locking table (default: true)
459
+ **concurrent** (`boolean`): Creates index without locking table (default: true)
460
460
 
461
- **where?:** (`string`): Partial index condition (PostgreSQL specific)
461
+ **where** (`string`): Partial index condition (PostgreSQL specific)
462
462
 
463
- **method?:** (`'btree' | 'hash' | 'gin' | 'gist' | 'spgist' | 'brin'`): Index method (default: 'btree')
463
+ **method** (`'btree' | 'hash' | 'gin' | 'gist' | 'spgist' | 'brin'`): Index method (default: 'btree')
464
464
 
465
- **opclass?:** (`string`): Operator class for GIN/GIST indexes
465
+ **opclass** (`string`): Operator class for GIN/GIST indexes
466
466
 
467
- **storage?:** (`Record<string, any>`): Storage parameters (e.g., { fillfactor: 90 })
467
+ **storage** (`Record<string, any>`): Storage parameters (e.g., { fillfactor: 90 })
468
468
 
469
- **tablespace?:** (`string`): Tablespace name for index placement
469
+ **tablespace** (`string`): Tablespace name for index placement
470
470
 
471
471
  ### Schema-Specific Indexes
472
472
 
@@ -19,53 +19,65 @@ const queryTool = createVectorQueryTool({
19
19
 
20
20
  > **Note:** **Parameter Requirements:** Most fields can be set at creation as defaults. Some fields can be overridden at runtime via the request context or input. If a required field is missing from both creation and runtime, an error will be thrown. Note that `model`, `id`, and `description` can only be set at creation time.
21
21
 
22
- **id?:** (`string`): Custom ID for the tool. By default: 'VectorQuery {vectorStoreName} {indexName} Tool'. (Set at creation only.)
22
+ **id** (`string`): Custom ID for the tool. By default: 'VectorQuery {vectorStoreName} {indexName} Tool'. (Set at creation only.)
23
23
 
24
- **description?:** (`string`): Custom description for the tool. By default: 'Access the knowledge base to find information needed to answer user questions' (Set at creation only.)
24
+ **description** (`string`): Custom description for the tool. By default: 'Access the knowledge base to find information needed to answer user questions' (Set at creation only.)
25
25
 
26
- **model:** (`EmbeddingModel`): Embedding model to use for vector search. (Set at creation only.)
26
+ **model** (`EmbeddingModel`): Embedding model to use for vector search. (Set at creation only.)
27
27
 
28
- **vectorStoreName:** (`string`): Name of the vector store to query. (Can be set at creation or overridden at runtime.)
28
+ **vectorStoreName** (`string`): Name of the vector store to query. (Can be set at creation or overridden at runtime.)
29
29
 
30
- **indexName:** (`string`): Name of the index within the vector store. (Can be set at creation or overridden at runtime.)
30
+ **indexName** (`string`): Name of the index within the vector store. (Can be set at creation or overridden at runtime.)
31
31
 
32
- **enableFilter?:** (`boolean`): Enable filtering of results based on metadata. (Set at creation only, but will be automatically enabled if a filter is provided in the request context.) (Default: `false`)
32
+ **enableFilter** (`boolean`): Enable filtering of results based on metadata. (Set at creation only, but will be automatically enabled if a filter is provided in the request context.) (Default: `false`)
33
33
 
34
- **includeVectors?:** (`boolean`): Include the embedding vectors in the results. (Can be set at creation or overridden at runtime.) (Default: `false`)
34
+ **includeVectors** (`boolean`): Include the embedding vectors in the results. (Can be set at creation or overridden at runtime.) (Default: `false`)
35
35
 
36
- **includeSources?:** (`boolean`): Include the full retrieval objects in the results. (Can be set at creation or overridden at runtime.) (Default: `true`)
36
+ **includeSources** (`boolean`): Include the full retrieval objects in the results. (Can be set at creation or overridden at runtime.) (Default: `true`)
37
37
 
38
- **reranker?:** (`RerankConfig`): Options for reranking results. (Can be set at creation or overridden at runtime.)
38
+ **reranker** (`RerankConfig`): Options for reranking results. (Can be set at creation or overridden at runtime.)
39
39
 
40
- **databaseConfig?:** (`DatabaseConfig`): Database-specific configuration options for optimizing queries. (Can be set at creation or overridden at runtime.)
40
+ **reranker.model** (`MastraLanguageModel`): Language model to use for reranking
41
41
 
42
- **providerOptions?:** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). \*\*Important\*\*: Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
42
+ **reranker.options** (`RerankerOptions`): Options for the reranking process
43
43
 
44
- **vectorStore?:** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, \`vectorStoreName\` becomes optional.
44
+ **reranker.options.weights** (`WeightConfig`): Weights for scoring components (semantic: 0.4, vector: 0.4, position: 0.2)
45
45
 
46
- ### DatabaseConfig
46
+ **reranker.options.topK** (`number`): Number of top results to return
47
47
 
48
- The `DatabaseConfig` type allows you to specify database-specific configurations that are automatically applied to query operations. This enables you to take advantage of unique features and optimizations offered by different vector stores.
48
+ **databaseConfig** (`DatabaseConfig`): Database-specific configuration options for optimizing queries. (Can be set at creation or overridden at runtime.)
49
49
 
50
- **pinecone?:** (`PineconeConfig`): objectnamespace?:stringPinecone namespace for organizing vectorssparseVector?:{ indices: number\[]; values: number\[]; }Sparse vector for hybrid search
50
+ **databaseConfig.pinecone** (`PineconeConfig`): Configuration specific to Pinecone vector store
51
51
 
52
- **pgvector?:** (`PgVectorConfig`): objectminScore?:numberMinimum similarity score threshold for resultsef?:numberHNSW search parameter - controls accuracy vs speed tradeoffprobes?:numberIVFFlat probe parameter - number of cells to visit during search
52
+ **databaseConfig.pinecone.namespace** (`string`): Pinecone namespace for organizing vectors
53
53
 
54
- **chroma?:** (`ChromaConfig`): objectwhere?:Record\<string, any>Metadata filtering conditionswhereDocument?:Record\<string, any>Document content filtering conditions
54
+ **databaseConfig.pinecone.sparseVector** (`{ indices: number[]; values: number[]; }`): Sparse vector for hybrid search
55
55
 
56
- ### RerankConfig
56
+ **databaseConfig.pgvector** (`PgVectorConfig`): Configuration specific to PostgreSQL with pgvector extension
57
57
 
58
- **model:** (`MastraLanguageModel`): Language model to use for reranking
58
+ **databaseConfig.pgvector.minScore** (`number`): Minimum similarity score threshold for results
59
59
 
60
- **options?:** (`RerankerOptions`): objectweights?:WeightConfigWeights for scoring components (semantic: 0.4, vector: 0.4, position: 0.2)topK?:numberNumber of top results to return
60
+ **databaseConfig.pgvector.ef** (`number`): HNSW search parameter - controls accuracy vs speed tradeoff
61
+
62
+ **databaseConfig.pgvector.probes** (`number`): IVFFlat probe parameter - number of cells to visit during search
63
+
64
+ **databaseConfig.chroma** (`ChromaConfig`): Configuration specific to Chroma vector store
65
+
66
+ **databaseConfig.chroma.where** (`Record<string, any>`): Metadata filtering conditions
67
+
68
+ **databaseConfig.chroma.whereDocument** (`Record<string, any>`): Document content filtering conditions
69
+
70
+ **providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). \*\*Important\*\*: Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
71
+
72
+ **vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, \`vectorStoreName\` becomes optional.
61
73
 
62
74
  ## Returns
63
75
 
64
76
  The tool returns an object with:
65
77
 
66
- **relevantContext:** (`string`): Combined text from the most relevant document chunks
78
+ **relevantContext** (`string`): Combined text from the most relevant document chunks
67
79
 
68
- **sources:** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
80
+ **sources** (`QueryResult[]`): Array of full retrieval result objects. Each object contains all information needed to reference the original document, chunk, and similarity score.
69
81
 
70
82
  ### QueryResult object structure
71
83