fix: CLI patches - patch runtime error on main loop + duplicate internal monologue (#1852)
This commit is contained in:
@@ -556,9 +556,12 @@ class Agent(BaseAgent):
|
||||
) # extend conversation with assistant's reply
|
||||
printd(f"Function call message: {messages[-1]}")
|
||||
|
||||
nonnull_content = False
|
||||
if response_message.content:
|
||||
# The content if then internal monologue, not chat
|
||||
self.interface.internal_monologue(response_message.content, msg_obj=messages[-1])
|
||||
# Flag to avoid printing a duplicate if inner thoughts get popped from the function call
|
||||
nonnull_content = True
|
||||
|
||||
# Step 3: call the function
|
||||
# Note: the JSON response may not always be valid; be sure to handle errors
|
||||
@@ -619,7 +622,7 @@ class Agent(BaseAgent):
|
||||
if "inner_thoughts" in function_args:
|
||||
response_message.content = function_args.pop("inner_thoughts")
|
||||
# The content if then internal monologue, not chat
|
||||
if response_message.content:
|
||||
if response_message.content and not nonnull_content:
|
||||
self.interface.internal_monologue(response_message.content, msg_obj=messages[-1])
|
||||
|
||||
# (Still parsing function args)
|
||||
|
||||
@@ -366,7 +366,7 @@ def run_agent_loop(
|
||||
first_message=False,
|
||||
skip_verify=no_verify,
|
||||
stream=stream,
|
||||
inner_thoughts_in_kwargs=inner_thoughts_in_kwargs,
|
||||
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs,
|
||||
ms=ms,
|
||||
)
|
||||
new_messages = step_response.messages
|
||||
|
||||
Reference in New Issue
Block a user