local-deep-research 0.5.7__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. local_deep_research/__version__.py +1 -1
  2. local_deep_research/advanced_search_system/candidate_exploration/progressive_explorer.py +11 -1
  3. local_deep_research/advanced_search_system/questions/browsecomp_question.py +32 -6
  4. local_deep_research/advanced_search_system/strategies/focused_iteration_strategy.py +33 -8
  5. local_deep_research/advanced_search_system/strategies/source_based_strategy.py +2 -0
  6. local_deep_research/api/__init__.py +2 -0
  7. local_deep_research/api/research_functions.py +177 -3
  8. local_deep_research/benchmarks/graders.py +150 -5
  9. local_deep_research/benchmarks/models/__init__.py +19 -0
  10. local_deep_research/benchmarks/models/benchmark_models.py +283 -0
  11. local_deep_research/benchmarks/ui/__init__.py +1 -0
  12. local_deep_research/benchmarks/web_api/__init__.py +6 -0
  13. local_deep_research/benchmarks/web_api/benchmark_routes.py +862 -0
  14. local_deep_research/benchmarks/web_api/benchmark_service.py +920 -0
  15. local_deep_research/config/llm_config.py +106 -21
  16. local_deep_research/defaults/default_settings.json +448 -3
  17. local_deep_research/error_handling/report_generator.py +10 -0
  18. local_deep_research/llm/__init__.py +19 -0
  19. local_deep_research/llm/llm_registry.py +155 -0
  20. local_deep_research/metrics/db_models.py +3 -7
  21. local_deep_research/metrics/search_tracker.py +25 -11
  22. local_deep_research/report_generator.py +3 -2
  23. local_deep_research/search_system.py +12 -9
  24. local_deep_research/utilities/log_utils.py +23 -10
  25. local_deep_research/utilities/thread_context.py +99 -0
  26. local_deep_research/web/app_factory.py +32 -8
  27. local_deep_research/web/database/benchmark_schema.py +230 -0
  28. local_deep_research/web/database/convert_research_id_to_string.py +161 -0
  29. local_deep_research/web/database/models.py +55 -1
  30. local_deep_research/web/database/schema_upgrade.py +397 -2
  31. local_deep_research/web/database/uuid_migration.py +265 -0
  32. local_deep_research/web/routes/api_routes.py +62 -31
  33. local_deep_research/web/routes/history_routes.py +13 -6
  34. local_deep_research/web/routes/metrics_routes.py +264 -4
  35. local_deep_research/web/routes/research_routes.py +45 -18
  36. local_deep_research/web/routes/route_registry.py +352 -0
  37. local_deep_research/web/routes/settings_routes.py +382 -22
  38. local_deep_research/web/services/research_service.py +22 -29
  39. local_deep_research/web/services/settings_manager.py +53 -0
  40. local_deep_research/web/services/settings_service.py +2 -0
  41. local_deep_research/web/static/css/styles.css +8 -0
  42. local_deep_research/web/static/js/components/detail.js +7 -14
  43. local_deep_research/web/static/js/components/details.js +8 -10
  44. local_deep_research/web/static/js/components/fallback/ui.js +4 -4
  45. local_deep_research/web/static/js/components/history.js +6 -6
  46. local_deep_research/web/static/js/components/logpanel.js +14 -11
  47. local_deep_research/web/static/js/components/progress.js +51 -46
  48. local_deep_research/web/static/js/components/research.js +250 -89
  49. local_deep_research/web/static/js/components/results.js +5 -7
  50. local_deep_research/web/static/js/components/settings.js +32 -26
  51. local_deep_research/web/static/js/components/settings_sync.js +24 -23
  52. local_deep_research/web/static/js/config/urls.js +285 -0
  53. local_deep_research/web/static/js/main.js +8 -8
  54. local_deep_research/web/static/js/research_form.js +267 -12
  55. local_deep_research/web/static/js/services/api.js +18 -18
  56. local_deep_research/web/static/js/services/keyboard.js +8 -8
  57. local_deep_research/web/static/js/services/socket.js +53 -35
  58. local_deep_research/web/static/js/services/ui.js +1 -1
  59. local_deep_research/web/templates/base.html +4 -1
  60. local_deep_research/web/templates/components/custom_dropdown.html +5 -3
  61. local_deep_research/web/templates/components/mobile_nav.html +3 -3
  62. local_deep_research/web/templates/components/sidebar.html +9 -3
  63. local_deep_research/web/templates/pages/benchmark.html +2697 -0
  64. local_deep_research/web/templates/pages/benchmark_results.html +1136 -0
  65. local_deep_research/web/templates/pages/benchmark_simple.html +453 -0
  66. local_deep_research/web/templates/pages/cost_analytics.html +1 -1
  67. local_deep_research/web/templates/pages/metrics.html +212 -39
  68. local_deep_research/web/templates/pages/research.html +8 -6
  69. local_deep_research/web/templates/pages/star_reviews.html +1 -1
  70. local_deep_research/web_search_engines/engines/search_engine_arxiv.py +14 -1
  71. local_deep_research/web_search_engines/engines/search_engine_brave.py +15 -1
  72. local_deep_research/web_search_engines/engines/search_engine_ddg.py +20 -1
  73. local_deep_research/web_search_engines/engines/search_engine_google_pse.py +26 -2
  74. local_deep_research/web_search_engines/engines/search_engine_pubmed.py +15 -1
  75. local_deep_research/web_search_engines/engines/search_engine_retriever.py +192 -0
  76. local_deep_research/web_search_engines/engines/search_engine_tavily.py +307 -0
  77. local_deep_research/web_search_engines/rate_limiting/__init__.py +14 -0
  78. local_deep_research/web_search_engines/rate_limiting/__main__.py +9 -0
  79. local_deep_research/web_search_engines/rate_limiting/cli.py +209 -0
  80. local_deep_research/web_search_engines/rate_limiting/exceptions.py +21 -0
  81. local_deep_research/web_search_engines/rate_limiting/tracker.py +506 -0
  82. local_deep_research/web_search_engines/retriever_registry.py +108 -0
  83. local_deep_research/web_search_engines/search_engine_base.py +161 -43
  84. local_deep_research/web_search_engines/search_engine_factory.py +14 -0
  85. local_deep_research/web_search_engines/search_engines_config.py +20 -0
  86. local_deep_research-0.6.0.dist-info/METADATA +374 -0
  87. {local_deep_research-0.5.7.dist-info → local_deep_research-0.6.0.dist-info}/RECORD +90 -65
  88. local_deep_research-0.5.7.dist-info/METADATA +0 -420
  89. {local_deep_research-0.5.7.dist-info → local_deep_research-0.6.0.dist-info}/WHEEL +0 -0
  90. {local_deep_research-0.5.7.dist-info → local_deep_research-0.6.0.dist-info}/entry_points.txt +0 -0
  91. {local_deep_research-0.5.7.dist-info → local_deep_research-0.6.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,352 @@
1
+ """
2
+ Route Registry - Central documentation of all application routes
3
+ This file provides a single place to see all available routes across blueprints
4
+
5
+ NOTE: This is primarily for documentation and reference purposes.
6
+ The actual routes are defined in their respective blueprint files.
7
+ To keep this in sync:
8
+ 1. Update this file when adding/removing routes
9
+ 2. Run tests to ensure URLs in tests match actual routes
10
+ 3. Consider using get_all_routes() in tests to validate against actual Flask routes
11
+ """
12
+
13
+ # Route patterns by blueprint
14
+ ROUTE_REGISTRY = {
15
+ "research": {
16
+ "blueprint": "research_bp",
17
+ "url_prefix": None, # Routes at root level
18
+ "routes": [
19
+ ("GET", "/", "index", "Home/Research page"),
20
+ (
21
+ "POST",
22
+ "/api/start_research",
23
+ "start_research",
24
+ "Start new research",
25
+ ),
26
+ (
27
+ "GET",
28
+ "/api/research/<int:research_id>",
29
+ "get_research_details",
30
+ "Get research details",
31
+ ),
32
+ (
33
+ "GET",
34
+ "/api/research/<int:research_id>/logs",
35
+ "get_research_logs",
36
+ "Get research logs",
37
+ ),
38
+ (
39
+ "GET",
40
+ "/api/research/<research_id>/status",
41
+ "get_research_status",
42
+ "Get research status",
43
+ ),
44
+ (
45
+ "GET",
46
+ "/api/report/<int:research_id>",
47
+ "get_research_report",
48
+ "Get research report",
49
+ ),
50
+ (
51
+ "POST",
52
+ "/api/terminate/<int:research_id>",
53
+ "terminate_research",
54
+ "Stop research",
55
+ ),
56
+ (
57
+ "DELETE",
58
+ "/api/delete/<int:research_id>",
59
+ "delete_research",
60
+ "Delete research",
61
+ ),
62
+ ("GET", "/api/history", "get_history", "Get research history"),
63
+ (
64
+ "POST",
65
+ "/api/clear_history",
66
+ "clear_history",
67
+ "Clear all history",
68
+ ),
69
+ (
70
+ "GET",
71
+ "/progress/<int:research_id>",
72
+ "progress_page",
73
+ "Research progress page",
74
+ ),
75
+ (
76
+ "GET",
77
+ "/results/<int:research_id>",
78
+ "results_page",
79
+ "Research results page",
80
+ ),
81
+ (
82
+ "GET",
83
+ "/details/<int:research_id>",
84
+ "research_details_page",
85
+ "Research details page",
86
+ ),
87
+ ],
88
+ },
89
+ "api_v1": {
90
+ "blueprint": "api_blueprint",
91
+ "url_prefix": "/api/v1",
92
+ "routes": [
93
+ ("GET", "/", "api_documentation", "API documentation"),
94
+ ("GET", "/health", "health_check", "Health check"),
95
+ (
96
+ "POST",
97
+ "/quick_summary",
98
+ "api_quick_summary",
99
+ "Quick LLM summary",
100
+ ),
101
+ (
102
+ "POST",
103
+ "/quick_summary_test",
104
+ "api_quick_summary_test",
105
+ "Test quick summary",
106
+ ),
107
+ (
108
+ "POST",
109
+ "/generate_report",
110
+ "api_generate_report",
111
+ "Generate research report",
112
+ ),
113
+ (
114
+ "POST",
115
+ "/analyze_documents",
116
+ "api_analyze_documents",
117
+ "Analyze documents",
118
+ ),
119
+ ],
120
+ },
121
+ "history": {
122
+ "blueprint": "history_bp",
123
+ "url_prefix": "/history",
124
+ "routes": [
125
+ ("GET", "/", "history_page", "History page"),
126
+ ("GET", "/api", "get_history", "Get history data"),
127
+ (
128
+ "GET",
129
+ "/status/<int:research_id>",
130
+ "get_research_status",
131
+ "Get research status",
132
+ ),
133
+ (
134
+ "GET",
135
+ "/details/<int:research_id>",
136
+ "get_research_details",
137
+ "Get research details",
138
+ ),
139
+ (
140
+ "GET",
141
+ "/logs/<int:research_id>",
142
+ "get_research_logs",
143
+ "Get research logs",
144
+ ),
145
+ (
146
+ "GET",
147
+ "/log_count/<int:research_id>",
148
+ "get_log_count",
149
+ "Get log count",
150
+ ),
151
+ (
152
+ "GET",
153
+ "/history/report/<int:research_id>",
154
+ "get_report",
155
+ "Get research report",
156
+ ),
157
+ (
158
+ "GET",
159
+ "/markdown/<int:research_id>",
160
+ "get_markdown",
161
+ "Get markdown report",
162
+ ),
163
+ ],
164
+ },
165
+ "settings": {
166
+ "blueprint": "settings_bp",
167
+ "url_prefix": "/settings",
168
+ "routes": [
169
+ ("GET", "/", "settings_page", "Settings page"),
170
+ (
171
+ "POST",
172
+ "/save_all_settings",
173
+ "save_all_settings",
174
+ "Save all settings",
175
+ ),
176
+ (
177
+ "POST",
178
+ "/reset_to_defaults",
179
+ "reset_to_defaults",
180
+ "Reset to defaults",
181
+ ),
182
+ ("GET", "/api", "api_get_all_settings", "Get all settings"),
183
+ (
184
+ "GET",
185
+ "/api/<path:key>",
186
+ "api_get_setting",
187
+ "Get specific setting",
188
+ ),
189
+ ("POST", "/api/<path:key>", "api_update_setting", "Update setting"),
190
+ (
191
+ "DELETE",
192
+ "/api/<path:key>",
193
+ "api_delete_setting",
194
+ "Delete setting",
195
+ ),
196
+ ("POST", "/api/import", "api_import_settings", "Import settings"),
197
+ (
198
+ "GET",
199
+ "/api/categories",
200
+ "api_get_categories",
201
+ "Get setting categories",
202
+ ),
203
+ ("GET", "/api/types", "api_get_types", "Get setting types"),
204
+ (
205
+ "GET",
206
+ "/api/ui_elements",
207
+ "api_get_ui_elements",
208
+ "Get UI elements",
209
+ ),
210
+ (
211
+ "GET",
212
+ "/api/available-models",
213
+ "api_get_available_models",
214
+ "Get available models",
215
+ ),
216
+ (
217
+ "GET",
218
+ "/api/available-search-engines",
219
+ "api_get_available_search_engines",
220
+ "Get search engines",
221
+ ),
222
+ (
223
+ "GET",
224
+ "/api/warnings",
225
+ "api_get_warnings",
226
+ "Get settings warnings",
227
+ ),
228
+ (
229
+ "GET",
230
+ "/api/ollama-status",
231
+ "check_ollama_status",
232
+ "Check Ollama status",
233
+ ),
234
+ ],
235
+ },
236
+ "metrics": {
237
+ "blueprint": "metrics_bp",
238
+ "url_prefix": "/metrics",
239
+ "routes": [
240
+ ("GET", "/", "metrics_dashboard", "Metrics dashboard"),
241
+ ("GET", "/costs", "costs_page", "Costs page"),
242
+ ("GET", "/star-reviews", "star_reviews_page", "Star reviews page"),
243
+ ("GET", "/api/metrics", "api_metrics", "Get metrics data"),
244
+ (
245
+ "GET",
246
+ "/api/cost-analytics",
247
+ "api_cost_analytics",
248
+ "Get cost analytics",
249
+ ),
250
+ ("GET", "/api/pricing", "api_pricing", "Get pricing data"),
251
+ (
252
+ "GET",
253
+ "/api/metrics/research/<int:research_id>",
254
+ "api_research_metrics",
255
+ "Research metrics",
256
+ ),
257
+ (
258
+ "GET",
259
+ "/api/metrics/research/<int:research_id>/timeline",
260
+ "api_research_timeline_metrics",
261
+ "Timeline metrics",
262
+ ),
263
+ (
264
+ "GET",
265
+ "/api/metrics/research/<int:research_id>/search",
266
+ "api_research_search_metrics",
267
+ "Search metrics",
268
+ ),
269
+ (
270
+ "GET",
271
+ "/api/ratings/<int:research_id>",
272
+ "api_get_research_rating",
273
+ "Get research rating",
274
+ ),
275
+ (
276
+ "POST",
277
+ "/api/ratings/<int:research_id>",
278
+ "api_save_research_rating",
279
+ "Save research rating",
280
+ ),
281
+ (
282
+ "GET",
283
+ "/api/research-costs/<int:research_id>",
284
+ "api_research_costs",
285
+ "Get research costs",
286
+ ),
287
+ ],
288
+ },
289
+ }
290
+
291
+
292
+ def get_all_routes():
293
+ """Get a flat list of all routes across blueprints"""
294
+ all_routes = []
295
+ for blueprint_name, blueprint_info in ROUTE_REGISTRY.items():
296
+ prefix = blueprint_info["url_prefix"] or ""
297
+ for method, path, endpoint, description in blueprint_info["routes"]:
298
+ full_path = f"{prefix}{path}" if prefix else path
299
+ all_routes.append(
300
+ {
301
+ "method": method,
302
+ "path": full_path,
303
+ "endpoint": f"{blueprint_name}.{endpoint}",
304
+ "description": description,
305
+ "blueprint": blueprint_name,
306
+ }
307
+ )
308
+ return all_routes
309
+
310
+
311
+ def get_routes_by_blueprint(blueprint_name):
312
+ """Get routes for a specific blueprint"""
313
+ if blueprint_name not in ROUTE_REGISTRY:
314
+ return []
315
+
316
+ blueprint_info = ROUTE_REGISTRY[blueprint_name]
317
+ prefix = blueprint_info["url_prefix"] or ""
318
+ routes = []
319
+
320
+ for method, path, endpoint, description in blueprint_info["routes"]:
321
+ full_path = f"{prefix}{path}" if prefix else path
322
+ routes.append(
323
+ {
324
+ "method": method,
325
+ "path": full_path,
326
+ "endpoint": endpoint,
327
+ "description": description,
328
+ }
329
+ )
330
+ return routes
331
+
332
+
333
+ def find_route(path_pattern):
334
+ """Find routes matching a path pattern"""
335
+ all_routes = get_all_routes()
336
+ matching_routes = []
337
+
338
+ for route in all_routes:
339
+ if path_pattern.lower() in route["path"].lower():
340
+ matching_routes.append(route)
341
+
342
+ return matching_routes
343
+
344
+
345
+ if __name__ == "__main__":
346
+ # Example usage
347
+ print("All API routes:")
348
+ for route in get_all_routes():
349
+ if "/api" in route["path"]:
350
+ print(
351
+ f"{route['method']:6} {route['path']:40} - {route['description']}"
352
+ )