This commit is contained in:
Slipstream 2025-04-28 01:04:58 -06:00
parent 905232d02b
commit 7a560f9f34
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -1077,14 +1077,9 @@ async def get_internal_ai_json_response(
raise Exception("Internal API call returned no response or candidates.")
# --- Parse and Validate ---
# Directly use response.text when application/json is expected
if generation_config.response_mime_type == "application/json":
final_response_text = response_obj.text
print(f"Parsing ({task_description}): Using response_obj.text for JSON.")
else:
# Fallback to _get_response_text if not expecting JSON (though this function usually does)
print(f"Parsing ({task_description}): Using _get_response_text helper (non-JSON expected).")
final_response_text = _get_response_text(response_obj) # Use helper
# This function always expects JSON, so directly use response_obj.text
final_response_text = response_obj.text
print(f"Parsing ({task_description}): Using response_obj.text for JSON.")
final_parsed_data = parse_and_validate_json_response(
final_response_text, response_schema_dict, f"internal task ({task_description})"