035: fix httpx.Response.ok -> httpx.Response.is_success in LLM client
httpx.Response does not have .ok attribute (that's requests.Response). Async migration missed this: _llm_async_http.py used response.ok in two places, causing 502 errors when LLM API responded. Fix: response.ok -> response.is_success
This commit is contained in:
@@ -117,7 +117,7 @@ async def call_openai_compatible(
|
||||
response, response_text = await _do_http_request(url, headers, payload)
|
||||
await _handle_response_format_fallback(response, response_text, payload, url, headers)
|
||||
|
||||
if not response.ok:
|
||||
if not response.is_success:
|
||||
logger.explore(
|
||||
f"LLM API error status={response.status_code} "
|
||||
f"model={payload.get('model')} "
|
||||
@@ -225,7 +225,7 @@ async def _handle_response_format_fallback(
|
||||
"""Handle 400 errors from structured_outputs not being supported."""
|
||||
_patterns = ("response_format", "structured_outputs", "structured", "json_object")
|
||||
if (
|
||||
not response.ok
|
||||
not response.is_success
|
||||
and response.status_code == 400
|
||||
and any(p in (response_text or "").lower() for p in _patterns)
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user