memorisdk 2.0.0__tar.gz → 2.0.1__tar.gz
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.
Potentially problematic release.
This version of memorisdk might be problematic. Click here for more details.
- {memorisdk-2.0.0 → memorisdk-2.0.1}/PKG-INFO +15 -9
- {memorisdk-2.0.0 → memorisdk-2.0.1}/README.md +14 -8
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/__init__.py +1 -1
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/agents/retrieval_agent.py +79 -12
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/core/memory.py +61 -17
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/search_service.py +201 -49
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/sqlalchemy_manager.py +62 -13
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/tools/memory_tool.py +94 -4
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memorisdk.egg-info/PKG-INFO +15 -9
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memorisdk.egg-info/SOURCES.txt +0 -1
- {memorisdk-2.0.0 → memorisdk-2.0.1}/pyproject.toml +1 -1
- memorisdk-2.0.0/memori/scripts/llm_text.py +0 -50
- {memorisdk-2.0.0 → memorisdk-2.0.1}/LICENSE +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/agents/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/agents/conscious_agent.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/agents/memory_agent.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/config/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/config/manager.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/config/memory_manager.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/config/settings.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/core/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/core/conversation.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/core/database.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/core/providers.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/adapters/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/adapters/mysql_adapter.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/adapters/postgresql_adapter.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/adapters/sqlite_adapter.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/auto_creator.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/connection_utils.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/connectors/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/connectors/base_connector.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/connectors/mysql_connector.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/connectors/postgres_connector.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/connectors/sqlite_connector.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/models.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/queries/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/queries/base_queries.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/queries/chat_queries.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/queries/entity_queries.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/queries/memory_queries.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/query_translator.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/schema_generators/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/schema_generators/mysql_schema_generator.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/search/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/search/mysql_search_adapter.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/search/sqlite_search_adapter.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/templates/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/templates/basic_template.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/database/templates/schemas/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/integrations/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/integrations/anthropic_integration.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/integrations/litellm_integration.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/integrations/openai_integration.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/tools/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/__init__.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/exceptions.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/helpers.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/input_validator.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/logging.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/pydantic_models.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/query_builder.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/schemas.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/security_audit.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/security_integration.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/transaction_manager.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memori/utils/validators.py +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memorisdk.egg-info/dependency_links.txt +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memorisdk.egg-info/requires.txt +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/memorisdk.egg-info/top_level.txt +0 -0
- {memorisdk-2.0.0 → memorisdk-2.0.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: memorisdk
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: The Open-Source Memory Layer for AI Agents & Multi-Agent Systems
|
|
5
5
|
Author-email: GibsonAI Team <noc@gibsonai.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -458,19 +458,25 @@ memori/
|
|
|
458
458
|
- **[Memory Retrieval](./memory_retrival_example.py)** - Function calling with memory tools
|
|
459
459
|
- **[Advanced Config](./examples/advanced_config.py)** - Production configuration
|
|
460
460
|
- **[Interactive Demo](./memori_example.py)** - Live conscious ingestion showcase
|
|
461
|
+
- **[Simple Multi-User](./examples/multiple-users/simple_multiuser.py)** - Basic demonstration of user memory isolation with namespaces
|
|
462
|
+
- **[FastAPI Multi-User App](./examples/multiple-users/fastapi_multiuser_app.py)** - Full-featured REST API with Swagger UI for testing multi-user functionality
|
|
461
463
|
|
|
462
464
|
## Framework Integrations
|
|
463
465
|
|
|
464
466
|
Memori works seamlessly with popular AI frameworks:
|
|
465
467
|
|
|
466
|
-
| Framework | Description | Example |
|
|
467
|
-
|
|
468
|
-
|
|
|
469
|
-
|
|
|
470
|
-
|
|
|
471
|
-
|
|
|
472
|
-
|
|
|
473
|
-
|
|
|
468
|
+
| Framework | Description | Example |
|
|
469
|
+
|-----------|-------------|---------|
|
|
470
|
+
| [AgentOps](./examples/integrations/agentops_example.py) | Track and monitor Memori memory operations with comprehensive observability | Memory operation tracking with AgentOps analytics |
|
|
471
|
+
| [Agno](./examples/integrations/agno_example.py) | Memory-enhanced agent framework integration with persistent conversations | Simple chat agent with memory search |
|
|
472
|
+
| [AWS Strands](./examples/integrations/aws_strands_example.py) | Professional development coach with Strands SDK and persistent memory | Career coaching agent with goal tracking |
|
|
473
|
+
| [Azure AI Foundry](./examples/integrations/azure_ai_foundry_example.py) | Azure AI Foundry agents with persistent memory across conversations | Enterprise AI agents with Azure integration |
|
|
474
|
+
| [CamelAI](./examples/integrations/camelai_example.py) | Multi-agent communication framework with automatic memory recording and retrieval | Memory-enhanced chat agents with conversation continuity |
|
|
475
|
+
| [CrewAI](./examples/integrations/crewai_example.py) | Multi-agent system with shared memory across agent interactions | Collaborative agents with memory |
|
|
476
|
+
| [Digital Ocean AI](./examples/integrations/digital_ocean_example.py) | Memory-enhanced customer support using Digital Ocean's AI platform | Customer support assistant with conversation history |
|
|
477
|
+
| [LangChain](./examples/integrations/langchain_example.py) | Enterprise-grade agent framework with advanced memory integration | AI assistant with LangChain tools and memory |
|
|
478
|
+
| [OpenAI Agent](./examples/integrations/openai_agent_example.py) | Memory-enhanced OpenAI Agent with function calling and user preference tracking | Interactive assistant with memory search and user info storage |
|
|
479
|
+
| [Swarms](./examples/integrations/swarms_example.py) | Multi-agent system framework with persistent memory capabilities | Memory-enhanced Swarms agents with auto/conscious ingestion |
|
|
474
480
|
|
|
475
481
|
## Interactive Demos
|
|
476
482
|
|
|
@@ -363,19 +363,25 @@ memori/
|
|
|
363
363
|
- **[Memory Retrieval](./memory_retrival_example.py)** - Function calling with memory tools
|
|
364
364
|
- **[Advanced Config](./examples/advanced_config.py)** - Production configuration
|
|
365
365
|
- **[Interactive Demo](./memori_example.py)** - Live conscious ingestion showcase
|
|
366
|
+
- **[Simple Multi-User](./examples/multiple-users/simple_multiuser.py)** - Basic demonstration of user memory isolation with namespaces
|
|
367
|
+
- **[FastAPI Multi-User App](./examples/multiple-users/fastapi_multiuser_app.py)** - Full-featured REST API with Swagger UI for testing multi-user functionality
|
|
366
368
|
|
|
367
369
|
## Framework Integrations
|
|
368
370
|
|
|
369
371
|
Memori works seamlessly with popular AI frameworks:
|
|
370
372
|
|
|
371
|
-
| Framework | Description | Example |
|
|
372
|
-
|
|
373
|
-
|
|
|
374
|
-
|
|
|
375
|
-
|
|
|
376
|
-
|
|
|
377
|
-
|
|
|
378
|
-
|
|
|
373
|
+
| Framework | Description | Example |
|
|
374
|
+
|-----------|-------------|---------|
|
|
375
|
+
| [AgentOps](./examples/integrations/agentops_example.py) | Track and monitor Memori memory operations with comprehensive observability | Memory operation tracking with AgentOps analytics |
|
|
376
|
+
| [Agno](./examples/integrations/agno_example.py) | Memory-enhanced agent framework integration with persistent conversations | Simple chat agent with memory search |
|
|
377
|
+
| [AWS Strands](./examples/integrations/aws_strands_example.py) | Professional development coach with Strands SDK and persistent memory | Career coaching agent with goal tracking |
|
|
378
|
+
| [Azure AI Foundry](./examples/integrations/azure_ai_foundry_example.py) | Azure AI Foundry agents with persistent memory across conversations | Enterprise AI agents with Azure integration |
|
|
379
|
+
| [CamelAI](./examples/integrations/camelai_example.py) | Multi-agent communication framework with automatic memory recording and retrieval | Memory-enhanced chat agents with conversation continuity |
|
|
380
|
+
| [CrewAI](./examples/integrations/crewai_example.py) | Multi-agent system with shared memory across agent interactions | Collaborative agents with memory |
|
|
381
|
+
| [Digital Ocean AI](./examples/integrations/digital_ocean_example.py) | Memory-enhanced customer support using Digital Ocean's AI platform | Customer support assistant with conversation history |
|
|
382
|
+
| [LangChain](./examples/integrations/langchain_example.py) | Enterprise-grade agent framework with advanced memory integration | AI assistant with LangChain tools and memory |
|
|
383
|
+
| [OpenAI Agent](./examples/integrations/openai_agent_example.py) | Memory-enhanced OpenAI Agent with function calling and user preference tracking | Interactive assistant with memory search and user info storage |
|
|
384
|
+
| [Swarms](./examples/integrations/swarms_example.py) | Multi-agent system framework with persistent memory capabilities | Memory-enhanced Swarms agents with auto/conscious ingestion |
|
|
379
385
|
|
|
380
386
|
## Interactive Demos
|
|
381
387
|
|
|
@@ -5,7 +5,7 @@ Professional-grade memory layer with comprehensive error handling, configuration
|
|
|
5
5
|
management, and modular architecture for production AI systems.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "2.0.
|
|
8
|
+
__version__ = "2.0.1"
|
|
9
9
|
__author__ = "Harshal More"
|
|
10
10
|
__email__ = "harshalmore2468@gmail.com"
|
|
11
11
|
|
|
@@ -411,32 +411,96 @@ Be strategic and comprehensive in your search planning."""
|
|
|
411
411
|
|
|
412
412
|
# This would need to be implemented in the database manager
|
|
413
413
|
# For now, get all memories and filter by category
|
|
414
|
+
logger.debug(
|
|
415
|
+
f"Searching memories by categories: {categories} in namespace: {namespace}"
|
|
416
|
+
)
|
|
414
417
|
all_results = db_manager.search_memories(
|
|
415
418
|
query="", namespace=namespace, limit=limit * 3
|
|
416
419
|
)
|
|
417
420
|
|
|
421
|
+
logger.debug(
|
|
422
|
+
f"Retrieved {len(all_results)} total results for category filtering"
|
|
423
|
+
)
|
|
424
|
+
|
|
418
425
|
filtered_results = []
|
|
419
|
-
for result in all_results:
|
|
426
|
+
for i, result in enumerate(all_results):
|
|
427
|
+
logger.debug(f"Processing result {i+1}/{len(all_results)}: {type(result)}")
|
|
428
|
+
|
|
420
429
|
# Extract category from processed_data if it's stored as JSON
|
|
421
430
|
try:
|
|
422
|
-
|
|
431
|
+
memory_category = None
|
|
432
|
+
|
|
433
|
+
# Check processed_data field first
|
|
434
|
+
if "processed_data" in result and result["processed_data"]:
|
|
423
435
|
processed_data = result["processed_data"]
|
|
436
|
+
logger.debug(
|
|
437
|
+
f"Found processed_data: {type(processed_data)} - {str(processed_data)[:100]}..."
|
|
438
|
+
)
|
|
439
|
+
|
|
424
440
|
# Handle both dict and JSON string formats
|
|
425
441
|
if isinstance(processed_data, str):
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
442
|
+
try:
|
|
443
|
+
processed_data = json.loads(processed_data)
|
|
444
|
+
except json.JSONDecodeError as je:
|
|
445
|
+
logger.debug(f"JSON decode error for processed_data: {je}")
|
|
446
|
+
continue
|
|
447
|
+
|
|
448
|
+
if isinstance(processed_data, dict):
|
|
449
|
+
# Try multiple possible category locations
|
|
450
|
+
category_paths = [
|
|
451
|
+
["category", "primary_category"],
|
|
452
|
+
["category"],
|
|
453
|
+
["primary_category"],
|
|
454
|
+
["metadata", "category"],
|
|
455
|
+
["classification", "category"],
|
|
456
|
+
]
|
|
457
|
+
|
|
458
|
+
for path in category_paths:
|
|
459
|
+
temp_data = processed_data
|
|
460
|
+
try:
|
|
461
|
+
for key in path:
|
|
462
|
+
temp_data = temp_data.get(key, {})
|
|
463
|
+
if isinstance(temp_data, str) and temp_data:
|
|
464
|
+
memory_category = temp_data
|
|
465
|
+
logger.debug(
|
|
466
|
+
f"Found category via path {path}: {memory_category}"
|
|
467
|
+
)
|
|
468
|
+
break
|
|
469
|
+
except (AttributeError, TypeError):
|
|
470
|
+
continue
|
|
471
|
+
else:
|
|
472
|
+
logger.debug(
|
|
473
|
+
f"processed_data is not a dict after parsing: {type(processed_data)}"
|
|
474
|
+
)
|
|
475
|
+
continue
|
|
429
476
|
|
|
430
|
-
|
|
431
|
-
|
|
477
|
+
# Fallback: check direct category field
|
|
478
|
+
if not memory_category and "category" in result and result["category"]:
|
|
479
|
+
memory_category = result["category"]
|
|
480
|
+
logger.debug(f"Found category via direct field: {memory_category}")
|
|
481
|
+
|
|
482
|
+
# Check if the found category matches any of our target categories
|
|
483
|
+
if memory_category:
|
|
484
|
+
logger.debug(
|
|
485
|
+
f"Comparing memory category '{memory_category}' against target categories {categories}"
|
|
432
486
|
)
|
|
433
487
|
if memory_category in categories:
|
|
434
488
|
filtered_results.append(result)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
489
|
+
logger.debug(f"✓ Category match found: {memory_category}")
|
|
490
|
+
else:
|
|
491
|
+
logger.debug(
|
|
492
|
+
f"✗ Category mismatch: {memory_category} not in {categories}"
|
|
493
|
+
)
|
|
494
|
+
else:
|
|
495
|
+
logger.debug("No category found in result")
|
|
496
|
+
|
|
497
|
+
except Exception as e:
|
|
498
|
+
logger.debug(f"Error processing result {i+1}: {e}")
|
|
438
499
|
continue
|
|
439
500
|
|
|
501
|
+
logger.debug(
|
|
502
|
+
f"Category filtering complete: {len(filtered_results)} results match categories {categories}"
|
|
503
|
+
)
|
|
440
504
|
return filtered_results[:limit]
|
|
441
505
|
|
|
442
506
|
def _detect_structured_output_support(self) -> bool:
|
|
@@ -821,8 +885,11 @@ Be strategic and comprehensive in your search planning."""
|
|
|
821
885
|
"""
|
|
822
886
|
# This is a compatibility method that uses the database manager directly
|
|
823
887
|
# We'll need the database manager to be injected or passed
|
|
824
|
-
# For now, return empty list and log the issue
|
|
825
|
-
logger.warning(
|
|
888
|
+
# For now, return empty list and log the issue with parameters
|
|
889
|
+
logger.warning(
|
|
890
|
+
f"search_memories called without database manager: query='{query}', "
|
|
891
|
+
f"max_results={max_results}, namespace='{namespace}'"
|
|
892
|
+
)
|
|
826
893
|
return []
|
|
827
894
|
|
|
828
895
|
|
|
@@ -1036,15 +1036,38 @@ class Memori:
|
|
|
1036
1036
|
self._in_context_retrieval = True
|
|
1037
1037
|
|
|
1038
1038
|
logger.debug(
|
|
1039
|
-
f"Auto-ingest: Starting context retrieval for query: '{user_input[:50]}...'"
|
|
1039
|
+
f"Auto-ingest: Starting context retrieval for query: '{user_input[:50]}...' in namespace: '{self.namespace}'"
|
|
1040
1040
|
)
|
|
1041
1041
|
|
|
1042
1042
|
# Always try direct database search first as it's more reliable
|
|
1043
1043
|
logger.debug("Auto-ingest: Using direct database search (primary method)")
|
|
1044
|
-
|
|
1045
|
-
|
|
1044
|
+
logger.debug(
|
|
1045
|
+
f"Auto-ingest: Database manager type: {type(self.db_manager).__name__}"
|
|
1046
1046
|
)
|
|
1047
1047
|
|
|
1048
|
+
try:
|
|
1049
|
+
results = self.db_manager.search_memories(
|
|
1050
|
+
query=user_input, namespace=self.namespace, limit=5
|
|
1051
|
+
)
|
|
1052
|
+
logger.debug(
|
|
1053
|
+
f"Auto-ingest: Database search returned {len(results) if results else 0} results"
|
|
1054
|
+
)
|
|
1055
|
+
|
|
1056
|
+
if results:
|
|
1057
|
+
for i, result in enumerate(
|
|
1058
|
+
results[:3]
|
|
1059
|
+
): # Log first 3 results for debugging
|
|
1060
|
+
logger.debug(
|
|
1061
|
+
f"Auto-ingest: Result {i+1}: {type(result)} with keys: {list(result.keys()) if isinstance(result, dict) else 'N/A'}"
|
|
1062
|
+
)
|
|
1063
|
+
except Exception as db_search_e:
|
|
1064
|
+
logger.error(f"Auto-ingest: Database search failed: {db_search_e}")
|
|
1065
|
+
logger.debug(
|
|
1066
|
+
f"Auto-ingest: Database search error details: {type(db_search_e).__name__}: {str(db_search_e)}",
|
|
1067
|
+
exc_info=True,
|
|
1068
|
+
)
|
|
1069
|
+
results = []
|
|
1070
|
+
|
|
1048
1071
|
if results:
|
|
1049
1072
|
logger.debug(
|
|
1050
1073
|
f"Auto-ingest: Direct database search returned {len(results)} results"
|
|
@@ -1085,8 +1108,12 @@ class Memori:
|
|
|
1085
1108
|
)
|
|
1086
1109
|
|
|
1087
1110
|
except Exception as search_error:
|
|
1088
|
-
logger.
|
|
1089
|
-
f"Auto-ingest: Search engine failed
|
|
1111
|
+
logger.error(
|
|
1112
|
+
f"Auto-ingest: Search engine failed for query '{user_input[:50]}...': {search_error}"
|
|
1113
|
+
)
|
|
1114
|
+
logger.debug(
|
|
1115
|
+
f"Auto-ingest: Search engine error details: {type(search_error).__name__}: {str(search_error)}",
|
|
1116
|
+
exc_info=True,
|
|
1090
1117
|
)
|
|
1091
1118
|
else:
|
|
1092
1119
|
logger.debug("Auto-ingest: No search engine available")
|
|
@@ -1095,22 +1122,39 @@ class Memori:
|
|
|
1095
1122
|
logger.debug(
|
|
1096
1123
|
"Auto-ingest: All search methods returned 0 results, using recent memories fallback"
|
|
1097
1124
|
)
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
namespace=self.namespace,
|
|
1101
|
-
limit=3,
|
|
1125
|
+
logger.debug(
|
|
1126
|
+
f"Auto-ingest: Attempting fallback search in namespace '{self.namespace}'"
|
|
1102
1127
|
)
|
|
1103
1128
|
|
|
1104
|
-
|
|
1129
|
+
try:
|
|
1130
|
+
fallback_results = self.db_manager.search_memories(
|
|
1131
|
+
query="", # Empty query to get recent memories
|
|
1132
|
+
namespace=self.namespace,
|
|
1133
|
+
limit=3,
|
|
1134
|
+
)
|
|
1105
1135
|
logger.debug(
|
|
1106
|
-
f"Auto-ingest: Fallback returned {len(fallback_results)}
|
|
1136
|
+
f"Auto-ingest: Fallback search returned {len(fallback_results) if fallback_results else 0} results"
|
|
1137
|
+
)
|
|
1138
|
+
|
|
1139
|
+
if fallback_results:
|
|
1140
|
+
logger.debug(
|
|
1141
|
+
f"Auto-ingest: Fallback returned {len(fallback_results)} recent memories"
|
|
1142
|
+
)
|
|
1143
|
+
# Add search metadata to fallback results
|
|
1144
|
+
for result in fallback_results:
|
|
1145
|
+
if isinstance(result, dict):
|
|
1146
|
+
result["retrieval_method"] = "recent_memories_fallback"
|
|
1147
|
+
result["retrieval_query"] = user_input
|
|
1148
|
+
return fallback_results
|
|
1149
|
+
else:
|
|
1150
|
+
logger.debug("Auto-ingest: Fallback search returned no results")
|
|
1151
|
+
|
|
1152
|
+
except Exception as fallback_e:
|
|
1153
|
+
logger.error(f"Auto-ingest: Fallback search failed: {fallback_e}")
|
|
1154
|
+
logger.debug(
|
|
1155
|
+
f"Auto-ingest: Fallback error details: {type(fallback_e).__name__}: {str(fallback_e)}",
|
|
1156
|
+
exc_info=True,
|
|
1107
1157
|
)
|
|
1108
|
-
# Add search metadata to fallback results
|
|
1109
|
-
for result in fallback_results:
|
|
1110
|
-
if isinstance(result, dict):
|
|
1111
|
-
result["retrieval_method"] = "recent_memories_fallback"
|
|
1112
|
-
result["retrieval_query"] = user_input
|
|
1113
|
-
return fallback_results
|
|
1114
1158
|
|
|
1115
1159
|
logger.debug(
|
|
1116
1160
|
"Auto-ingest: All retrieval methods failed, returning empty context"
|