Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

refactor(sdk): remove dead retrieval_criteria parameter (#6313)

Kartik50c3cf44f1c5
diff --git a/mem0-ts/src/client/mem0.types.ts b/mem0-ts/src/client/mem0.types.ts
index 8cf862205..d4f54b53f 100644
--- a/mem0-ts/src/client/mem0.types.ts
+++ b/mem0-ts/src/client/mem0.types.ts
@@ -59,7 +59,6 @@ export interface ProjectOptions {
export interface PromptUpdatePayload {
customInstructions?: string;
customCategories?: custom_categories[];
- retrievalCriteria?: any[];
version?: string;
memoryDepth?: string | null;
usecaseSetting?: string | number;
diff --git a/mem0/client/main.py b/mem0/client/main.py
index 853a8588d..4556d6a3f 100644
--- a/mem0/client/main.py
+++ b/mem0/client/main.py
@@ -20,7 +20,13 @@ from mem0.client.types import (
from mem0.client.utils import api_error_handler
# Exception classes are referenced in docstrings only
-from mem0.memory.setup import get_user_id, is_aliased, mark_aliased, read_anon_ids, setup_config
+from mem0.memory.setup import (
+ get_user_id,
+ is_aliased,
+ mark_aliased,
+ read_anon_ids,
+ setup_config,
+)
from mem0.memory.telemetry import capture_client_event, client_telemetry
logger = logging.getLogger(__name__)
@@ -725,7 +731,6 @@ class MemoryClient:
options: Optional[ProjectUpdateOptions] = None,
custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None,
- retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
memory_depth: Optional[str] = None,
usecase_setting: Optional[str] = None,
multilingual: Optional[bool] = None,
@@ -736,7 +741,6 @@ class MemoryClient:
options: Typed options for the update operation (ProjectUpdateOptions).
custom_instructions: New instructions for the project.
custom_categories: New categories for the project.
- retrieval_criteria: New retrieval criteria for the project.
memory_depth: Memory depth for the project.
usecase_setting: Usecase setting for the project.
multilingual: Whether to use the input language for memory storage and retrieval.
@@ -761,7 +765,6 @@ class MemoryClient:
for k, v in {
"custom_instructions": custom_instructions,
"custom_categories": custom_categories,
- "retrieval_criteria": retrieval_criteria,
"memory_depth": memory_depth,
"usecase_setting": usecase_setting,
"multilingual": multilingual,
@@ -773,7 +776,7 @@ class MemoryClient:
if not kwargs:
raise ValueError(
"Currently we only support updating custom_instructions or "
- "custom_categories or retrieval_criteria, so you must "
+ "custom_categories, so you must "
"provide at least one of them"
)
@@ -1630,7 +1633,6 @@ class AsyncMemoryClient:
options: Optional[ProjectUpdateOptions] = None,
custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None,
- retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
memory_depth: Optional[str] = None,
usecase_setting: Optional[str] = None,
multilingual: Optional[bool] = None,
@@ -1641,7 +1643,6 @@ class AsyncMemoryClient:
options: Typed options for the update operation (ProjectUpdateOptions).
custom_instructions: New instructions for the project.
custom_categories: New categories for the project.
- retrieval_criteria: New retrieval criteria for the project.
memory_depth: Memory depth for the project.
usecase_setting: Usecase setting for the project.
multilingual: Whether to use the input language for memory storage and retrieval.
@@ -1666,7 +1667,6 @@ class AsyncMemoryClient:
for k, v in {
"custom_instructions": custom_instructions,
"custom_categories": custom_categories,
- "retrieval_criteria": retrieval_criteria,
"memory_depth": memory_depth,
"usecase_setting": usecase_setting,
"multilingual": multilingual,
@@ -1678,7 +1678,7 @@ class AsyncMemoryClient:
if not kwargs:
raise ValueError(
"Currently we only support updating custom_instructions or "
- "custom_categories or retrieval_criteria, so you must "
+ "custom_categories, so you must "
"provide at least one of them"
)
diff --git a/mem0/client/project.py b/mem0/client/project.py
index 4255bec18..854c3a6cb 100644
--- a/mem0/client/project.py
+++ b/mem0/client/project.py
@@ -177,7 +177,6 @@ class BaseProject(ABC):
self,
custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None,
- retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
) -> Dict[str, Any]:
"""
Update project settings.
@@ -185,7 +184,6 @@ class BaseProject(ABC):
Args:
custom_instructions: New instructions for the project
custom_categories: New categories for the project
- retrieval_criteria: New retrieval criteria for the project
Returns:
Dictionary containing the API response.
@@ -396,7 +394,6 @@ class Project(BaseProject):
self,
custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None,
- retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
multilingual: Optional[bool] = None,
decay: Optional[bool] = None,
) -> Dict[str, Any]:
@@ -406,7 +403,6 @@ class Project(BaseProject):
Args:
custom_instructions: New instructions for the project
custom_categories: New categories for the project
- retrieval_criteria: New retrieval criteria for the project
multilingual: Whether to use the input language for memory storage and retrieval
decay: Toggle Memory Decay for this project. When True, search-time
ranking boosts recently-used memories and gently dampens stale ones; when
@@ -422,24 +418,16 @@ class Project(BaseProject):
NetworkError: If network connectivity issues occur.
ValueError: If org_id or project_id are not set.
"""
- if (
- custom_instructions is None
- and custom_categories is None
- and retrieval_criteria is None
- and multilingual is None
- and decay is None
- ):
+ if custom_instructions is None and custom_categories is None and multilingual is None and decay is None:
raise ValueError(
"At least one parameter must be provided for update: "
- "custom_instructions, custom_categories, retrieval_criteria, "
- "multilingual, decay"
+ "custom_instructions, custom_categories, multilingual, decay"
)
payload = self._prepare_params(
{
"custom_instructions": custom_instructions,
"custom_categories": custom_categories,
- "retrieval_criteria": retrieval_criteria,
"multilingual": multilingual,
"decay": decay,
}
@@ -455,7 +443,6 @@ class Project(BaseProject):
{
"custom_instructions": custom_instructions,
"custom_categories": custom_categories,
- "retrieval_criteria": retrieval_criteria,
"multilingual": multilingual,
"decay": decay,
"sync_type": "sync",
@@ -720,7 +707,6 @@ class AsyncProject(BaseProject):
self,
custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None,
- retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
multilingual: Optional[bool] = None,
decay: Optional[bool] = None,
) -> Dict[str, Any]:
@@ -730,7 +716,6 @@ class AsyncProject(BaseProject):
Args:
custom_instructions: New instructions for the project
custom_categories: New categories for the project
- retrieval_criteria: New retrieval criteria for the project
multilingual: Whether to use the input language for memory storage and retrieval
decay: Toggle Memory Decay for this project. When True, search-time
ranking boosts recently-used memories and gently dampens stale ones; when
@@ -746,24 +731,16 @@ class AsyncProject(BaseProject):
NetworkError: If network connectivity issues occur.
ValueError: If org_id or project_id are not set.
"""
- if (
- custom_instructions is None
- and custom_categories is None
- and retrieval_criteria is None
- and multilingual is None
- and decay is None
- ):
+ if custom_instructions is None and custom_categories is None and multilingual is None and decay is None:
raise ValueError(
"At least one parameter must be provided for update: "
- "custom_instructions, custom_categories, retrieval_criteria, "
- "multilingual, decay"
+ "custom_instructions, custom_categories, multilingual, decay"
)
payload = self._prepare_params(
{
"custom_instructions": custom_instructions,
"custom_categories": custom_categories,
- "retrieval_criteria": retrieval_criteria,
"multilingual": multilingual,
"decay": decay,
}
@@ -779,7 +756,6 @@ class AsyncProject(BaseProject):
{
"custom_instructions": custom_instructions,
"custom_categories": custom_categories,
- "retrieval_criteria": retrieval_criteria,
"multilingual": multilingual,
"decay": decay,
"sync_type": "async",
diff --git a/mem0/client/types.py b/mem0/client/types.py
index 492904a8d..62df27629 100644
--- a/mem0/client/types.py
+++ b/mem0/client/types.py
@@ -107,4 +107,3 @@ class ProjectUpdateOptions(BaseModel):
memory_depth: Optional[str] = Field(default=None, description="Memory depth configuration")
usecase_setting: Optional[Any] = Field(default=None, description="Use case specific settings")
multilingual: Optional[bool] = Field(default=None, description="Whether to enable multilingual support")
- retrieval_criteria: Optional[List[Any]] = Field(default=None, description="Criteria for memory retrieval")
diff --git a/mem0/memory/main.py b/mem0/memory/main.py
index fedabbe5b..3d74cc87a 100644
--- a/mem0/memory/main.py
+++ b/mem0/memory/main.py
@@ -424,7 +424,6 @@ class _OSSProject:
self,
custom_instructions: Optional[str] = None,
custom_categories: Optional[list] = None,
- retrieval_criteria: Optional[list] = None,
multilingual: Optional[bool] = None,
decay: Optional[bool] = None,
):
@@ -438,7 +437,6 @@ class _AsyncOSSProject:
self,
custom_instructions: Optional[str] = None,
custom_categories: Optional[list] = None,
- retrieval_criteria: Optional[list] = None,
multilingual: Optional[bool] = None,
decay: Optional[bool] = None,
):
diff --git a/tests/test_project.py b/tests/test_project.py
index 9f2d9b7a2..b3f48f051 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -2,9 +2,9 @@
parameter-passthrough surface.
Verifies the kwarg → JSON payload mapping for every supported field
-(``custom_instructions``, ``custom_categories``, ``retrieval_criteria``,
-``multilingual``, ``decay``), the ValueError when no field is
-provided, and the URL/method shape. The HTTP layer is mocked.
+(``custom_instructions``, ``custom_categories``, ``multilingual``,
+``decay``), the ValueError when no field is provided, and the
+URL/method shape. The HTTP layer is mocked.
"""
from unittest.mock import MagicMock, patch