Spaces:
Runtime error
Runtime error
Update Strands logging
Browse files
app.py
CHANGED
|
@@ -57,6 +57,7 @@ from pydantic import BaseModel
|
|
| 57 |
from strands import Agent
|
| 58 |
from strands.agent.conversation_manager import SlidingWindowConversationManager
|
| 59 |
from strands.models.openai import OpenAIModel
|
|
|
|
| 60 |
|
| 61 |
# Import confluence-ingestor
|
| 62 |
from confluence_ingestor import ConfluenceRAG
|
|
@@ -401,7 +402,14 @@ def create_enhanced_agent():
|
|
| 401 |
should_truncate_results=True, # Enable truncating the tool result when a message is too large for the model's context window
|
| 402 |
)
|
| 403 |
|
| 404 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 405 |
else:
|
| 406 |
# Create a conversation manager with custom window size
|
| 407 |
conversation_manager = SlidingWindowConversationManager(
|
|
@@ -409,7 +417,13 @@ def create_enhanced_agent():
|
|
| 409 |
should_truncate_results=True, # Enable truncating the tool result when a message is too large for the model's context window
|
| 410 |
)
|
| 411 |
|
| 412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
|
| 414 |
return _cached_agent
|
| 415 |
|
|
|
|
| 57 |
from strands import Agent
|
| 58 |
from strands.agent.conversation_manager import SlidingWindowConversationManager
|
| 59 |
from strands.models.openai import OpenAIModel
|
| 60 |
+
from strands.handlers.callback_handler import PrintingCallbackHandler
|
| 61 |
|
| 62 |
# Import confluence-ingestor
|
| 63 |
from confluence_ingestor import ConfluenceRAG
|
|
|
|
| 402 |
should_truncate_results=True, # Enable truncating the tool result when a message is too large for the model's context window
|
| 403 |
)
|
| 404 |
|
| 405 |
+
# The default callback handler prints text and shows tool usage
|
| 406 |
+
_cached_agent = Agent(
|
| 407 |
+
model=model,
|
| 408 |
+
system_prompt=system_prompt,
|
| 409 |
+
tools=tools,
|
| 410 |
+
conversation_manager=conversation_manager,
|
| 411 |
+
callback_handler=PrintingCallbackHandler()
|
| 412 |
+
)
|
| 413 |
else:
|
| 414 |
# Create a conversation manager with custom window size
|
| 415 |
conversation_manager = SlidingWindowConversationManager(
|
|
|
|
| 417 |
should_truncate_results=True, # Enable truncating the tool result when a message is too large for the model's context window
|
| 418 |
)
|
| 419 |
|
| 420 |
+
# The default callback handler prints text and shows tool usage
|
| 421 |
+
_cached_agent = Agent(
|
| 422 |
+
system_prompt=system_prompt,
|
| 423 |
+
tools=tools,
|
| 424 |
+
conversation_manager=conversation_manager,
|
| 425 |
+
callback_handler=PrintingCallbackHandler()
|
| 426 |
+
)
|
| 427 |
|
| 428 |
return _cached_agent
|
| 429 |
|