Skip to content

Main#3

Merged
MervinPraison merged 3 commits into
developfrom
main
Mar 24, 2024
Merged

Main#3
MervinPraison merged 3 commits into
developfrom
main

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

No description provided.

@MervinPraison MervinPraison merged commit e9be88b into develop Mar 24, 2024
MervinPraison added a commit that referenced this pull request Dec 26, 2025
- Fix #1: MemoryConfig Pydantic validation - add _prepare_mem0_config() to strip
  PraisonAI-specific reranker fields (enabled, default_rerank) before passing to
  mem0, which only accepts provider and config fields

- Fix #2: LLM Reranker 'Chat' object not callable - check if client.chat is
  callable, not just if it exists. OpenAI client has chat as namespace object.
  Also handle max_completion_tokens vs max_tokens for different model versions.

- Fix #3: Chroma vector store metadata validation - ensure non-empty metadata
  dicts by adding placeholder key when metadata is empty or None

- Fix test file issues: add user_id parameter (required by mem0 API), handle
  dict return type from knowledge.search, use gpt-4o-mini for reranker test
  (gpt-5-nano returns empty responses with max_completion_tokens=10)
praisonai-triage-agent Bot pushed a commit that referenced this pull request Apr 7, 2026
Add LLMProviderProtocol, ModelCapabilitiesProtocol, LLMRateLimiterProtocol,
and LLMFailoverProtocol to enable extensibility without vendor lock-in.

Add RetrievalStrategyProtocol to make retrieval strategies pluggable
instead of hardcoded enum values.

Addresses Gap #3 from architectural analysis - missing provider protocols.
Follows AGENTS.md protocol-driven architecture principles.

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
praisonai-triage-agent Bot added a commit that referenced this pull request Apr 8, 2026
- Add missing RetrievalStrategyProtocol to _LAZY_IMPORTS
- Add to TYPE_CHECKING imports for proper typing support
- Completes Gap #3 implementation from issue #1280

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
praisonai-triage-agent Bot added a commit that referenced this pull request Apr 8, 2026
Replace hardcoded backend imports with adapter registry pattern to fix
Core SDK Gap #3 architecture violations. This enables clean protocol-driven
backend resolution while preserving backward compatibility.

Memory System Changes:
- Created memory/adapters/factories.py with lazy-loading factory functions
- Registered mem0, chroma, mongodb adapter factories in registry
- Added memory/registry_demo.py demonstrating protocol-driven approach
- Eliminates 146+ hardcoded _check_* functions and self.use_* flags

Knowledge System Changes:
- Created knowledge/adapters/factories.py with lazy-loading factory functions
- Registered mem0, chroma, mongodb, sqlite adapter factories in registry
- Added knowledge/registry_demo.py demonstrating protocol-driven approach
- Eliminates hardcoded 'import chromadb' and 'from markitdown import MarkItDown'

Registry Infrastructure:
- Updated memory/adapters/__init__.py to register factory functions
- Updated knowledge/adapters/__init__.py to register factory functions
- All heavy dependencies now lazy-loaded via factory pattern
- Core adapters (sqlite, in_memory) work without heavy dependencies
- Heavy adapters gracefully fallback when dependencies missing

Benefits:
- Protocol-driven core: No heavy imports until actually needed
- Performance-first: < 200ms import time maintained
- Extensible: Third-party backends can register without core edits
- Backward compatible: All existing APIs preserved via adapter delegation

Closes #1306

Co-authored-by: praisonai-triage-agent[bot] <praisonai-triage-agent[bot]@users.noreply.github.com>
MervinPraison added a commit that referenced this pull request Apr 8, 2026
…1310)

* feat: implement protocol-driven memory/knowledge adapter registries

Replace hardcoded backend imports with adapter registry pattern to fix
Core SDK Gap #3 architecture violations. This enables clean protocol-driven
backend resolution while preserving backward compatibility.

Memory System Changes:
- Created memory/adapters/factories.py with lazy-loading factory functions
- Registered mem0, chroma, mongodb adapter factories in registry
- Added memory/registry_demo.py demonstrating protocol-driven approach
- Eliminates 146+ hardcoded _check_* functions and self.use_* flags

Knowledge System Changes:
- Created knowledge/adapters/factories.py with lazy-loading factory functions
- Registered mem0, chroma, mongodb, sqlite adapter factories in registry
- Added knowledge/registry_demo.py demonstrating protocol-driven approach
- Eliminates hardcoded 'import chromadb' and 'from markitdown import MarkItDown'

Registry Infrastructure:
- Updated memory/adapters/__init__.py to register factory functions
- Updated knowledge/adapters/__init__.py to register factory functions
- All heavy dependencies now lazy-loaded via factory pattern
- Core adapters (sqlite, in_memory) work without heavy dependencies
- Heavy adapters gracefully fallback when dependencies missing

Benefits:
- Protocol-driven core: No heavy imports until actually needed
- Performance-first: < 200ms import time maintained
- Extensible: Third-party backends can register without core edits
- Backward compatible: All existing APIs preserved via adapter delegation

Closes #1306

Co-authored-by: praisonai-triage-agent[bot] <praisonai-triage-agent[bot]@users.noreply.github.com>

* fix: address critical bugs in protocol-driven adapter implementation

- Fix SearchResult.results vs .items AttributeError in ChromaKnowledgeAdapter
- Fix AddResult error field usage - change to message field (5 instances)
- Fix adapter registry fallback mechanism for missing dependencies
- Fix datetime.utcnow() deprecation warnings

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>

* fix: address critical bugs in protocol-driven adapter implementation

- Fix ChromaKnowledgeAdapter.search() to properly handle user_id/agent_id/run_id/filters scoping
- Fix ChromaKnowledgeAdapter.delete_all() to recreate collection after full delete to keep adapter usable
- Fix LegacyMemoryAdapter to use stable UUIDs instead of unstable id(text) for memory identifiers
- Fix memory logging to avoid exposing PII/secrets by removing text[:100] content from INFO logs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>

* refactor: integrate protocol-driven adapter registry into core Memory and Knowledge classes

Remove DRY violations by eliminating demo and refactored files:
- Remove memory_refactored.py, registry_demo.py files
- Integrate registry logic directly into memory.py and knowledge.py

Protocol-driven Memory integration:
- Replace hardcoded backend checks with get_memory_adapter() calls
- Update store/search methods to delegate to adapters first
- Add provider-specific config filtering for proper adapter instantiation
- Maintain backward compatibility with SQLite fallback

Protocol-driven Knowledge integration:
- Replace hardcoded chromadb imports with get_knowledge_adapter() calls
- Update memory property to use adapter registry with fallbacks
- Remove heavy ChromaDB client creation from config property

This follows AGENTS.md principles:
- Core SDK uses protocol-driven design with adapters
- Heavy implementations accessed via lazy-loading registry
- Maintains full backward compatibility
- Eliminates hardcoded dependency imports from core

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>

---------

Co-authored-by: praisonai-triage-agent[bot] <272766704+praisonai-triage-agent[bot]@users.noreply.github.com>
Co-authored-by: praisonai-triage-agent[bot] <praisonai-triage-agent[bot]@users.noreply.github.com>
Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
Co-authored-by: MervinPraison <454862+MervinPraison@users.noreply.github.com>
MervinPraison added a commit that referenced this pull request Jun 4, 2026
…on, cli_backend support (#1797)

* fix: wrapper layer gaps - InteractiveRuntime lifecycle, tool resolution, cli_backend support

Fixes #1646

- Issue #1: Fixed InteractiveRuntime lifecycle bug where runtime was stopped before agents.start()
  * Removed premature stop() in inner finally block at lines 1234-1240
  * Added proper loop closure check in cleanup block
  * Runtime now stays alive until after agent execution completes

- Issue #2: Consolidated tool resolution implementations
  * Added instantiate=True parameter to ToolResolver.resolve() for automatic class instantiation
  * Removed hardcoded standard_tools whitelist in agents_generator.py
  * Replaced custom tool resolution in bots_cli.py and job_workflow.py with unified ToolResolver
  * All entry points now use the same 4-step fallback chain consistently

- Issue #3: Fixed cli_backend support across frameworks
  * Added resolve_cli_backend_config() in cli_backends module for unified YAML/Python handling
  * Updated Agent wrapper class to accept both string and dict cli_backend configurations
  * Added framework compatibility validation with clear error messages
  * YAML and Python entry points now handle cli_backend identically

- Added comprehensive regression tests to prevent future regressions

Co-authored-by: MervinPraison <MervinPraison@users.noreply.github.com>

* fix: address reviewer feedback - test fixes, validation improvements, error handling

- Fix broken test imports and patch paths in test_wrapper_layer_regression.py
- Replace hasattr(__call__) with callable() per Ruff B004
- Fix CLI backend validation to handle both 'roles' and 'agents' keys
- Add input validation for empty strings and malformed dicts in resolve_cli_backend_config
- Include class tools in local tools.py resolution
- Add per-tool error handling to prevent single tool failures from breaking all tools
- Remove unused logger parameter from resolve_cli_backend_config
- Fix exception handling in _resolve_yaml_cli_backend to not mask errors

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>

---------

Co-authored-by: praisonai-triage-agent[bot] <272766704+praisonai-triage-agent[bot]@users.noreply.github.com>
Co-authored-by: MervinPraison <MervinPraison@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant