remove info logging in agent instance

This commit is contained in:
Dinesh Yeduguru 2024-12-10 08:40:42 -08:00
parent 1ad691bb04
commit 686f8d5b8d

View file

@ -185,9 +185,9 @@ class ChatAgent(ShieldRunnerMixin):
stream=request.stream, stream=request.stream,
): ):
if isinstance(chunk, CompletionMessage): if isinstance(chunk, CompletionMessage):
log.info( # log.info(
f"{chunk.role.capitalize()}: {chunk.content}", # f"{chunk.role.capitalize()}: {chunk.content}",
) # )
output_message = chunk output_message = chunk
continue continue
@ -405,11 +405,11 @@ class ChatAgent(ShieldRunnerMixin):
n_iter = 0 n_iter = 0
while True: while True:
msg = input_messages[-1] msg = input_messages[-1]
if len(str(msg)) > 1000: # if len(str(msg)) > 1000:
msg_str = f"{str(msg)[:500]}...<more>...{str(msg)[-500:]}" # msg_str = f"{str(msg)[:500]}...<more>...{str(msg)[-500:]}"
else: # else:
msg_str = str(msg) # msg_str = str(msg)
log.info(f"{msg_str}") # log.info(f"{msg_str}")
step_id = str(uuid.uuid4()) step_id = str(uuid.uuid4())
yield AgentTurnResponseStreamChunk( yield AgentTurnResponseStreamChunk(
@ -514,12 +514,12 @@ class ChatAgent(ShieldRunnerMixin):
) )
if n_iter >= self.agent_config.max_infer_iters: if n_iter >= self.agent_config.max_infer_iters:
log.info("Done with MAX iterations, exiting.") # log.info("Done with MAX iterations, exiting.")
yield message yield message
break break
if stop_reason == StopReason.out_of_tokens: if stop_reason == StopReason.out_of_tokens:
log.info("Out of token budget, exiting.") # log.info("Out of token budget, exiting.")
yield message yield message
break break
@ -533,10 +533,10 @@ class ChatAgent(ShieldRunnerMixin):
message.content = [message.content] + attachments message.content = [message.content] + attachments
yield message yield message
else: else:
log.info(f"Partial message: {str(message)}") # log.info(f"Partial message: {str(message)}")
input_messages = input_messages + [message] input_messages = input_messages + [message]
else: else:
log.info(f"{str(message)}") # log.info(f"{str(message)}")
try: try:
tool_call = message.tool_calls[0] tool_call = message.tool_calls[0]
@ -800,7 +800,7 @@ async def attachment_message(tempdir: str, urls: List[URL]) -> ToolResponseMessa
path = urlparse(uri).path path = urlparse(uri).path
basename = os.path.basename(path) basename = os.path.basename(path)
filepath = f"{tempdir}/{make_random_string() + basename}" filepath = f"{tempdir}/{make_random_string() + basename}"
log.info(f"Downloading {url} -> {filepath}") # log.info(f"Downloading {url} -> {filepath}")
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
r = await client.get(uri) r = await client.get(uri)