🐛 Bug: Fix the bug where tool use is still included in the request body when tools are closed.
Browse files- main.py +2 -0
- request.py +4 -2
main.py
CHANGED
@@ -205,6 +205,8 @@ async def process_request(request: Union[RequestModel, ImageGenerationRequest],
|
|
205 |
|
206 |
url, headers, payload = await get_payload(request, engine, provider)
|
207 |
|
|
|
|
|
208 |
try:
|
209 |
if request.stream:
|
210 |
model = provider['model'][request.model]
|
|
|
205 |
|
206 |
url, headers, payload = await get_payload(request, engine, provider)
|
207 |
|
208 |
+
# logger.info(json.dumps(headers, indent=4, ensure_ascii=False))
|
209 |
+
# logger.info(json.dumps(payload, indent=4, ensure_ascii=False))
|
210 |
try:
|
211 |
if request.stream:
|
212 |
model = provider['model'][request.model]
|
request.py
CHANGED
@@ -533,9 +533,11 @@ async def get_gpt_payload(request, engine, provider):
|
|
533 |
"arguments": tool_call.function.arguments
|
534 |
}
|
535 |
})
|
536 |
-
|
|
|
537 |
elif tool_call_id:
|
538 |
-
|
|
|
539 |
else:
|
540 |
messages.append({"role": msg.role, "content": content})
|
541 |
|
|
|
533 |
"arguments": tool_call.function.arguments
|
534 |
}
|
535 |
})
|
536 |
+
if provider.get("tools"):
|
537 |
+
messages.append({"role": msg.role, "tool_calls": tool_calls_list})
|
538 |
elif tool_call_id:
|
539 |
+
if provider.get("tools"):
|
540 |
+
messages.append({"role": msg.role, "tool_call_id": tool_call_id, "content": content})
|
541 |
else:
|
542 |
messages.append({"role": msg.role, "content": content})
|
543 |
|