Update tool use count limit to 50

This commit is contained in:
2024-08-17 18:50:30 -05:00
parent 65967d8949
commit 31a041e300
+1 -1
View File
@@ -134,7 +134,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
assistant_message = response.choices[0].message
toolUseCount = 0
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)
conversation_history[user_id].append({"role": "function", "name": assistant_message.function_call.name, "content": json.dumps(tool_response)})