fix: Enhance logging for tool calls in process method; handle potential errors in next steps assignment
This commit is contained in:
		@@ -57,9 +57,18 @@ class AIProcessor:
 | 
			
		||||
            tool_calls = getattr(response.choices[0].message, "tool_calls", None)
 | 
			
		||||
            if tool_calls:
 | 
			
		||||
                for tc in tool_calls:
 | 
			
		||||
                    logger.debug(
 | 
			
		||||
                        "Processing tool call: %s with arguments: %s",
 | 
			
		||||
                        tc.function.name,
 | 
			
		||||
                        tc.function.arguments,
 | 
			
		||||
                    )
 | 
			
		||||
                    if tc.function.name == "confirm":
 | 
			
		||||
                        reexec = False
 | 
			
		||||
                        try:
 | 
			
		||||
                            nextsteps = tc.function.arguments.get("goal", "")
 | 
			
		||||
                        except:
 | 
			
		||||
                            nextsteps = str(tc.function.arguments)
 | 
			
		||||
                            print('ERROR NEXT STEPS IS STR, ', nextsteps)
 | 
			
		||||
                    r = ai.compute._execute(
 | 
			
		||||
                        name=tc.function.name,
 | 
			
		||||
                        args=json.loads(tc.function.arguments),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user