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

Function _clean_schema

codex_proxy.py:103–117  ·  view source on GitHub ↗

递归清除 JSON Schema 中 DeepSeek 不支持的字段

(obj)

Source from the content-addressed store, hash-verified

101
102
103def _clean_schema(obj):
104 """递归清除 JSON Schema 中 DeepSeek 不支持的字段"""
105 if not isinstance(obj, dict):
106 return obj
107 cleaned = {}
108 for k, v in obj.items():
109 if k in ("additionalProperties", "strict"):
110 continue
111 if isinstance(v, dict):
112 cleaned[k] = _clean_schema(v)
113 elif isinstance(v, list):
114 cleaned[k] = [_clean_schema(i) if isinstance(i, dict) else i for i in v]
115 else:
116 cleaned[k] = v
117 return cleaned
118
119
120def _convert_tools(tools: list) -> list:

Callers 1

_convert_toolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected