Lzy01241010 commited on
Commit
88069c8
·
1 Parent(s): c412028

diag: surface underlying httpx/ssl cause + endpoint/model in extractor_error

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1686,7 +1686,14 @@ def _llm_extract(webpage_content: str, goal: str) -> Optional[str]:
1686
  )
1687
  return (resp.choices[0].message.content or "").strip() or None
1688
  except Exception as exc:
1689
- _LAST_EXTRACT_ERR = f"{type(exc).__name__}: {str(exc)[:300]}"
 
 
 
 
 
 
 
1690
  return None
1691
 
1692
 
 
1686
  )
1687
  return (resp.choices[0].message.content or "").strip() or None
1688
  except Exception as exc:
1689
+ # Show underlying cause too — OpenAI SDK's APIConnectionError wraps
1690
+ # the real httpx/ssl/dns error which is what we usually need to see.
1691
+ cause = repr(exc.__cause__) if getattr(exc, "__cause__", None) else "no cause"
1692
+ _LAST_EXTRACT_ERR = (
1693
+ f"{type(exc).__name__}: {str(exc)[:200]} | cause={cause[:200]} | "
1694
+ f"endpoint={AZURE_OPENAI_ENDPOINT or SUMMARY_API_BASE or 'default'} | "
1695
+ f"model={model_name} | azure={'yes' if AZURE_OPENAI_ENDPOINT else 'no'}"
1696
+ )
1697
  return None
1698
 
1699