Fix research pipeline provider failures
This commit is contained in:
@@ -147,6 +147,7 @@ class StatusResponse(BaseModel):
|
||||
search_count: int = 0
|
||||
source_count: int = 0
|
||||
claim_count: int = 0
|
||||
error: str | None = None
|
||||
is_completed: bool = False
|
||||
is_running: bool = False
|
||||
|
||||
@@ -468,6 +469,8 @@ async def _run_pipeline(run: _ResearchRunState, request: ResearchRequest, budget
|
||||
)
|
||||
else:
|
||||
run.state = ResearchRunState.FAILED.value
|
||||
run.metadata["error"] = result.get("error", "Pipeline failed")
|
||||
run.metadata["failed_step"] = result.get("failed_step", "unknown")
|
||||
metrics.increment(C_RESEARCH_FAILED_TOTAL)
|
||||
logger.warning(
|
||||
"[pipeline] run_id=%s failed: %s",
|
||||
@@ -519,6 +522,7 @@ async def get_research(research_id: str) -> StatusResponse:
|
||||
search_count=len(run.search_results),
|
||||
source_count=len(run.sources),
|
||||
claim_count=len(run.claims),
|
||||
error=run.metadata.get("error"),
|
||||
is_completed=(run.state == ResearchRunState.COMPLETED.value),
|
||||
is_running=run.state not in (
|
||||
ResearchRunState.COMPLETED.value,
|
||||
@@ -546,6 +550,7 @@ async def get_status(research_id: str) -> StatusResponse:
|
||||
search_count=len(run.search_results),
|
||||
source_count=len(run.sources),
|
||||
claim_count=len(run.claims),
|
||||
error=run.metadata.get("error"),
|
||||
is_completed=(run.state == ResearchRunState.COMPLETED.value),
|
||||
is_running=run.state not in (
|
||||
ResearchRunState.COMPLETED.value,
|
||||
|
||||
Reference in New Issue
Block a user