mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-11 22:51:05 +00:00
This commit is contained in:
parent
0104a2572c
commit
5ecc334989
3 changed files with 27 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@supermemory/tools",
|
||||
"type": "module",
|
||||
"version": "1.4.6",
|
||||
"version": "1.4.7",
|
||||
"description": "Memory tools for AI SDK, OpenAI, Voltagent and Mastra with supermemory",
|
||||
"scripts": {
|
||||
"build": "tsdown",
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ export const createSupermemoryContext = (
|
|||
metadata,
|
||||
searchMode,
|
||||
entityContext,
|
||||
verbose = false,
|
||||
} = options
|
||||
|
||||
// Runtime validation: customId is required
|
||||
|
|
@ -99,7 +100,7 @@ export const createSupermemoryContext = (
|
|||
)
|
||||
}
|
||||
|
||||
const logger = createLogger(false) // VoltAgent SDK doesn't use verbose
|
||||
const logger = createLogger(verbose)
|
||||
const normalizedBaseUrl = normalizeBaseUrl(baseUrl)
|
||||
|
||||
const client = new Supermemory({
|
||||
|
|
@ -243,6 +244,15 @@ export const enhanceMessagesWithMemories = async (
|
|||
ctx.include !== undefined ||
|
||||
ctx.searchMode !== undefined
|
||||
|
||||
// Warn if advanced search params are set but mode is "profile"
|
||||
// Profile mode only fetches static/dynamic user data, not query-based search
|
||||
if (useAdvancedSearch && ctx.mode === "profile") {
|
||||
ctx.logger.warn(
|
||||
"Advanced search parameters (threshold, limit, rerank, rewriteQuery, filters, include, searchMode) " +
|
||||
'are ignored when mode is "profile". Use mode "query" or "full" to enable advanced search.',
|
||||
)
|
||||
}
|
||||
|
||||
let memories: string
|
||||
|
||||
if (useAdvancedSearch && ctx.mode !== "profile") {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ import type {
|
|||
* Configuration options for the Supermemory VoltAgent integration.
|
||||
* Extends base options with VoltAgent-specific settings.
|
||||
*/
|
||||
export interface SupermemoryVoltAgent
|
||||
extends Omit<SupermemoryBaseOptions, "verbose"> {
|
||||
export interface SupermemoryVoltAgent extends SupermemoryBaseOptions {
|
||||
/**
|
||||
* Custom ID to group messages into a single document.
|
||||
* Ensures related messages are added to the same document for that conversation.
|
||||
|
|
@ -29,34 +28,46 @@ export interface SupermemoryVoltAgent
|
|||
* Threshold / sensitivity for memory selection. 0 is least sensitive (returns
|
||||
* most memories, more results), 1 is most sensitive (returns fewer memories,
|
||||
* more accurate results). Default: 0.1
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
threshold?: number
|
||||
|
||||
/**
|
||||
* Maximum number of memory results to return. Default: 10
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
limit?: number
|
||||
|
||||
/**
|
||||
* If true, rerank the results based on the query. This helps ensure the most
|
||||
* relevant results are returned. Default: false
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
rerank?: boolean
|
||||
|
||||
/**
|
||||
* If true, rewrites the query to make it easier to find memories. This increases
|
||||
* latency by about 400ms. Default: false
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
rewriteQuery?: boolean
|
||||
|
||||
/**
|
||||
* Advanced filters to apply to the search using AND/OR logic.
|
||||
* Example: { OR: [{ metadata: { type: "note" } }, { metadata: { type: "conversation" } }] }
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
filters?: SearchFilters
|
||||
|
||||
/**
|
||||
* Control what additional data to include in search results
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
include?: IncludeOptions
|
||||
|
||||
|
|
@ -71,6 +82,8 @@ export interface SupermemoryVoltAgent
|
|||
* - "memories": Search only memory entries (atomic facts)
|
||||
* - "documents": Search only document chunks
|
||||
* - "hybrid": Search both memories AND document chunks (recommended)
|
||||
*
|
||||
* Note: Only effective when mode is "query" or "full". Ignored in "profile" mode.
|
||||
*/
|
||||
searchMode?: "memories" | "documents" | "hybrid"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue