Compat

Compatibility layer for smooth migration from old import paths to new structure.

This module provides import aliases to maintain backward compatibility while transitioning to the new package structure.

Classes

class arshai.compat.CompatibilityImporter[source]

Bases: object

Custom importer to handle old import paths and redirect to new ones.

PATH_MAPPING = {'seedwork.interfaces': 'arshai.core.interfaces', 'src.agents': 'arshai.agents', 'src.callbacks': 'arshai.callbacks', 'src.clients': 'arshai.clients', 'src.config': 'arshai.config', 'src.document_loaders': 'arshai.document_loaders', 'src.embeddings': 'arshai.embeddings', 'src.factories': 'arshai.utils', 'src.llms': 'arshai.llms', 'src.memory': 'arshai.memory', 'src.prompts': 'arshai.prompts', 'src.rerankers': 'arshai.rerankers', 'src.speech': 'arshai.speech', 'src.tools': 'arshai.tools', 'src.utils': 'arshai.utils', 'src.vector_db': 'arshai.vector_db', 'src.web_search': 'arshai.web_search', 'src.workflows': 'arshai.workflows'}
classmethod install()[source]

Install the compatibility importer.

find_module(fullname, path=None)[source]

Find module using old import paths.

load_module(fullname)[source]

Load module with deprecation warning.

Functions

arshai.compat.enable_compatibility_mode()[source]

Enable backward compatibility for old import paths.

This function installs a custom importer that redirects old import paths to the new package structure while showing deprecation warnings.

Example

>>> from arshai.compat import enable_compatibility_mode
>>> enable_compatibility_mode()
>>>
>>> # Old imports will now work with warnings
>>> from arshai.core.interfaces.iagent import IAgent  # Shows deprecation warning