MCPcopy Create free account
hub / github.com/github/copilot-sdk / build_non_inference_response

Function build_non_inference_response

python/e2e/_copilot_request_helpers.py:141–160  ·  view source on GitHub ↗

Build a minimal ``httpx.Response`` for non-inference model-layer requests.

(
    url: str, supported_endpoints: list[str] | None = None
)

Source from the content-addressed store, hash-verified

139
140
141def build_non_inference_response(
142 url: str, supported_endpoints: list[str] | None = None
143) -> httpx.Response:
144 """Build a minimal ``httpx.Response`` for non-inference model-layer requests."""
145 path = url.lower().split("?", 1)[0] # strip query params before matching
146 if path.endswith("/models"):
147 return httpx.Response(
148 200,
149 headers={"content-type": "application/json"},
150 content=json.dumps(model_catalog(supported_endpoints)).encode(),
151 )
152 if "/models/session" in path:
153 return httpx.Response(200, headers={"content-type": "application/json"}, content=b"{}")
154 if "/policy" in path:
155 return httpx.Response(
156 200,
157 headers={"content-type": "application/json"},
158 content=json.dumps({"state": "enabled"}).encode(),
159 )
160 return httpx.Response(200, headers={"content-type": "application/json"}, content=b"{}")
161
162
163def build_inference_response(request: httpx.Request, text: str = SYNTHETIC_TEXT) -> httpx.Response:

Callers 3

send_requestMethod · 0.85
send_requestMethod · 0.85
send_requestMethod · 0.85

Calls 1

model_catalogFunction · 0.85

Tested by 3

send_requestMethod · 0.68
send_requestMethod · 0.68
send_requestMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…