Merge pull request #65 from gabrii/tool-call-merge

Tool call merge
This commit is contained in:
Gabriel Gavilan
2025-11-21 15:30:09 +01:00
committed by GitHub
7 changed files with 116 additions and 1 deletions
+7
View File
@@ -92,6 +92,13 @@ class RequestAdapter:
def _transform_tools_for_responses(self, tools: Any) -> Any:
out: List[Dict[str, Any]] = []
if not isinstance(tools, list):
current_app.logger.debug(
"Skipping tool transformation because tools payload is not a list: %r",
tools,
)
return out
for tool in tools:
function = tool.get("function")
transformed: Dict[str, Any] = {
+1 -1
View File
@@ -205,7 +205,7 @@ def log_request(req: Request) -> str:
)
messages = json_payload.get("messages", [])
tools = json_payload.get("tools", [])
tools = json_payload.get("tools", []) or []
# Render tools section once (no duplicate panels)
table = Table(
@@ -0,0 +1,22 @@
{
"model": "gpt-minimal",
"temperature": 0,
"user": "REDACTED",
"messages": [
{
"role": "system",
"content": "REDACTED"
},
{
"role": "user",
"content": "REDACTED"
},
{
"role": "user",
"content": "REDACTED"
}
],
"tools": null,
"tool_choice": "auto",
"stream": true
}
@@ -0,0 +1,10 @@
data: {"id":"chatcmpl-ERO7qkefORSgjuOmbThzZoG8","object":"chat.completion.chunk","created":1758093803,"model":"gpt-minimal","choices":[{"index":0,"delta":{"role":"assistant","content":"<think>\n\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-ERO7qkefORSgjuOmbThzZoG8","object":"chat.completion.chunk","created":1758093804,"model":"gpt-minimal","choices":[{"index":0,"delta":{"role":"assistant","content":"</think>\n\n"},"finish_reason":null}]}
data: {"id":"chatcmpl-ERO7qkefORSgjuOmbThzZoG8","object":"chat.completion.chunk","created":1758093804,"model":"gpt-minimal","choices":[{"index":0,"delta":{"role":"assistant","content":"pong"},"finish_reason":null}]}
data: {"id":"chatcmpl-ERO7qkefORSgjuOmbThzZoG8","object":"chat.completion.chunk","created":1758093806,"model":"gpt-minimal","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
@@ -0,0 +1,37 @@
{
"instructions": "REDACTED",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "REDACTED"
}
]
},
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "REDACTED"
}
]
}
],
"model": "gpt-5",
"tools": [],
"tool_choice": "auto",
"prompt_cache_key": "REDACTED",
"stream": true,
"reasoning": {
"effort": "minimal",
"summary": "detailed"
},
"store": false,
"stream_options": {
"include_obfuscation": false
},
"truncation": "auto"
}
File diff suppressed because one or more lines are too long
+6
View File
@@ -50,3 +50,9 @@ class TestReplyVerbosityLevelHigh(ReplyBase):
app.config["AZURE_VERBOSITY_LEVEL"] = "high"
recording = "verbosity_level"
class TestReplyWithEmptyTools(ReplyBase):
"""Reply with the 'tools' key not present in the downstream request."""
recording = "empty_tools"