Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading