Spaces:
Running
Running
Update workflow.py
Browse files- workflow.py +4 -0
workflow.py
CHANGED
@@ -94,6 +94,7 @@ class ResearchWorkflow:
|
|
94 |
try:
|
95 |
domain = state["context"].get("domain", "Biomedical Research").strip().lower()
|
96 |
fallback_analyses = ResearchConfig.DOMAIN_FALLBACKS
|
|
|
97 |
if domain in fallback_analyses:
|
98 |
logger.info(f"Using fallback analysis for domain: {state['context'].get('domain')}")
|
99 |
return {
|
@@ -148,10 +149,12 @@ class ResearchWorkflow:
|
|
148 |
current_analysis = state["messages"][-1].content
|
149 |
refinement_history.append(current_analysis)
|
150 |
difficulty_level = max(0, 3 - state["context"]["refine_count"])
|
|
|
151 |
logger.info(f"Refinement iteration: {state['context']['refine_count']}, Difficulty level: {difficulty_level}")
|
152 |
|
153 |
if state["context"]["refine_count"] >= 3:
|
154 |
meta_prompt = (
|
|
|
155 |
"You are given the following series of refinement outputs:\n" +
|
156 |
"\n---\n".join(refinement_history) +
|
157 |
"\n\nSynthesize the above into a final, concise, and high-quality technical analysis report. "
|
@@ -165,6 +168,7 @@ class ResearchWorkflow:
|
|
165 |
}
|
166 |
else:
|
167 |
refinement_prompt = (
|
|
|
168 |
f"Refine this analysis (current difficulty level: {difficulty_level}):\n{current_analysis}\n\n"
|
169 |
"First, critically evaluate the analysis and identify its weaknesses, such as inaccuracies, unsupported claims, or lack of clarity. Summarize these weaknesses in a short paragraph.\n\n"
|
170 |
"Then, improve the following aspects:\n"
|
|
|
94 |
try:
|
95 |
domain = state["context"].get("domain", "Biomedical Research").strip().lower()
|
96 |
fallback_analyses = ResearchConfig.DOMAIN_FALLBACKS
|
97 |
+
# If the domain matches a fallback, return it.
|
98 |
if domain in fallback_analyses:
|
99 |
logger.info(f"Using fallback analysis for domain: {state['context'].get('domain')}")
|
100 |
return {
|
|
|
149 |
current_analysis = state["messages"][-1].content
|
150 |
refinement_history.append(current_analysis)
|
151 |
difficulty_level = max(0, 3 - state["context"]["refine_count"])
|
152 |
+
domain = state["context"].get("domain", "Biomedical Research")
|
153 |
logger.info(f"Refinement iteration: {state['context']['refine_count']}, Difficulty level: {difficulty_level}")
|
154 |
|
155 |
if state["context"]["refine_count"] >= 3:
|
156 |
meta_prompt = (
|
157 |
+
f"Domain: {domain}\n"
|
158 |
"You are given the following series of refinement outputs:\n" +
|
159 |
"\n---\n".join(refinement_history) +
|
160 |
"\n\nSynthesize the above into a final, concise, and high-quality technical analysis report. "
|
|
|
168 |
}
|
169 |
else:
|
170 |
refinement_prompt = (
|
171 |
+
f"Domain: {domain}\n"
|
172 |
f"Refine this analysis (current difficulty level: {difficulty_level}):\n{current_analysis}\n\n"
|
173 |
"First, critically evaluate the analysis and identify its weaknesses, such as inaccuracies, unsupported claims, or lack of clarity. Summarize these weaknesses in a short paragraph.\n\n"
|
174 |
"Then, improve the following aspects:\n"
|