Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion strands-py/src/strands/injection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions strands-py/src/strands/memory/memory_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down
Loading