Fix ResponseValidationError: change response field to content

FastAPI validation was failing because stage1 results used 'response'
field but Pydantic expected 'content'. Changed field name in:
- stage1_collect_responses: returns content instead of response
- stage2_collect_rankings: references result['content']
- stage3_synthesize_final: references result['content']
- MCP server: reads resp.get("content", "") for content_blocks
This commit is contained in:
Krishna Kumar
2025-12-30 03:54:02 -06:00
parent 8f05b67887
commit 2b2207035c
2 changed files with 4 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ async def stage1_collect_responses(user_query: str) -> List[Dict[str, Any]]:
if response is not None: # Only include successful responses if response is not None: # Only include successful responses
stage1_results.append({ stage1_results.append({
"model": model, "model": model,
"response": response.get('content', '') "content": response.get('content', '')
}) })
return stage1_results return stage1_results
@@ -57,7 +57,7 @@ async def stage2_collect_rankings(
# Build the ranking prompt # Build the ranking prompt
responses_text = "\n\n".join([ responses_text = "\n\n".join([
f"Response {label}:\n{result['response']}" f"Response {label}:\n{result['content']}"
for label, result in zip(labels, stage1_results) for label, result in zip(labels, stage1_results)
]) ])
@@ -130,7 +130,7 @@ async def stage3_synthesize_final(
""" """
# Build comprehensive context for chairman # Build comprehensive context for chairman
stage1_text = "\n\n".join([ stage1_text = "\n\n".join([
f"Model: {result['model']}\nResponse: {result['response']}" f"Model: {result['model']}\nResponse: {result['content']}"
for result in stage1_results for result in stage1_results
]) ])

View File

@@ -145,7 +145,7 @@ async def council_query(
"type": "council_response", "type": "council_response",
"model": model_id, "model": model_id,
"model_display_name": get_display_name(model_id), "model_display_name": get_display_name(model_id),
"response": resp.get("response", ""), "response": resp.get("content", ""),
"stage": 1 "stage": 1
}) })