fix: Enhance logging for tool calls in process method; handle potential errors in next steps assignment
This commit is contained in:
parent
892f41f78a
commit
035252c146
@ -57,9 +57,18 @@ class AIProcessor:
|
|||||||
tool_calls = getattr(response.choices[0].message, "tool_calls", None)
|
tool_calls = getattr(response.choices[0].message, "tool_calls", None)
|
||||||
if tool_calls:
|
if tool_calls:
|
||||||
for tc in 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":
|
if tc.function.name == "confirm":
|
||||||
reexec = False
|
reexec = False
|
||||||
nextsteps = tc.function.arguments.get("goal", "")
|
try:
|
||||||
|
nextsteps = tc.function.arguments.get("goal", "")
|
||||||
|
except:
|
||||||
|
nextsteps = str(tc.function.arguments)
|
||||||
|
print('ERROR NEXT STEPS IS STR, ', nextsteps)
|
||||||
r = ai.compute._execute(
|
r = ai.compute._execute(
|
||||||
name=tc.function.name,
|
name=tc.function.name,
|
||||||
args=json.loads(tc.function.arguments),
|
args=json.loads(tc.function.arguments),
|
||||||
|
Loading…
Reference in New Issue
Block a user