Fix mutable default arguments in LLMContextAggregatorPair
Replace mutable default parameter values with None and instantiate inside the method body to avoid shared state across calls.
This commit is contained in:
@@ -1257,8 +1257,8 @@ class LLMContextAggregatorPair:
|
|||||||
self,
|
self,
|
||||||
context: LLMContext,
|
context: LLMContext,
|
||||||
*,
|
*,
|
||||||
user_params: LLMUserAggregatorParams = LLMUserAggregatorParams(),
|
user_params: Optional[LLMUserAggregatorParams] = None,
|
||||||
assistant_params: LLMAssistantAggregatorParams = LLMAssistantAggregatorParams(),
|
assistant_params: Optional[LLMAssistantAggregatorParams] = None,
|
||||||
):
|
):
|
||||||
"""Initialize the LLM context aggregator pair.
|
"""Initialize the LLM context aggregator pair.
|
||||||
|
|
||||||
@@ -1267,6 +1267,8 @@ class LLMContextAggregatorPair:
|
|||||||
user_params: Parameters for the user context aggregator.
|
user_params: Parameters for the user context aggregator.
|
||||||
assistant_params: Parameters for the assistant context aggregator.
|
assistant_params: Parameters for the assistant context aggregator.
|
||||||
"""
|
"""
|
||||||
|
user_params = user_params or LLMUserAggregatorParams()
|
||||||
|
assistant_params = assistant_params or LLMAssistantAggregatorParams()
|
||||||
self._user = LLMUserAggregator(context, params=user_params)
|
self._user = LLMUserAggregator(context, params=user_params)
|
||||||
self._assistant = LLMAssistantAggregator(context, params=assistant_params)
|
self._assistant = LLMAssistantAggregator(context, params=assistant_params)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user