Remove tool_calls modification before calling guardrails service.

This commit is contained in:
Hemang
2025-03-18 10:19:09 +01:00
committed by Hemang Sarkar
parent 66973dbf30
commit 5dc9485831
+1 -5
View File
@@ -142,7 +142,7 @@ async def stream_response(
# Check guardrails on the last chunk.
if (
chunk_text == "data: [DONE]"
"data: [DONE]" in chunk_text
and context.config
and context.config.guardrails
):
@@ -347,10 +347,6 @@ async def get_guardrails_check_result(
"""Get the guardrails check result"""
messages = list(context.request_json.get("messages", []))
messages += [choice["message"] for choice in json_response.get("choices", [])]
# TODO: Remove this once the guardrails API is fixed
for message in messages:
if "tool_calls" in message and message["tool_calls"] is None:
message["tool_calls"] = []
# Block on the guardrails check
guardrails_execution_result = await check_guardrails(