MCPcopy Index your code
hub / github.com/github/copilot-sdk / _patch_model_capabilities

Function _patch_model_capabilities

python/copilot/generated/rpc.py:25064–25083  ·  view source on GitHub ↗

Ensure model capabilities have required fields. TODO: Remove once the runtime schema correctly marks these fields as optional. Some models (e.g. embedding models) may omit 'limits' or 'supports' in their capabilities, or omit 'max_context_window_tokens' within limits. The generated

(data: dict)

Source from the content-addressed store, hash-verified

25062 return {}
25063
25064def _patch_model_capabilities(data: dict) -> dict:
25065 """Ensure model capabilities have required fields.
25066
25067 TODO: Remove once the runtime schema correctly marks these fields as optional.
25068 Some models (e.g. embedding models) may omit 'limits' or 'supports' in their
25069 capabilities, or omit 'max_context_window_tokens' within limits. The generated
25070 deserializer requires these fields, so we supply defaults here.
25071 """
25072 for model in data.get("models", []):
25073 caps = model.get("capabilities")
25074 if caps is None:
25075 model["capabilities"] = {"supports": {}, "limits": {"max_context_window_tokens": 0}}
25076 continue
25077 if "supports" not in caps:
25078 caps["supports"] = {}
25079 if "limits" not in caps:
25080 caps["limits"] = {"max_context_window_tokens": 0}
25081 elif "max_context_window_tokens" not in caps["limits"]:
25082 caps["limits"]["max_context_window_tokens"] = 0
25083 return data
25084
25085
25086# Experimental: this API group is experimental and may change or be removed.

Callers 1

listMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…