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

This commit is contained in:
Kartik
2026-07-14 20:03:53 +05:30
committed by GitHub
parent d6d2588ef5
commit 50c3cf44f1
6 changed files with 16 additions and 44 deletions
-1
View File
@@ -59,7 +59,6 @@ export interface ProjectOptions {
export interface PromptUpdatePayload { export interface PromptUpdatePayload {
customInstructions?: string; customInstructions?: string;
customCategories?: custom_categories[]; customCategories?: custom_categories[];
retrievalCriteria?: any[];
version?: string; version?: string;
memoryDepth?: string | null; memoryDepth?: string | null;
usecaseSetting?: string | number; usecaseSetting?: string | number;
+9 -9
View File
@@ -20,7 +20,13 @@ from mem0.client.types import (
from mem0.client.utils import api_error_handler from mem0.client.utils import api_error_handler
# Exception classes are referenced in docstrings only # 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 from mem0.memory.telemetry import capture_client_event, client_telemetry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -725,7 +731,6 @@ class MemoryClient:
options: Optional[ProjectUpdateOptions] = None, options: Optional[ProjectUpdateOptions] = None,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None, custom_categories: Optional[List[str]] = None,
retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
memory_depth: Optional[str] = None, memory_depth: Optional[str] = None,
usecase_setting: Optional[str] = None, usecase_setting: Optional[str] = None,
multilingual: Optional[bool] = None, multilingual: Optional[bool] = None,
@@ -736,7 +741,6 @@ class MemoryClient:
options: Typed options for the update operation (ProjectUpdateOptions). options: Typed options for the update operation (ProjectUpdateOptions).
custom_instructions: New instructions for the project. custom_instructions: New instructions for the project.
custom_categories: New categories 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. memory_depth: Memory depth for the project.
usecase_setting: Usecase setting for the project. usecase_setting: Usecase setting for the project.
multilingual: Whether to use the input language for memory storage and retrieval. multilingual: Whether to use the input language for memory storage and retrieval.
@@ -761,7 +765,6 @@ class MemoryClient:
for k, v in { for k, v in {
"custom_instructions": custom_instructions, "custom_instructions": custom_instructions,
"custom_categories": custom_categories, "custom_categories": custom_categories,
"retrieval_criteria": retrieval_criteria,
"memory_depth": memory_depth, "memory_depth": memory_depth,
"usecase_setting": usecase_setting, "usecase_setting": usecase_setting,
"multilingual": multilingual, "multilingual": multilingual,
@@ -773,7 +776,7 @@ class MemoryClient:
if not kwargs: if not kwargs:
raise ValueError( raise ValueError(
"Currently we only support updating custom_instructions or " "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" "provide at least one of them"
) )
@@ -1630,7 +1633,6 @@ class AsyncMemoryClient:
options: Optional[ProjectUpdateOptions] = None, options: Optional[ProjectUpdateOptions] = None,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None, custom_categories: Optional[List[str]] = None,
retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
memory_depth: Optional[str] = None, memory_depth: Optional[str] = None,
usecase_setting: Optional[str] = None, usecase_setting: Optional[str] = None,
multilingual: Optional[bool] = None, multilingual: Optional[bool] = None,
@@ -1641,7 +1643,6 @@ class AsyncMemoryClient:
options: Typed options for the update operation (ProjectUpdateOptions). options: Typed options for the update operation (ProjectUpdateOptions).
custom_instructions: New instructions for the project. custom_instructions: New instructions for the project.
custom_categories: New categories 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. memory_depth: Memory depth for the project.
usecase_setting: Usecase setting for the project. usecase_setting: Usecase setting for the project.
multilingual: Whether to use the input language for memory storage and retrieval. multilingual: Whether to use the input language for memory storage and retrieval.
@@ -1666,7 +1667,6 @@ class AsyncMemoryClient:
for k, v in { for k, v in {
"custom_instructions": custom_instructions, "custom_instructions": custom_instructions,
"custom_categories": custom_categories, "custom_categories": custom_categories,
"retrieval_criteria": retrieval_criteria,
"memory_depth": memory_depth, "memory_depth": memory_depth,
"usecase_setting": usecase_setting, "usecase_setting": usecase_setting,
"multilingual": multilingual, "multilingual": multilingual,
@@ -1678,7 +1678,7 @@ class AsyncMemoryClient:
if not kwargs: if not kwargs:
raise ValueError( raise ValueError(
"Currently we only support updating custom_instructions or " "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" "provide at least one of them"
) )
+4 -28
View File
@@ -177,7 +177,6 @@ class BaseProject(ABC):
self, self,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None, custom_categories: Optional[List[str]] = None,
retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
""" """
Update project settings. Update project settings.
@@ -185,7 +184,6 @@ class BaseProject(ABC):
Args: Args:
custom_instructions: New instructions for the project custom_instructions: New instructions for the project
custom_categories: New categories for the project custom_categories: New categories for the project
retrieval_criteria: New retrieval criteria for the project
Returns: Returns:
Dictionary containing the API response. Dictionary containing the API response.
@@ -396,7 +394,6 @@ class Project(BaseProject):
self, self,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None, custom_categories: Optional[List[str]] = None,
retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
multilingual: Optional[bool] = None, multilingual: Optional[bool] = None,
decay: Optional[bool] = None, decay: Optional[bool] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
@@ -406,7 +403,6 @@ class Project(BaseProject):
Args: Args:
custom_instructions: New instructions for the project custom_instructions: New instructions for the project
custom_categories: New categories 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 multilingual: Whether to use the input language for memory storage and retrieval
decay: Toggle Memory Decay for this project. When True, search-time decay: Toggle Memory Decay for this project. When True, search-time
ranking boosts recently-used memories and gently dampens stale ones; when ranking boosts recently-used memories and gently dampens stale ones; when
@@ -422,24 +418,16 @@ class Project(BaseProject):
NetworkError: If network connectivity issues occur. NetworkError: If network connectivity issues occur.
ValueError: If org_id or project_id are not set. ValueError: If org_id or project_id are not set.
""" """
if ( if custom_instructions is None and custom_categories is None and multilingual is None and decay is None:
custom_instructions is None
and custom_categories is None
and retrieval_criteria is None
and multilingual is None
and decay is None
):
raise ValueError( raise ValueError(
"At least one parameter must be provided for update: " "At least one parameter must be provided for update: "
"custom_instructions, custom_categories, retrieval_criteria, " "custom_instructions, custom_categories, multilingual, decay"
"multilingual, decay"
) )
payload = self._prepare_params( payload = self._prepare_params(
{ {
"custom_instructions": custom_instructions, "custom_instructions": custom_instructions,
"custom_categories": custom_categories, "custom_categories": custom_categories,
"retrieval_criteria": retrieval_criteria,
"multilingual": multilingual, "multilingual": multilingual,
"decay": decay, "decay": decay,
} }
@@ -455,7 +443,6 @@ class Project(BaseProject):
{ {
"custom_instructions": custom_instructions, "custom_instructions": custom_instructions,
"custom_categories": custom_categories, "custom_categories": custom_categories,
"retrieval_criteria": retrieval_criteria,
"multilingual": multilingual, "multilingual": multilingual,
"decay": decay, "decay": decay,
"sync_type": "sync", "sync_type": "sync",
@@ -720,7 +707,6 @@ class AsyncProject(BaseProject):
self, self,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[List[str]] = None, custom_categories: Optional[List[str]] = None,
retrieval_criteria: Optional[List[Dict[str, Any]]] = None,
multilingual: Optional[bool] = None, multilingual: Optional[bool] = None,
decay: Optional[bool] = None, decay: Optional[bool] = None,
) -> Dict[str, Any]: ) -> Dict[str, Any]:
@@ -730,7 +716,6 @@ class AsyncProject(BaseProject):
Args: Args:
custom_instructions: New instructions for the project custom_instructions: New instructions for the project
custom_categories: New categories 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 multilingual: Whether to use the input language for memory storage and retrieval
decay: Toggle Memory Decay for this project. When True, search-time decay: Toggle Memory Decay for this project. When True, search-time
ranking boosts recently-used memories and gently dampens stale ones; when ranking boosts recently-used memories and gently dampens stale ones; when
@@ -746,24 +731,16 @@ class AsyncProject(BaseProject):
NetworkError: If network connectivity issues occur. NetworkError: If network connectivity issues occur.
ValueError: If org_id or project_id are not set. ValueError: If org_id or project_id are not set.
""" """
if ( if custom_instructions is None and custom_categories is None and multilingual is None and decay is None:
custom_instructions is None
and custom_categories is None
and retrieval_criteria is None
and multilingual is None
and decay is None
):
raise ValueError( raise ValueError(
"At least one parameter must be provided for update: " "At least one parameter must be provided for update: "
"custom_instructions, custom_categories, retrieval_criteria, " "custom_instructions, custom_categories, multilingual, decay"
"multilingual, decay"
) )
payload = self._prepare_params( payload = self._prepare_params(
{ {
"custom_instructions": custom_instructions, "custom_instructions": custom_instructions,
"custom_categories": custom_categories, "custom_categories": custom_categories,
"retrieval_criteria": retrieval_criteria,
"multilingual": multilingual, "multilingual": multilingual,
"decay": decay, "decay": decay,
} }
@@ -779,7 +756,6 @@ class AsyncProject(BaseProject):
{ {
"custom_instructions": custom_instructions, "custom_instructions": custom_instructions,
"custom_categories": custom_categories, "custom_categories": custom_categories,
"retrieval_criteria": retrieval_criteria,
"multilingual": multilingual, "multilingual": multilingual,
"decay": decay, "decay": decay,
"sync_type": "async", "sync_type": "async",
-1
View File
@@ -107,4 +107,3 @@ class ProjectUpdateOptions(BaseModel):
memory_depth: Optional[str] = Field(default=None, description="Memory depth configuration") memory_depth: Optional[str] = Field(default=None, description="Memory depth configuration")
usecase_setting: Optional[Any] = Field(default=None, description="Use case specific settings") usecase_setting: Optional[Any] = Field(default=None, description="Use case specific settings")
multilingual: Optional[bool] = Field(default=None, description="Whether to enable multilingual support") 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")
-2
View File
@@ -424,7 +424,6 @@ class _OSSProject:
self, self,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[list] = None, custom_categories: Optional[list] = None,
retrieval_criteria: Optional[list] = None,
multilingual: Optional[bool] = None, multilingual: Optional[bool] = None,
decay: Optional[bool] = None, decay: Optional[bool] = None,
): ):
@@ -438,7 +437,6 @@ class _AsyncOSSProject:
self, self,
custom_instructions: Optional[str] = None, custom_instructions: Optional[str] = None,
custom_categories: Optional[list] = None, custom_categories: Optional[list] = None,
retrieval_criteria: Optional[list] = None,
multilingual: Optional[bool] = None, multilingual: Optional[bool] = None,
decay: Optional[bool] = None, decay: Optional[bool] = None,
): ):
+3 -3
View File
@@ -2,9 +2,9 @@
parameter-passthrough surface. parameter-passthrough surface.
Verifies the kwarg → JSON payload mapping for every supported field Verifies the kwarg → JSON payload mapping for every supported field
(``custom_instructions``, ``custom_categories``, ``retrieval_criteria``, (``custom_instructions``, ``custom_categories``, ``multilingual``,
``multilingual``, ``decay``), the ValueError when no field is ``decay``), the ValueError when no field is provided, and the
provided, and the URL/method shape. The HTTP layer is mocked. URL/method shape. The HTTP layer is mocked.
""" """
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch