diff --git a/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_agent_chat.py b/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_agent_chat.py index 7ad573fa2590..3bfb3707df12 100644 --- a/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_agent_chat.py +++ b/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_agent_chat.py @@ -39,11 +39,11 @@ async def main(): reducer_msg_count = 10 reducer_threshold = 10 - # Create a summarization reducer and clear its history - history_truncatation_reducer = ChatHistoryTruncationReducer( + # Create a truncation reducer and clear its history + history_truncation_reducer = ChatHistoryTruncationReducer( target_count=reducer_msg_count, threshold_count=reducer_threshold ) - history_truncatation_reducer.clear() + history_truncation_reducer.clear() # Create our agent agent = ChatCompletionAgent( @@ -53,7 +53,7 @@ async def main(): ) # Create a group chat using the reducer - chat = AgentGroupChat(chat_history=history_truncatation_reducer) + chat = AgentGroupChat(chat_history=history_truncation_reducer) # Simulate user messages message_count = 50 # Number of messages to simulate @@ -65,7 +65,7 @@ async def main(): # Attempt to reduce history is_reduced = await chat.reduce_history() if is_reduced: - print(f"@ History reduced to {len(history_truncatation_reducer.messages)} messages.") + print(f"@ History reduced to {len(history_truncation_reducer.messages)} messages.") # Invoke the agent and display responses async for message in chat.invoke(agent): diff --git a/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_single_agent.py b/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_single_agent.py index 897d2f9cf791..e6f8e4aca148 100644 --- a/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_single_agent.py +++ b/python/samples/concepts/agents/chat_completion_agent/chat_completion_agent_truncate_history_reducer_single_agent.py @@ -28,9 +28,10 @@ async def main(): reducer_msg_count = 10 reducer_threshold = 10 - # Create a summarization reducer + # Create a truncation reducer history_truncation_reducer = ChatHistoryTruncationReducer( - service=AzureChatCompletion(), target_count=reducer_msg_count, threshold_count=reducer_threshold + target_count=reducer_msg_count, + threshold_count=reducer_threshold, ) thread: ChatHistoryAgentThread = ChatHistoryAgentThread(chat_history=history_truncation_reducer)