diff --git a/strands-py/src/strands/injection/__init__.py b/strands-py/src/strands/injection/__init__.py index e88e4a7dd..d0d58a16d 100644 --- a/strands-py/src/strands/injection/__init__.py +++ b/strands-py/src/strands/injection/__init__.py @@ -2,7 +2,7 @@ This package provides the configuration types for context injection — folding just-in-time text into the model input before a call without touching durable history. The delivery primitives -(in ``message_injection``) are internal; reach injection through the ``ContextInjector`` plugin +(in ``_message_injection``) are internal; reach injection through the ``ContextInjector`` plugin or the ``MemoryManager`` rather than using them directly. """ diff --git a/strands-py/src/strands/injection/message_injection.py b/strands-py/src/strands/injection/_message_injection.py similarity index 100% rename from strands-py/src/strands/injection/message_injection.py rename to strands-py/src/strands/injection/_message_injection.py diff --git a/strands-py/src/strands/injection/xml.py b/strands-py/src/strands/injection/_xml.py similarity index 100% rename from strands-py/src/strands/injection/xml.py rename to strands-py/src/strands/injection/_xml.py diff --git a/strands-py/src/strands/memory/extraction/resolve_extraction_config.py b/strands-py/src/strands/memory/extraction/resolve_extraction_config.py index 120c38ff4..77dd8f200 100644 --- a/strands-py/src/strands/memory/extraction/resolve_extraction_config.py +++ b/strands-py/src/strands/memory/extraction/resolve_extraction_config.py @@ -22,7 +22,7 @@ ) # Default cadence when an ``ExtractionConfig`` omits its ``trigger``: extract every N turns. -DEFAULT_EXTRACTION_TRIGGER_TURNS = 5 +_DEFAULT_EXTRACTION_TRIGGER_TURNS = 5 @dataclass @@ -57,7 +57,7 @@ def _resolve_extraction_config( ``False``/``None`` is off (returns ``None``), ``True`` enables all defaults, an :class:`ExtractionConfig` defaults its unset fields. The defaults are: - - **triggers**: every :data:`DEFAULT_EXTRACTION_TRIGGER_TURNS` turns. An + - **triggers**: every :data:`_DEFAULT_EXTRACTION_TRIGGER_TURNS` turns. An explicit empty list is left empty for the ``MemoryManager`` to reject. - **extractor**: chosen from the methods the store implements. A store that implements only ``add`` cannot extract server-side, so it defaults to a @@ -82,7 +82,7 @@ def _resolve_extraction_config( triggers: list[ExtractionTrigger] if config.trigger is None: - triggers = [IntervalTrigger(turns=DEFAULT_EXTRACTION_TRIGGER_TURNS)] + triggers = [IntervalTrigger(turns=_DEFAULT_EXTRACTION_TRIGGER_TURNS)] elif isinstance(config.trigger, list): triggers = config.trigger else: diff --git a/strands-py/src/strands/memory/memory_manager.py b/strands-py/src/strands/memory/memory_manager.py index 29f1315ee..e938070d8 100644 --- a/strands-py/src/strands/memory/memory_manager.py +++ b/strands-py/src/strands/memory/memory_manager.py @@ -9,8 +9,8 @@ from .._middleware.stages import InvokeModelStage from ..hooks.events import MessageAddedEvent -from ..injection.message_injection import _create_injection_middleware, _is_user_turn -from ..injection.xml import _escape_xml_attr, _escape_xml_text +from ..injection._message_injection import _create_injection_middleware, _is_user_turn +from ..injection._xml import _escape_xml_attr, _escape_xml_text from ..plugins.plugin import Plugin from ..tools.decorator import tool from ..types.exceptions import AggregateMemoryError diff --git a/strands-py/src/strands/vended_plugins/context_injector/plugin.py b/strands-py/src/strands/vended_plugins/context_injector/plugin.py index 1d672d3a8..132e23a2e 100644 --- a/strands-py/src/strands/vended_plugins/context_injector/plugin.py +++ b/strands-py/src/strands/vended_plugins/context_injector/plugin.py @@ -23,7 +23,7 @@ from typing import TYPE_CHECKING from ..._middleware.stages import InvokeModelStage -from ...injection.message_injection import RenderContent, _create_injection_middleware +from ...injection._message_injection import RenderContent, _create_injection_middleware from ...injection.types import InjectionTriggerPredicate from ...plugins import Plugin diff --git a/strands-py/tests/strands/injection/test_message_injection.py b/strands-py/tests/strands/injection/test_message_injection.py index 1ac5741be..4a1314474 100644 --- a/strands-py/tests/strands/injection/test_message_injection.py +++ b/strands-py/tests/strands/injection/test_message_injection.py @@ -6,7 +6,7 @@ import pytest from strands._middleware.stages import InvokeModelContext -from strands.injection.message_injection import ( +from strands.injection._message_injection import ( _create_injection_middleware, _fold_into_last_user_message, _is_user_turn, diff --git a/strands-py/tests/strands/memory/test_resolve_extraction_config.py b/strands-py/tests/strands/memory/test_resolve_extraction_config.py index 3b8bec2ed..3722bf069 100644 --- a/strands-py/tests/strands/memory/test_resolve_extraction_config.py +++ b/strands-py/tests/strands/memory/test_resolve_extraction_config.py @@ -12,7 +12,7 @@ from strands.memory.extraction.model_extractor import ModelExtractor from strands.memory.extraction.resolve_extraction_config import ( - DEFAULT_EXTRACTION_TRIGGER_TURNS, + _DEFAULT_EXTRACTION_TRIGGER_TURNS, _resolve_extraction_config, ) from strands.memory.extraction.triggers import IntervalTrigger, InvocationTrigger @@ -78,8 +78,8 @@ def test_defaults_an_omitted_trigger_to_interval_of_default_turns(): assert len(resolved_config.triggers) == 1 trigger = resolved_config.triggers[0] assert isinstance(trigger, IntervalTrigger) - assert trigger._turns == DEFAULT_EXTRACTION_TRIGGER_TURNS - assert DEFAULT_EXTRACTION_TRIGGER_TURNS == 5 + assert trigger._turns == _DEFAULT_EXTRACTION_TRIGGER_TURNS + assert _DEFAULT_EXTRACTION_TRIGGER_TURNS == 5 def test_wraps_a_single_trigger_into_a_list():