feat: native tool calling frontend

This commit is contained in:
Timothy Jaeryang Baek
2025-02-04 19:14:59 -08:00
parent 533b62f062
commit ec9be0d20d
4 changed files with 49 additions and 7 deletions

View File

@@ -861,6 +861,7 @@ async def chat_completion(
if model_id not in request.app.state.MODELS:
raise Exception("Model not found")
model = request.app.state.MODELS[model_id]
model_info = Models.get_model_by_id(model_id)
# Check if user has access to the model
if not BYPASS_MODEL_ACCESS_CONTROL and user.role == "user":
@@ -878,6 +879,13 @@ async def chat_completion(
"files": form_data.get("files", None),
"features": form_data.get("features", None),
"variables": form_data.get("variables", None),
"model": model_info,
**(
{"function_calling": "native"}
if form_data.get("params", {}).get("function_calling") == "native"
or model_info.params.model_dump().get("function_calling") == "native"
else {}
),
}
form_data["metadata"] = metadata