LLMContextAggregatorPair: instances can now return a tuple

This commit is contained in:
Aleix Conchillo Flaqué
2026-01-13 13:40:55 -08:00
parent 87d0dc9e24
commit 1ab3bf2ef6

View File

@@ -1052,3 +1052,15 @@ class LLMContextAggregatorPair:
The assistant context aggregator instance.
"""
return self._assistant
def __iter__(self):
"""Allow tuple unpacking of the aggregator pair.
This enables both usage patterns::
pair = LLMContextAggregatorPair(context) # Returns the instance
user, assistant = LLMContextAggregatorPair(context) # Unpacks into tuple
Yields:
The user aggregator, then the assistant aggregator.
"""
return iter((self._user, self._assistant))