Updated model names

This commit is contained in:
2024-08-19 11:29:00 -05:00
parent dbb4e648db
commit 93ecf8f1c8
+5 -2
View File
@@ -18,8 +18,8 @@ client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), api_key=os.environ.get("OPENAI_API_KEY"),
) )
GPT_4O = "gpt-4" GPT_4O = "gpt-4o"
GPT_4O_MINI = "gpt-4-1106-preview" GPT_4O_MINI = "gpt-4o-mini"
model_max_tokens = { model_max_tokens = {
GPT_4O: 4096, GPT_4O: 4096,
@@ -116,6 +116,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
tool_calls.append(assistant_message.function_call) tool_calls.append(assistant_message.function_call)
toolUseCount = 0 toolUseCount = 0
previous_function_name = ""
while len(tool_calls) > 0 and toolUseCount < 50 and processing_status[user_id]["processing"]: while len(tool_calls) > 0 and toolUseCount < 50 and processing_status[user_id]["processing"]:
tool_use_results = [] tool_use_results = []
@@ -123,8 +124,10 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
tool_call = tool_calls.pop(0) tool_call = tool_calls.pop(0)
function_name = tool_call.name function_name = tool_call.name
if function_name != previous_function_name:
# Update status message # Update status message
await update_status_message(context, update.effective_chat.id, status_message.message_id, f"Using tool: {function_name}") await update_status_message(context, update.effective_chat.id, status_message.message_id, f"Using tool: {function_name}")
previous_function_name = function_name
tool_response = call_tool(tool_call) tool_response = call_tool(tool_call)
tool_use_results.append({"role": "function", "name": function_name, "content": json.dumps(tool_response)}) tool_use_results.append({"role": "function", "name": function_name, "content": json.dumps(tool_response)})