fu
This commit is contained in:
parent
d497ed8599
commit
6bb19c4bb2
@ -296,7 +296,7 @@ async def get_ai_response(cog: 'GurtCog', message: discord.Message, model_name:
|
||||
chat_history=chat_history_factory, # Pass the factory function
|
||||
prompt=prompt_template, # Pass the constructed prompt template
|
||||
model_kwargs=model_kwargs,
|
||||
# verbose=True, # Enable for debugging agent steps
|
||||
verbose=True, # Enable for debugging agent steps
|
||||
# handle_parsing_errors=True, # Let the agent try to recover from parsing errors
|
||||
# max_iterations=10, # Limit tool execution loops
|
||||
)
|
||||
|
@ -714,10 +714,12 @@ def calculate(cog: commands.Cog, expression: str) -> Dict[str, Any]:
|
||||
else: result_str = repr(result) # Fallback
|
||||
|
||||
print(f"Calculation result: {result_str}")
|
||||
return {"expression": expression, "result": result_str, "status": "success"}
|
||||
# Return only the result string on success, as expected by some agent frameworks
|
||||
return result_str
|
||||
except Exception as e:
|
||||
error_message = f"Unexpected error during calculation: {str(e)}"
|
||||
print(error_message); traceback.print_exc()
|
||||
# Return error message as string on failure
|
||||
return {"error": error_message, "expression": expression}
|
||||
|
||||
async def run_python_code(cog: commands.Cog, code: str) -> Dict[str, Any]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user