@ -711,45 +711,41 @@ class Agent:
while attempt < self . retry_attempts and not success :
while attempt < self . retry_attempts and not success :
try :
try :
if self . long_term_memory is not None :
if self . long_term_memory is not None :
logger . info (
logger . info ( " Querying long term memory... " )
" Querying long term memory... "
)
self . memory_query ( task_prompt )
self . memory_query ( task_prompt )
else :
# Generate response using LLM
response_args = (
response = self . llm ( task_prompt , * args , * * kwargs )
( task_prompt , * args )
if img is None
else ( task_prompt , img , * args )
)
response = self . call_llm (
* response_args , * * kwargs
)
# Log the step metadata
# Check and execute tools
logged = self . log_step_metadata (
if self . tools is not None :
loop_count , task_prompt , response
print ( f " self.tools is not None: { response } " )
)
self . parse_and_execute_tools ( response )
logger . info ( logged )
# Conver to a str if the response is not a str
# Log the step metadata
response = self . llm_output_parser (
logged = self . log_step_metadata (
response
loop_count , task_prompt , response
)
)
logger . info ( logged )
# Print
# Conver to a str if the response is not a str
if self . streaming_on is True :
response = self . llm_output_parser (
self . stream_response ( response )
response
else :
)
print ( response )
# Add the response to the memory
# Print
self . short_memory . add (
if self . streaming_on is True :
role = self . agent_name , content = response
self . stream_response ( response )
)
else :
print ( response )
# Add the response to the memory
self . short_memory . add (
role = self . agent_name , content = response
)
# Add to all responses
# Add to all responses
all_responses . append ( response )
all_responses . append ( response )
# TODO: Implement reliablity check
# TODO: Implement reliablity check
if self . tools is not None :
if self . tools is not None :