Joseph Pollack commited on
Commit
25435fb
·
unverified ·
1 Parent(s): da1b71b

adds youtube video

Browse files
Files changed (46) hide show
  1. AUDIO_INPUT_FIX.md +1 -0
  2. ERROR_FIXES_SUMMARY.md +1 -0
  3. FILE_OUTPUT_IMPLEMENTATION_PLAN.md +1 -0
  4. FILE_OUTPUT_VERIFICATION.md +1 -0
  5. FIX_SUMMARY.md +1 -0
  6. MULTIMODAL_SETTINGS_IMPLEMENTATION_PLAN.md +1 -0
  7. MULTIMODAL_SETTINGS_IMPLEMENTATION_SUMMARY.md +1 -0
  8. PDF_REPORT_INTEGRATION.md +1 -0
  9. README.md +16 -5
  10. REPORT_WRITING_AGENTS_ANALYSIS.md +1 -0
  11. SERPER_WEBSEARCH_IMPLEMENTATION_PLAN.md +1 -0
  12. dev/__init__.py +1 -0
  13. docs/api/agents.md +1 -0
  14. docs/api/models.md +1 -0
  15. docs/api/services.md +1 -0
  16. docs/api/tools.md +1 -0
  17. docs/architecture/agents.md +1 -0
  18. docs/contributing/code-quality.md +1 -0
  19. docs/contributing/code-style.md +1 -0
  20. docs/contributing/error-handling.md +1 -0
  21. docs/contributing/implementation-patterns.md +1 -0
  22. docs/contributing/index.md +1 -0
  23. docs/contributing/prompt-engineering.md +1 -0
  24. docs/contributing/testing.md +1 -0
  25. docs/getting-started/installation.md +1 -0
  26. docs/implementation/IMPLEMENTATION_SUMMARY.md +1 -0
  27. docs/implementation/TTS_MODAL_IMPLEMENTATION.md +1 -0
  28. docs/license.md +1 -0
  29. docs/team.md +1 -0
  30. new_env.txt +1 -0
  31. src/agents/long_writer.py +30 -0
  32. src/agents/writer.py +24 -0
  33. src/middleware/state_machine.py +1 -0
  34. src/tools/searchxng_web_search.py +1 -0
  35. src/tools/serper_web_search.py +1 -0
  36. src/tools/vendored/crawl_website.py +1 -0
  37. src/tools/vendored/searchxng_client.py +1 -0
  38. src/tools/vendored/serper_client.py +1 -0
  39. src/tools/vendored/web_search_core.py +1 -0
  40. src/tools/web_search_factory.py +1 -0
  41. src/utils/markdown.css +1 -0
  42. src/utils/md_to_pdf.py +1 -0
  43. src/utils/report_generator.py +1 -0
  44. tests/unit/middleware/test_budget_tracker_phase7.py +1 -0
  45. tests/unit/middleware/test_state_machine.py +1 -0
  46. tests/unit/middleware/test_workflow_manager.py +1 -0
AUDIO_INPUT_FIX.md CHANGED
@@ -91,3 +91,4 @@ If audio input still doesn't appear:
91
 
92
 
93
 
 
 
91
 
92
 
93
 
94
+
ERROR_FIXES_SUMMARY.md CHANGED
@@ -153,3 +153,4 @@ Some MCP tools use `gr.State` inputs, which Gradio warns won't update between to
153
 
154
 
155
 
 
 
153
 
154
 
155
 
156
+
FILE_OUTPUT_IMPLEMENTATION_PLAN.md CHANGED
@@ -238,3 +238,4 @@ Current implementation in `event_to_chat_message()` already handles this correct
238
 
239
 
240
 
 
 
238
 
239
 
240
 
241
+
FILE_OUTPUT_VERIFICATION.md CHANGED
@@ -221,3 +221,4 @@ No reimplementation needed. All changes are present and correct.
221
 
222
 
223
 
 
 
221
 
222
 
223
 
224
+
FIX_SUMMARY.md CHANGED
@@ -99,3 +99,4 @@ if isinstance(final_result, dict):
99
  - Better logging will help debug any future issues with result extraction
100
 
101
 
 
 
99
  - Better logging will help debug any future issues with result extraction
100
 
101
 
102
+
MULTIMODAL_SETTINGS_IMPLEMENTATION_PLAN.md CHANGED
@@ -383,3 +383,4 @@ result["content"] = f"{content}\n\n{file_links}"
383
 
384
 
385
 
 
 
383
 
384
 
385
 
386
+
MULTIMODAL_SETTINGS_IMPLEMENTATION_SUMMARY.md CHANGED
@@ -154,3 +154,4 @@
154
 
155
 
156
 
 
 
154
 
155
 
156
 
157
+
PDF_REPORT_INTEGRATION.md CHANGED
@@ -131,3 +131,4 @@ PDF generation is automatically triggered when:
131
  - Batch PDF generation
132
 
133
 
 
 
131
  - Batch PDF generation
132
 
133
 
134
+
README.md CHANGED
@@ -43,7 +43,7 @@ tags:
43
  [![GitHub](https://img.shields.io/github/stars/DeepCritical/GradioDemo?style=for-the-badge&logo=github&logoColor=white&label=GitHub&labelColor=181717&color=181717)](https://github.com/DeepCritical/GradioDemo)
44
  [![Documentation](https://img.shields.io/badge/Docs-0080FF?style=for-the-badge&logo=readthedocs&logoColor=white&labelColor=0080FF&color=0080FF)](deepcritical.github.io/GradioDemo/)
45
  [![Demo](https://img.shields.io/badge/Demo-FFD21E?style=for-the-badge&logo=huggingface&logoColor=white&labelColor=FFD21E&color=FFD21E)](https://huggingface.co/spaces/DataQuests/DeepCritical)
46
- [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&label=Watch%20Demo&labelColor=FF0000&color=FF0000)](https://www.youtube.com/watch?v=PLACEHOLDER)
47
  [![codecov](https://codecov.io/gh/DeepCritical/GradioDemo/graph/badge.svg?token=B1f05RCGpz)](https://codecov.io/gh/DeepCritical/GradioDemo)
48
  [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/qdfnvSPcqP)
49
 
@@ -88,6 +88,16 @@ Please join us @ https://hf.co/spaces/DataQuests/DeepCritical where we will keep
88
  - 💖 made with love
89
 
90
 
 
 
 
 
 
 
 
 
 
 
91
  ## Deep Critical In the Media
92
 
93
  - Social Medial Posts about Deep Critical :
@@ -184,8 +194,9 @@ Please join us @ https://hf.co/spaces/DataQuests/DeepCritical where we will keep
184
 
185
  ## Links
186
 
187
- [![GitHub](https://img.shields.io/github/stars/DeepCritical/GradioDemo?style=for-the-badge&logo=github&logoColor=white&label=🐙%20GitHub&labelColor=181717&color=181717)](https://github.com/DeepCritical/GradioDemo)
188
- [![Documentation](https://img.shields.io/badge/📚%20Docs-0080FF?style=for-the-badge&logo=readthedocs&logoColor=white&labelColor=0080FF&color=0080FF)](deepcritical.github.io/GradioDemo/)
189
- [![Demo](https://img.shields.io/badge/🚀%20Demo-FFD21E?style=for-the-badge&logo=huggingface&logoColor=white&labelColor=FFD21E&color=FFD21E)](https://huggingface.co/spaces/DataQuests/DeepCritical)
 
190
  [![codecov](https://codecov.io/gh/DeepCritical/GradioDemo/graph/badge.svg?token=B1f05RCGpz)](https://codecov.io/gh/DeepCritical/GradioDemo)
191
- [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/qdfnvSPcqP)
 
43
  [![GitHub](https://img.shields.io/github/stars/DeepCritical/GradioDemo?style=for-the-badge&logo=github&logoColor=white&label=GitHub&labelColor=181717&color=181717)](https://github.com/DeepCritical/GradioDemo)
44
  [![Documentation](https://img.shields.io/badge/Docs-0080FF?style=for-the-badge&logo=readthedocs&logoColor=white&labelColor=0080FF&color=0080FF)](deepcritical.github.io/GradioDemo/)
45
  [![Demo](https://img.shields.io/badge/Demo-FFD21E?style=for-the-badge&logo=huggingface&logoColor=white&labelColor=FFD21E&color=FFD21E)](https://huggingface.co/spaces/DataQuests/DeepCritical)
46
+ [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&label=Watch%20Demo&labelColor=FF0000&color=FF0000)](https://www.youtube.com/watch?v=https://youtu.be/Mb0M83BqgOw)
47
  [![codecov](https://codecov.io/gh/DeepCritical/GradioDemo/graph/badge.svg?token=B1f05RCGpz)](https://codecov.io/gh/DeepCritical/GradioDemo)
48
  [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/qdfnvSPcqP)
49
 
 
88
  - 💖 made with love
89
 
90
 
91
+ ## What Can It Do ?
92
+
93
+ - long running tasks (potentially millions of tokens over hours and hours)
94
+ - data processing and rendering
95
+ - statistical analyses
96
+ - literature reviews
97
+ - websearch
98
+ - synthetize complex information
99
+ - find hard to find information
100
+
101
  ## Deep Critical In the Media
102
 
103
  - Social Medial Posts about Deep Critical :
 
194
 
195
  ## Links
196
 
197
+ [![GitHub](https://img.shields.io/github/stars/DeepCritical/GradioDemo?style=for-the-badge&logo=github&logoColor=white&label=GitHub&labelColor=181717&color=181717)](https://github.com/DeepCritical/GradioDemo)
198
+ [![Documentation](https://img.shields.io/badge/Docs-0080FF?style=for-the-badge&logo=readthedocs&logoColor=white&labelColor=0080FF&color=0080FF)](deepcritical.github.io/GradioDemo/)
199
+ [![Demo](https://img.shields.io/badge/Demo-FFD21E?style=for-the-badge&logo=huggingface&logoColor=white&labelColor=FFD21E&color=FFD21E)](https://huggingface.co/spaces/DataQuests/DeepCritical)
200
+ [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&label=Watch%20Demo&labelColor=FF0000&color=FF0000)](https://www.youtube.com/watch?v=https://youtu.be/Mb0M83BqgOw)
201
  [![codecov](https://codecov.io/gh/DeepCritical/GradioDemo/graph/badge.svg?token=B1f05RCGpz)](https://codecov.io/gh/DeepCritical/GradioDemo)
202
+ [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/qdfnvSPcqP)
REPORT_WRITING_AGENTS_ANALYSIS.md CHANGED
@@ -186,3 +186,4 @@ The infrastructure to handle file outputs in Gradio is in place, but the agents
186
 
187
 
188
 
 
 
186
 
187
 
188
 
189
+
SERPER_WEBSEARCH_IMPLEMENTATION_PLAN.md CHANGED
@@ -400,3 +400,4 @@ This plan details the implementation of SERPER-based web search by vendoring cod
400
 
401
 
402
 
 
 
400
 
401
 
402
 
403
+
dev/__init__.py CHANGED
@@ -1,3 +1,4 @@
1
  """Development utilities and plugins."""
2
 
3
 
 
 
1
  """Development utilities and plugins."""
2
 
3
 
4
+
docs/api/agents.md CHANGED
@@ -272,3 +272,4 @@ def create_input_parser_agent(model: Any | None = None) -> InputParserAgent
272
 
273
 
274
 
 
 
272
 
273
 
274
 
275
+
docs/api/models.md CHANGED
@@ -250,3 +250,4 @@ class BudgetStatus(BaseModel):
250
 
251
 
252
 
 
 
250
 
251
 
252
 
253
+
docs/api/services.md CHANGED
@@ -207,5 +207,6 @@ Analyzes a hypothesis using statistical methods.
207
 
208
 
209
 
 
210
 
211
 
 
207
 
208
 
209
 
210
+
211
 
212
 
docs/api/tools.md CHANGED
@@ -237,3 +237,4 @@ Searches multiple tools in parallel.
237
 
238
 
239
 
 
 
237
 
238
 
239
 
240
+
docs/architecture/agents.md CHANGED
@@ -194,3 +194,4 @@ Factory functions:
194
 
195
 
196
 
 
 
194
 
195
 
196
 
197
+
docs/contributing/code-quality.md CHANGED
@@ -83,3 +83,4 @@ async def search(self, query: str, max_results: int = 10) -> list[Evidence]:
83
 
84
 
85
 
 
 
83
 
84
 
85
 
86
+
docs/contributing/code-style.md CHANGED
@@ -63,3 +63,4 @@ result = await loop.run_in_executor(None, cpu_bound_function, args)
63
 
64
 
65
 
 
 
63
 
64
 
65
 
66
+
docs/contributing/error-handling.md CHANGED
@@ -71,3 +71,4 @@ except httpx.HTTPError as e:
71
 
72
 
73
 
 
 
71
 
72
 
73
 
74
+
docs/contributing/implementation-patterns.md CHANGED
@@ -86,3 +86,4 @@ def get_embedding_service() -> EmbeddingService:
86
 
87
 
88
 
 
 
86
 
87
 
88
 
89
+
docs/contributing/index.md CHANGED
@@ -165,3 +165,4 @@ Thank you for contributing to DeepCritical!
165
 
166
 
167
 
 
 
165
 
166
 
167
 
168
+
docs/contributing/prompt-engineering.md CHANGED
@@ -71,3 +71,4 @@ This document outlines prompt engineering guidelines and citation validation rul
71
 
72
 
73
 
 
 
71
 
72
 
73
 
74
+
docs/contributing/testing.md CHANGED
@@ -75,3 +75,4 @@ async def test_real_pubmed_search():
75
 
76
 
77
 
 
 
75
 
76
 
77
 
78
+
docs/getting-started/installation.md CHANGED
@@ -158,3 +158,4 @@ uv run pre-commit install
158
 
159
 
160
 
 
 
158
 
159
 
160
 
161
+
docs/implementation/IMPLEMENTATION_SUMMARY.md CHANGED
@@ -185,3 +185,4 @@ Located in `src/app.py` lines 667-712:
185
 
186
 
187
 
 
 
185
 
186
 
187
 
188
+
docs/implementation/TTS_MODAL_IMPLEMENTATION.md CHANGED
@@ -139,3 +139,4 @@ To test TTS:
139
 
140
 
141
 
 
 
139
 
140
 
141
 
142
+
docs/license.md CHANGED
@@ -41,3 +41,4 @@ SOFTWARE.
41
 
42
 
43
 
 
 
41
 
42
 
43
 
44
+
docs/team.md CHANGED
@@ -46,3 +46,4 @@ We welcome contributions! See the [Contributing Guide](contributing/index.md) fo
46
 
47
 
48
 
 
 
46
 
47
 
48
 
49
+
new_env.txt CHANGED
@@ -101,3 +101,4 @@ MODAL_TOKEN_SECRET=your_modal_token_secret_here
101
 
102
 
103
 
 
 
101
 
102
 
103
 
104
+
src/agents/long_writer.py CHANGED
@@ -225,6 +225,36 @@ class LongWriterAgent:
225
  "Section writing failed after all attempts",
226
  error=str(last_exception) if last_exception else "Unknown error",
227
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  return LongWriterOutput(
229
  next_section_markdown=f"## {next_section_title}\n\n{next_section_draft}",
230
  references=[],
 
225
  "Section writing failed after all attempts",
226
  error=str(last_exception) if last_exception else "Unknown error",
227
  )
228
+
229
+ # Try to enhance fallback with evidence if available
230
+ try:
231
+ from src.middleware.state_machine import get_workflow_state
232
+
233
+ state = get_workflow_state()
234
+ if state and state.evidence:
235
+ # Include evidence citations in fallback
236
+ evidence_refs: list[str] = []
237
+ for i, ev in enumerate(state.evidence[:10], 1): # Limit to 10
238
+ authors = ", ".join(ev.citation.authors[:2]) if ev.citation.authors else "Unknown"
239
+ evidence_refs.append(
240
+ f"[{i}] {authors}. *{ev.citation.title}*. {ev.citation.url}"
241
+ )
242
+
243
+ enhanced_draft = f"## {next_section_title}\n\n{next_section_draft}"
244
+ if evidence_refs:
245
+ enhanced_draft += "\n\n### Sources\n\n" + "\n".join(evidence_refs)
246
+
247
+ return LongWriterOutput(
248
+ next_section_markdown=enhanced_draft,
249
+ references=evidence_refs,
250
+ )
251
+ except Exception as e:
252
+ self.logger.warning(
253
+ "Failed to enhance fallback with evidence",
254
+ error=str(e),
255
+ )
256
+
257
+ # Basic fallback
258
  return LongWriterOutput(
259
  next_section_markdown=f"## {next_section_title}\n\n{next_section_draft}",
260
  references=[],
src/agents/writer.py CHANGED
@@ -175,6 +175,30 @@ FINDINGS:
175
  "Report writing failed after all attempts",
176
  error=str(last_exception) if last_exception else "Unknown error",
177
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  # Truncate findings in fallback if too long
179
  fallback_findings = findings[:500] + "..." if len(findings) > 500 else findings
180
  return (
 
175
  "Report writing failed after all attempts",
176
  error=str(last_exception) if last_exception else "Unknown error",
177
  )
178
+
179
+ # Try to use evidence-based report generator for better fallback
180
+ try:
181
+ from src.middleware.state_machine import get_workflow_state
182
+ from src.utils.report_generator import generate_report_from_evidence
183
+
184
+ state = get_workflow_state()
185
+ if state and state.evidence:
186
+ self.logger.info(
187
+ "Using evidence-based report generator for fallback",
188
+ evidence_count=len(state.evidence),
189
+ )
190
+ return generate_report_from_evidence(
191
+ query=query,
192
+ evidence=state.evidence,
193
+ findings=findings,
194
+ )
195
+ except Exception as e:
196
+ self.logger.warning(
197
+ "Failed to use evidence-based report generator",
198
+ error=str(e),
199
+ )
200
+
201
+ # Fallback to simple report if evidence generator fails
202
  # Truncate findings in fallback if too long
203
  fallback_findings = findings[:500] + "..." if len(findings) > 500 else findings
204
  return (
src/middleware/state_machine.py CHANGED
@@ -129,3 +129,4 @@ def get_workflow_state() -> WorkflowState:
129
  return state
130
 
131
 
 
 
129
  return state
130
 
131
 
132
+
src/tools/searchxng_web_search.py CHANGED
@@ -115,3 +115,4 @@ class SearchXNGWebSearchTool:
115
  raise SearchError(f"SearchXNG search failed: {e}") from e
116
 
117
 
 
 
115
  raise SearchError(f"SearchXNG search failed: {e}") from e
116
 
117
 
118
+
src/tools/serper_web_search.py CHANGED
@@ -115,3 +115,4 @@ class SerperWebSearchTool:
115
  raise SearchError(f"Serper search failed: {e}") from e
116
 
117
 
 
 
115
  raise SearchError(f"Serper search failed: {e}") from e
116
 
117
 
118
+
src/tools/vendored/crawl_website.py CHANGED
@@ -127,3 +127,4 @@ async def crawl_website(starting_url: str) -> list[ScrapeResult] | str:
127
  return result
128
 
129
 
 
 
127
  return result
128
 
129
 
130
+
src/tools/vendored/searchxng_client.py CHANGED
@@ -96,3 +96,4 @@ class SearchXNGClient:
96
  raise SearchError(f"SearchXNG search failed: {e}") from e
97
 
98
 
 
 
96
  raise SearchError(f"SearchXNG search failed: {e}") from e
97
 
98
 
99
+
src/tools/vendored/serper_client.py CHANGED
@@ -92,3 +92,4 @@ class SerperClient:
92
  raise SearchError(f"Serper search failed: {e}") from e
93
 
94
 
 
 
92
  raise SearchError(f"Serper search failed: {e}") from e
93
 
94
 
95
+
src/tools/vendored/web_search_core.py CHANGED
@@ -201,3 +201,4 @@ def is_valid_url(url: str) -> bool:
201
  return True
202
 
203
 
 
 
201
  return True
202
 
203
 
204
+
src/tools/web_search_factory.py CHANGED
@@ -68,3 +68,4 @@ def create_web_search_tool() -> SearchTool | None:
68
  return None
69
 
70
 
 
 
68
  return None
69
 
70
 
71
+
src/utils/markdown.css CHANGED
@@ -6,3 +6,4 @@ body {
6
  }
7
 
8
 
 
 
6
  }
7
 
8
 
9
+
src/utils/md_to_pdf.py CHANGED
@@ -66,3 +66,4 @@ def md_to_pdf(md_text: str, pdf_file_path: str) -> None:
66
  logger.debug("PDF generated successfully", pdf_path=pdf_file_path)
67
 
68
 
 
 
66
  logger.debug("PDF generated successfully", pdf_path=pdf_file_path)
67
 
68
 
69
+
src/utils/report_generator.py CHANGED
@@ -169,3 +169,4 @@ def generate_report_from_evidence(
169
  return "".join(report_parts)
170
 
171
 
 
 
169
  return "".join(report_parts)
170
 
171
 
172
+
tests/unit/middleware/test_budget_tracker_phase7.py CHANGED
@@ -177,5 +177,6 @@ class TestIterationTokenTracking:
177
 
178
 
179
 
 
180
 
181
 
 
177
 
178
 
179
 
180
+
181
 
182
 
tests/unit/middleware/test_state_machine.py CHANGED
@@ -374,5 +374,6 @@ class TestContextVarIsolation:
374
 
375
 
376
 
 
377
 
378
 
 
374
 
375
 
376
 
377
+
378
 
379
 
tests/unit/middleware/test_workflow_manager.py CHANGED
@@ -304,5 +304,6 @@ class TestWorkflowManager:
304
 
305
 
306
 
 
307
 
308
 
 
304
 
305
 
306
 
307
+
308
 
309