Update tool use count limit to 50
This commit is contained in:
@@ -134,7 +134,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
|||||||
assistant_message = response.choices[0].message
|
assistant_message = response.choices[0].message
|
||||||
toolUseCount = 0
|
toolUseCount = 0
|
||||||
if hasattr(assistant_message, 'function_call') and assistant_message.function_call:
|
if hasattr(assistant_message, 'function_call') and assistant_message.function_call:
|
||||||
while hasattr(assistant_message, 'function_call') and assistant_message.function_call and toolUseCount < 10:
|
while hasattr(assistant_message, 'function_call') and assistant_message.function_call and toolUseCount < 50: # Todo: put amount in env
|
||||||
tool_response = call_tool(assistant_message.function_call, messages)
|
tool_response = call_tool(assistant_message.function_call, messages)
|
||||||
|
|
||||||
conversation_history[user_id].append({"role": "function", "name": assistant_message.function_call.name, "content": json.dumps(tool_response)})
|
conversation_history[user_id].append({"role": "function", "name": assistant_message.function_call.name, "content": json.dumps(tool_response)})
|
||||||
|
|||||||
Reference in New Issue
Block a user