MCPcopy Create free account
hub / github.com/Nigel211/codex_deepseek_proxy / _convert_tools

Function _convert_tools

codex_proxy.py:120–135  ·  view source on GitHub ↗

将工具定义从 Responses API 格式转换为 Chat Completions API 格式

(tools: list)

Source from the content-addressed store, hash-verified

118
119
120def _convert_tools(tools: list) -> list:
121 """将工具定义从 Responses API 格式转换为 Chat Completions API 格式"""
122 result = []
123 for tool in tools:
124 if not isinstance(tool, dict):
125 continue
126 if tool.get("type") != "function":
127 continue
128 func = {
129 "name": tool.get("name", ""),
130 "description": tool.get("description", ""),
131 }
132 if "parameters" in tool:
133 func["parameters"] = _clean_schema(tool["parameters"])
134 result.append({"type": "function", "function": func})
135 return result
136
137
138def _convert_tool_choice(tc):

Callers 1

extract_messagesFunction · 0.85

Calls 1

_clean_schemaFunction · 0.85

Tested by

no test coverage detected