robert 2.2.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.
- robert/__init__.py +9 -0
- robert/__main__.py +20 -0
- robert/_version.py +3 -0
- robert/api.py +646 -0
- robert/aqme.py +280 -0
- robert/argument_parser.py +98 -0
- robert/checkml.py +433 -0
- robert/checkml_score.py +50 -0
- robert/curate.py +217 -0
- robert/evaluate_bot_retrieval.py +125 -0
- robert/evaluate_bot_support.py +102 -0
- robert/evaluate_workflow_summaries.py +87 -0
- robert/export_bot_docs_knowledge.py +1632 -0
- robert/generate.py +249 -0
- robert/generate_utils.py +311 -0
- robert/gui_easyrob/__init__.py +0 -0
- robert/gui_easyrob/assets/gif_easyrob.gif +0 -0
- robert/gui_easyrob/bot/__init__.py +47 -0
- robert/gui_easyrob/bot/answer_metadata.py +198 -0
- robert/gui_easyrob/bot/bot_context.py +679 -0
- robert/gui_easyrob/bot/bot_engine.py +1100 -0
- robert/gui_easyrob/bot/bot_panel.py +1231 -0
- robert/gui_easyrob/bot/bot_rag.py +1178 -0
- robert/gui_easyrob/bot/bot_window.py +39 -0
- robert/gui_easyrob/bot/bot_worker.py +149 -0
- robert/gui_easyrob/bot/credential_store.py +143 -0
- robert/gui_easyrob/bot/error_parser.py +105 -0
- robert/gui_easyrob/bot/evidence_policy.py +164 -0
- robert/gui_easyrob/bot/heuristics.py +859 -0
- robert/gui_easyrob/bot/icons.py +56 -0
- robert/gui_easyrob/bot/input_csv_audit.py +212 -0
- robert/gui_easyrob/bot/knowledge/aqme_context.json +5907 -0
- robert/gui_easyrob/bot/knowledge/robert_context.json +4817 -0
- robert/gui_easyrob/bot/knowledge/ui_context.json +8293 -0
- robert/gui_easyrob/bot/knowledge_schema.py +1252 -0
- robert/gui_easyrob/bot/knowledge_sources/aqme_user_guidance.json +442 -0
- robert/gui_easyrob/bot/knowledge_sources/coverage_manifest.json +95 -0
- robert/gui_easyrob/bot/knowledge_sources/robert_user_guidance.json +471 -0
- robert/gui_easyrob/bot/knowledge_sources/ui_user_guidance.json +1312 -0
- robert/gui_easyrob/bot/llm_providers.py +1573 -0
- robert/gui_easyrob/bot/online_docs.py +105 -0
- robert/gui_easyrob/bot/prompt_policy.py +575 -0
- robert/gui_easyrob/bot/question_intent.py +562 -0
- robert/gui_easyrob/bot/response_quality.py +104 -0
- robert/gui_easyrob/bot/result_insights.py +225 -0
- robert/gui_easyrob/bot/token_usage.py +75 -0
- robert/gui_easyrob/bot/workflow_results.py +1396 -0
- robert/gui_easyrob/checkml_launcher.py +15 -0
- robert/gui_easyrob/easyrob.py +29 -0
- robert/gui_easyrob/easyrob_launcher.py +113 -0
- robert/gui_easyrob/main/__init__.py +9 -0
- robert/gui_easyrob/main/window.py +5152 -0
- robert/gui_easyrob/result_navigation.py +14 -0
- robert/gui_easyrob/tabs/__init__.py +23 -0
- robert/gui_easyrob/tabs/advanced_options.py +370 -0
- robert/gui_easyrob/tabs/aqme.py +1234 -0
- robert/gui_easyrob/tabs/checkml.py +898 -0
- robert/gui_easyrob/tabs/images.py +427 -0
- robert/gui_easyrob/tabs/interactive_predictions.py +555 -0
- robert/gui_easyrob/tabs/molssi.py +447 -0
- robert/gui_easyrob/tabs/predictions.py +484 -0
- robert/gui_easyrob/tabs/result_catalog.py +170 -0
- robert/gui_easyrob/tabs/results.py +490 -0
- robert/gui_easyrob/tabs/results_workspace.py +120 -0
- robert/gui_easyrob/test_bot_input_csv_audit.py +152 -0
- robert/gui_easyrob/test_bot_question_routing.py +383 -0
- robert/gui_easyrob/test_bot_result_analysis.py +356 -0
- robert/gui_easyrob/test_bot_retrieval_evaluation.py +110 -0
- robert/gui_easyrob/test_bot_ui_integration.py +278 -0
- robert/gui_easyrob/test_checkml_app_mode.py +124 -0
- robert/gui_easyrob/test_checkml_completion.py +57 -0
- robert/gui_easyrob/test_checkml_defaults.py +37 -0
- robert/gui_easyrob/test_checkml_result_summary.py +113 -0
- robert/gui_easyrob/test_checkml_web_mode.py +57 -0
- robert/gui_easyrob/test_dialog_layout.py +33 -0
- robert/gui_easyrob/test_gui_bot_regressions.py +320 -0
- robert/gui_easyrob/test_molssi_auto.py +569 -0
- robert/gui_easyrob/test_tutorial_view.py +215 -0
- robert/gui_easyrob/tutorials/check_model.md +25 -0
- robert/gui_easyrob/tutorials/chemdraw.md +49 -0
- robert/gui_easyrob/tutorials/csv.md +53 -0
- robert/gui_easyrob/tutorials/descriptors.md +21 -0
- robert/gui_easyrob/tutorials/overview.md +65 -0
- robert/gui_easyrob/tutorials/predictions.md +25 -0
- robert/gui_easyrob/tutorials/robbot.md +29 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_10.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_11.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_12.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_13.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_8.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_9.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_8.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_9.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_8.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_8.png +0 -0
- robert/gui_easyrob/utils/__init__.py +0 -0
- robert/gui_easyrob/utils/aqme_utils.py +238 -0
- robert/gui_easyrob/utils/molssi_utils.py +584 -0
- robert/gui_easyrob/utils/predictions_utils.py +985 -0
- robert/gui_easyrob/utils/utils_gui.py +738 -0
- robert/gui_easyrob/version.py +68 -0
- robert/gui_easyrob/web/app.css +484 -0
- robert/gui_easyrob/web/app.html +134 -0
- robert/gui_easyrob/web/app.js +764 -0
- robert/gui_easyrob/web/checkml_brand.png +0 -0
- robert/gui_easyrob/web/easyrob_background.gif +0 -0
- robert/gui_easyrob/web/easyrob_background.png +0 -0
- robert/gui_easyrob/web/images.css +89 -0
- robert/gui_easyrob/web/images.html +39 -0
- robert/gui_easyrob/web/images.js +101 -0
- robert/gui_easyrob/web/results.js +499 -0
- robert/gui_easyrob/web/robert_brand.png +0 -0
- robert/gui_easyrob/web_dialogs.py +64 -0
- robert/gui_easyrob/web_results.py +253 -0
- robert/gui_easyrob/web_shell.py +684 -0
- robert/gui_easyrob/workflow_progress.py +89 -0
- robert/gui_easyrob/workflow_run_lock.py +27 -0
- robert/icons/CheckML_icon.png +0 -0
- robert/icons/Robert_icon.png +0 -0
- robert/icons/Robert_logo.jpg +0 -0
- robert/icons/Robert_logo_transparent.png +0 -0
- robert/icons/documentation_icon.png +0 -0
- robert/icons/info_icon.png +0 -0
- robert/icons/pdf_icon.png +0 -0
- robert/icons/play_icon.png +0 -0
- robert/icons/stop_icon.png +0 -0
- robert/icons/youtube_icon.ico +0 -0
- robert/predict.py +193 -0
- robert/predict_utils.py +410 -0
- robert/report/CheckML_logo.jpg +0 -0
- robert/report/GENERATE.png +0 -0
- robert/report/Robert_icon.ico +0 -0
- robert/report/Robert_logo.jpg +0 -0
- robert/report/Robert_logo1.jpg +0 -0
- robert/report/abbrev.png +0 -0
- robert/report/adv_anal.png +0 -0
- robert/report/checkml_pass.svg +3 -0
- robert/report/checkml_unclear.svg +3 -0
- robert/report/checkml_warning.svg +3 -0
- robert/report/features.png +0 -0
- robert/report/outliers.png +0 -0
- robert/report/pred.png +0 -0
- robert/report/repro.png +0 -0
- robert/report/robust_x.png +0 -0
- robert/report/robust_y_high.png +0 -0
- robert/report/robust_y_low.png +0 -0
- robert/report/score.png +0 -0
- robert/report/score_0.jpg +0 -0
- robert/report/score_1.jpg +0 -0
- robert/report/score_10.jpg +0 -0
- robert/report/score_2.jpg +0 -0
- robert/report/score_3.jpg +0 -0
- robert/report/score_4.jpg +0 -0
- robert/report/score_5.jpg +0 -0
- robert/report/score_6.jpg +0 -0
- robert/report/score_7.jpg +0 -0
- robert/report/score_8.jpg +0 -0
- robert/report/score_9.jpg +0 -0
- robert/report/score_gray_0.jpg +0 -0
- robert/report/score_gray_1.jpg +0 -0
- robert/report/score_gray_10.jpg +0 -0
- robert/report/score_gray_2.jpg +0 -0
- robert/report/score_gray_3.jpg +0 -0
- robert/report/score_gray_4.jpg +0 -0
- robert/report/score_gray_5.jpg +0 -0
- robert/report/score_gray_6.jpg +0 -0
- robert/report/score_gray_7.jpg +0 -0
- robert/report/score_gray_8.jpg +0 -0
- robert/report/score_gray_9.jpg +0 -0
- robert/report/score_w_1_0.jpg +0 -0
- robert/report/score_w_1_1.jpg +0 -0
- robert/report/score_w_2_0.jpg +0 -0
- robert/report/score_w_2_1.jpg +0 -0
- robert/report/score_w_2_2.jpg +0 -0
- robert/report/score_w_2_gray_0.jpg +0 -0
- robert/report/score_w_2_gray_1.jpg +0 -0
- robert/report/score_w_2_gray_2.jpg +0 -0
- robert/report/score_w_3_0.jpg +0 -0
- robert/report/score_w_3_1.jpg +0 -0
- robert/report/score_w_3_2.jpg +0 -0
- robert/report/score_w_3_3.jpg +0 -0
- robert/report/score_w_4_0.jpg +0 -0
- robert/report/score_w_4_1.JPG +0 -0
- robert/report/score_w_4_2.jpg +0 -0
- robert/report/score_w_4_3.jpg +0 -0
- robert/report/score_w_4_4.jpg +0 -0
- robert/report/transpa.png +0 -0
- robert/report/y_distrib.png +0 -0
- robert/report.py +2880 -0
- robert/report_utils.py +2270 -0
- robert/robert.py +181 -0
- robert/utils.py +4763 -0
- robert/verify.py +606 -0
- robert-2.2.0.dist-info/METADATA +55 -0
- robert-2.2.0.dist-info/RECORD +261 -0
- robert-2.2.0.dist-info/WHEEL +5 -0
- robert-2.2.0.dist-info/entry_points.txt +3 -0
- robert-2.2.0.dist-info/licenses/LICENSE +21 -0
- robert-2.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""Checks for request-local inspection of selected user CSV files."""
|
|
2
|
+
|
|
3
|
+
from gui_easyrob.bot.input_csv_audit import inspect_selected_csvs
|
|
4
|
+
from gui_easyrob.bot.bot_context import GuiSnapshot
|
|
5
|
+
from gui_easyrob.bot.bot_engine import BotEngine
|
|
6
|
+
from gui_easyrob.bot.bot_rag import KnowledgeBase
|
|
7
|
+
from gui_easyrob.bot.llm_providers import ProviderAnswer, TokenUsage, build_llm_prompts
|
|
8
|
+
from types import SimpleNamespace
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_selected_main_csv_reports_concrete_data_problems(tmp_path):
|
|
12
|
+
main = tmp_path / "input.csv"
|
|
13
|
+
main.write_text(
|
|
14
|
+
"SMILES,code_name,target,charge,empty\n"
|
|
15
|
+
"CCO,a,1,0.1,\n"
|
|
16
|
+
"CCO,a,2,invalid,\n"
|
|
17
|
+
"CCC,c,,0.3,\n",
|
|
18
|
+
encoding="utf-8",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
insights = inspect_selected_csvs(
|
|
22
|
+
str(main), target_column="target", name_column="code_name", prediction_type="regression"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
assert len(insights) == 1
|
|
26
|
+
summary = insights[0].summary
|
|
27
|
+
assert insights[0].source == "input.csv"
|
|
28
|
+
assert "3 rows scanned" in summary
|
|
29
|
+
assert "1 missing target value" in summary
|
|
30
|
+
assert "1 nonnumeric value in descriptor charge" in summary
|
|
31
|
+
assert "1 repeated exact SMILES" in summary
|
|
32
|
+
assert "1 repeated code_name" in summary
|
|
33
|
+
assert "empty: 3/3 missing" in summary
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_external_csv_can_lack_target_but_missing_features_are_reported(tmp_path):
|
|
37
|
+
main = tmp_path / "train.csv"
|
|
38
|
+
external = tmp_path / "new.csv"
|
|
39
|
+
main.write_text("SMILES,code_name,target,charge,dipole\nCCO,a,1,0.1,2\n", encoding="utf-8")
|
|
40
|
+
external.write_text("SMILES,code_name,charge\nCCC,b,0.2\n", encoding="utf-8")
|
|
41
|
+
|
|
42
|
+
insights = inspect_selected_csvs(
|
|
43
|
+
str(main), str(external), target_column="target", name_column="code_name",
|
|
44
|
+
prediction_type="regression",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
assert "observed target column absent" in insights[1].summary
|
|
48
|
+
assert "missing descriptor column: dipole" in insights[1].summary
|
|
49
|
+
assert "target column missing" not in insights[1].summary
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_malformed_rows_and_duplicate_headers_are_bounded_findings(tmp_path):
|
|
53
|
+
main = tmp_path / "broken.csv"
|
|
54
|
+
main.write_text("code_name,target,target\na,1,2\nb,3\n", encoding="utf-8")
|
|
55
|
+
|
|
56
|
+
insight = inspect_selected_csvs(str(main), target_column="target")[0]
|
|
57
|
+
|
|
58
|
+
assert "duplicate header: target" in insight.summary
|
|
59
|
+
assert "1 row with a different column count" in insight.summary
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_csv_scan_limit_is_explicit(tmp_path, monkeypatch):
|
|
63
|
+
from gui_easyrob.bot import input_csv_audit
|
|
64
|
+
|
|
65
|
+
monkeypatch.setattr(input_csv_audit, "_MAX_SCAN_ROWS", 2)
|
|
66
|
+
main = tmp_path / "long.csv"
|
|
67
|
+
main.write_text("target,desc\n1,1\n2,2\n3,3\n", encoding="utf-8")
|
|
68
|
+
|
|
69
|
+
insight = inspect_selected_csvs(str(main), target_column="target")[0]
|
|
70
|
+
|
|
71
|
+
assert "2 rows scanned" in insight.summary
|
|
72
|
+
assert "scan limited to first 2 rows" in insight.summary
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_unreadable_external_csv_does_not_generate_schema_claims(tmp_path):
|
|
76
|
+
main = tmp_path / "train.csv"
|
|
77
|
+
main.write_text("code_name,target,charge\na,1,0.1\n", encoding="utf-8")
|
|
78
|
+
|
|
79
|
+
insights = inspect_selected_csvs(str(main), str(tmp_path / "missing.csv"), target_column="target")
|
|
80
|
+
|
|
81
|
+
assert "not readable" in insights[1].summary
|
|
82
|
+
assert "missing descriptor column" not in insights[1].summary
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_semicolon_csv_and_empty_csv_have_explicit_profiles(tmp_path):
|
|
86
|
+
semicolon = tmp_path / "semicolon.csv"
|
|
87
|
+
empty = tmp_path / "empty.csv"
|
|
88
|
+
semicolon.write_text("code_name;target;charge\na;1;0.1\n", encoding="utf-8")
|
|
89
|
+
empty.write_text("", encoding="utf-8")
|
|
90
|
+
|
|
91
|
+
assert "1 rows scanned, 3 columns" in inspect_selected_csvs(str(semicolon), target_column="target")[0].summary
|
|
92
|
+
assert "is empty" in inspect_selected_csvs(str(empty))[0].summary
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _gui_snapshot(csv_path):
|
|
96
|
+
return GuiSnapshot(
|
|
97
|
+
"Input", "Full Workflow", str(csv_path), "", "target", "regression",
|
|
98
|
+
False, True, False, "", [], name_column="code_name",
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_heuristic_bot_inspects_selected_csv_before_workflow(tmp_path):
|
|
103
|
+
main = tmp_path / "input.csv"
|
|
104
|
+
main.write_text("code_name,target,charge\na,1,0.1\nb,,invalid\n", encoding="utf-8")
|
|
105
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]))
|
|
106
|
+
|
|
107
|
+
answer = engine.answer("¿Qué problemas hay en mi CSV?", _gui_snapshot(main), "Heuristic", "", "")
|
|
108
|
+
|
|
109
|
+
assert "1 missing target value" in answer
|
|
110
|
+
assert "1 nonnumeric value in descriptor charge" in answer
|
|
111
|
+
assert "input.csv" in answer
|
|
112
|
+
assert "Workflow result" not in answer
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def test_cloud_bot_receives_selected_csv_facts_without_workflow(tmp_path):
|
|
116
|
+
class RecordingProvider:
|
|
117
|
+
spec = SimpleNamespace(supports_web_search=True)
|
|
118
|
+
|
|
119
|
+
def __init__(self):
|
|
120
|
+
self.calls = []
|
|
121
|
+
|
|
122
|
+
def generate_answer_with_usage(self, **kwargs):
|
|
123
|
+
self.calls.append(kwargs)
|
|
124
|
+
return ProviderAnswer("The selected CSV has a missing target value.", TokenUsage())
|
|
125
|
+
|
|
126
|
+
main = tmp_path / "input.csv"
|
|
127
|
+
main.write_text("code_name,target,charge\na,1,0.1\nb,,0.2\n", encoding="utf-8")
|
|
128
|
+
provider = RecordingProvider()
|
|
129
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]), provider_registry={"Test": provider})
|
|
130
|
+
|
|
131
|
+
engine.answer_with_metadata("Analiza mi CSV antes de entrenar", _gui_snapshot(main), "Cloud AI", "Test", "test-key")
|
|
132
|
+
|
|
133
|
+
assert len(provider.calls) == 1
|
|
134
|
+
call = provider.calls[0]
|
|
135
|
+
assert call["question_intent"] == "results"
|
|
136
|
+
assert call["gui_context"].workflow_results.kind == "INPUT CSV"
|
|
137
|
+
system_prompt, user_prompt = build_llm_prompts(
|
|
138
|
+
"Analiza mi CSV antes de entrenar", call["gui_context"], [], question_intent="results"
|
|
139
|
+
)
|
|
140
|
+
assert "1 missing target value" in user_prompt
|
|
141
|
+
assert "before a workflow run" in system_prompt
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def test_generic_question_does_not_expose_selected_csv(tmp_path):
|
|
145
|
+
main = tmp_path / "input.csv"
|
|
146
|
+
main.write_text("code_name,target\na,\n", encoding="utf-8")
|
|
147
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]))
|
|
148
|
+
|
|
149
|
+
answer = engine.answer("What is RMSE?", _gui_snapshot(main), "Heuristic", "", "")
|
|
150
|
+
|
|
151
|
+
assert "missing target" not in answer
|
|
152
|
+
assert "input.csv" not in answer
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"""Regression tests for routing user-specific model questions."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import replace
|
|
4
|
+
from types import SimpleNamespace
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from gui_easyrob.bot.answer_metadata import EvidenceOrigin, WebSearchMode
|
|
9
|
+
from gui_easyrob.bot.bot_context import GuiSnapshot
|
|
10
|
+
from gui_easyrob.bot.bot_engine import BotEngine
|
|
11
|
+
from gui_easyrob.bot.bot_rag import KnowledgeBase
|
|
12
|
+
from gui_easyrob.bot.llm_providers import ProviderAnswer, build_llm_prompts, build_provider_registry
|
|
13
|
+
from gui_easyrob.bot.question_intent import (
|
|
14
|
+
classify_question_intent,
|
|
15
|
+
is_follow_up_question,
|
|
16
|
+
is_generic_question,
|
|
17
|
+
select_inference_history,
|
|
18
|
+
)
|
|
19
|
+
from gui_easyrob.bot.token_usage import TokenUsage
|
|
20
|
+
from gui_easyrob.bot.workflow_results import (
|
|
21
|
+
WorkflowReportAssessment,
|
|
22
|
+
WorkflowResultSnapshot,
|
|
23
|
+
render_workflow_answer,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.parametrize(
|
|
28
|
+
"question",
|
|
29
|
+
(
|
|
30
|
+
"¿Cuál de mis modelos es mejor?",
|
|
31
|
+
"¿Cuál es el mejor modelo de mis resultados?",
|
|
32
|
+
"¿Puedo confiar en este modelo?",
|
|
33
|
+
"Which of my models is best?",
|
|
34
|
+
),
|
|
35
|
+
)
|
|
36
|
+
def test_personal_model_questions_use_results_context(question):
|
|
37
|
+
assert classify_question_intent(question) == "results"
|
|
38
|
+
assert not is_generic_question(question)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_general_model_definition_does_not_use_current_results():
|
|
42
|
+
assert is_generic_question("What is a machine learning model?")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_generic_metric_definition_omits_current_workflow_evidence():
|
|
46
|
+
question = "What is RMSE?"
|
|
47
|
+
assert is_generic_question(question)
|
|
48
|
+
|
|
49
|
+
system_prompt, user_prompt = build_llm_prompts(
|
|
50
|
+
question, _result_snapshot(), (), question_intent="results",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
assert "<WORKFLOW_RESULTS_DATA>" not in user_prompt
|
|
54
|
+
assert "only from supplied workflow evidence" not in system_prompt
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@pytest.mark.parametrize("question", ("What was the test R2?", "¿Cuál fue el RMSE del test?"))
|
|
58
|
+
def test_past_run_metric_question_uses_current_results(question):
|
|
59
|
+
assert not is_generic_question(question)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_personal_model_question_includes_current_workflow_evidence():
|
|
63
|
+
_, user_prompt = build_llm_prompts(
|
|
64
|
+
"¿Cuál de mis modelos es mejor?", _result_snapshot(), (), question_intent="results",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
assert "RMSE=4.2" in user_prompt
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@pytest.mark.parametrize(
|
|
71
|
+
"question",
|
|
72
|
+
("¿Qué es un modelo de ML?", "¿Cómo entreno un modelo en EasyROB?"),
|
|
73
|
+
)
|
|
74
|
+
def test_general_spanish_model_questions_are_not_result_questions(question):
|
|
75
|
+
assert classify_question_intent(question) == "tutorial"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_spanish_explanation_request_is_a_follow_up():
|
|
79
|
+
assert is_follow_up_question("¿Puedes explicarlo más?")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_long_demonstrative_question_is_a_follow_up():
|
|
83
|
+
assert is_follow_up_question("Why does that matter for my model?")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_follow_up_chain_retains_original_question_for_retrieval():
|
|
87
|
+
history = [
|
|
88
|
+
{"role": "user", "content": "What does VERIFY check in ROBERT?"},
|
|
89
|
+
{"role": "assistant", "content": "VERIFY checks predictive ability."},
|
|
90
|
+
{"role": "user", "content": "Why is that important?"},
|
|
91
|
+
{"role": "assistant", "content": "It gives validation evidence."},
|
|
92
|
+
{"role": "user", "content": "Can you explain it further?"},
|
|
93
|
+
{"role": "assistant", "content": "It checks whether performance is robust."},
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
selected = select_inference_history("And what should I check next?", history)
|
|
97
|
+
|
|
98
|
+
assert selected[0]["content"] == "What does VERIFY check in ROBERT?"
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_follow_up_does_not_cross_an_ineligible_exchange():
|
|
102
|
+
history = [
|
|
103
|
+
{"role": "user", "content": "What does VERIFY check in ROBERT?"},
|
|
104
|
+
{"role": "assistant", "content": "VERIFY checks predictive ability."},
|
|
105
|
+
{"role": "user", "content": "What is the RMSE of my model?"},
|
|
106
|
+
{"role": "assistant", "content": "No result is available.", "memory_eligible": False},
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
assert select_inference_history("Why is that important?", history) == ()
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@pytest.mark.parametrize(
|
|
113
|
+
"question",
|
|
114
|
+
("And what does CSEARCH do in AQME?", "¿Y qué hace CSEARCH en AQME?"),
|
|
115
|
+
)
|
|
116
|
+
def test_explicit_new_subject_does_not_inherit_previous_module(question):
|
|
117
|
+
history = [
|
|
118
|
+
{"role": "user", "content": "What does VERIFY check in ROBERT?"},
|
|
119
|
+
{"role": "assistant", "content": "VERIFY checks predictive ability."},
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
assert not is_follow_up_question(question)
|
|
123
|
+
assert select_inference_history(question, history) == ()
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@pytest.mark.parametrize("question", ("Why is that important?", "¿Y por qué importa?"))
|
|
127
|
+
def test_verify_explanation_follow_up_answers_the_module(question):
|
|
128
|
+
history = [
|
|
129
|
+
{"role": "user", "content": "What does VERIFY check in ROBERT?"},
|
|
130
|
+
{"role": "assistant", "content": "VERIFY checks predictive ability."},
|
|
131
|
+
]
|
|
132
|
+
snapshot = GuiSnapshot(
|
|
133
|
+
"ROBERT", "Full Workflow", "example.csv", "", "yield", "regression",
|
|
134
|
+
False, True, False, "", [],
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
answer = BotEngine().answer(
|
|
138
|
+
question, snapshot, "Heuristic", "Test", "", conversation_history=history,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
assert "VERIFY" in answer
|
|
142
|
+
assert "robustness" in answer
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_spanish_verify_chain_does_not_answer_about_the_target_column():
|
|
146
|
+
history = [
|
|
147
|
+
{"role": "user", "content": "¿Qué comprueba VERIFY en ROBERT?"},
|
|
148
|
+
{"role": "assistant", "content": "VERIFY comprueba la capacidad predictiva."},
|
|
149
|
+
{"role": "user", "content": "¿Y por qué importa?"},
|
|
150
|
+
{"role": "assistant", "content": "Aporta evidencia de validación."},
|
|
151
|
+
{"role": "user", "content": "¿Puedes explicarlo más?"},
|
|
152
|
+
{"role": "assistant", "content": "Revisa si el rendimiento es robusto."},
|
|
153
|
+
]
|
|
154
|
+
snapshot = GuiSnapshot(
|
|
155
|
+
"ROBERT", "Full Workflow", "example.csv", "", "yield", "regression",
|
|
156
|
+
False, True, False, "", [],
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
answer = BotEngine().answer(
|
|
160
|
+
"¿Y qué reviso después?", snapshot, "Heuristic", "Test", "",
|
|
161
|
+
conversation_history=history,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
assert "VERIFY" in answer
|
|
165
|
+
assert "target" not in answer.lower()
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_error_follow_up_keeps_diagnostic_intent():
|
|
169
|
+
history = (
|
|
170
|
+
{"role": "user", "content": "What does VERIFY check in ROBERT?"},
|
|
171
|
+
{"role": "assistant", "content": "VERIFY checks predictive ability."},
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
assert classify_question_intent("Why is that error important?", history) == "diagnostic"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class _RecordingProvider:
|
|
178
|
+
spec = SimpleNamespace(supports_web_search=True)
|
|
179
|
+
|
|
180
|
+
def __init__(self):
|
|
181
|
+
self.search_modes = []
|
|
182
|
+
|
|
183
|
+
def generate_answer_with_usage(self, **kwargs):
|
|
184
|
+
self.search_modes.append(kwargs["web_search_mode"])
|
|
185
|
+
return ProviderAnswer("The recorded metric needs context.", TokenUsage())
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _result_snapshot():
|
|
189
|
+
workflow = WorkflowResultSnapshot(
|
|
190
|
+
kind="ROBERT",
|
|
191
|
+
status="completed",
|
|
192
|
+
root_name="example",
|
|
193
|
+
summary_available=True,
|
|
194
|
+
metrics=(("RMSE", "4.2", "Test", "PREDICT/PREDICT_data.dat"),),
|
|
195
|
+
)
|
|
196
|
+
return GuiSnapshot(
|
|
197
|
+
"Results", "Full Workflow", "example.csv", "", "yield", "regression",
|
|
198
|
+
False, True, False, "", [], workflow_results=workflow,
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@pytest.mark.parametrize(
|
|
203
|
+
("question", "context"),
|
|
204
|
+
(
|
|
205
|
+
("what is PFI", "general"),
|
|
206
|
+
("¿Qué es PFI?", "general"),
|
|
207
|
+
("What's the difference between PFI and No PFI?", "general"),
|
|
208
|
+
("What does AQME do?", "general"),
|
|
209
|
+
("What does VERIFY do in ROBERT?", "general"),
|
|
210
|
+
("How many descriptors does AQME generate?", "general"),
|
|
211
|
+
("How do I interpret SHAP?", "general"),
|
|
212
|
+
("Can you explain overfitting?", "general"),
|
|
213
|
+
("What does the Run AQME button do?", "gui"),
|
|
214
|
+
("Why is the Predictions tab disabled?", "gui"),
|
|
215
|
+
("¿Qué significa esta advertencia?", "gui"),
|
|
216
|
+
("How do I run this workflow?", "gui"),
|
|
217
|
+
("What was the test RMSE in my run?", "results"),
|
|
218
|
+
("What is the test RMSE?", "results"),
|
|
219
|
+
("Did VERIFY pass?", "results"),
|
|
220
|
+
("How many descriptors did AQME generate?", "results"),
|
|
221
|
+
("What warnings are in my report?", "results"),
|
|
222
|
+
("Summarize my results", "results"),
|
|
223
|
+
),
|
|
224
|
+
)
|
|
225
|
+
def test_groq_routes_questions_with_a_report_loaded(question, context):
|
|
226
|
+
payloads = []
|
|
227
|
+
|
|
228
|
+
def transport(method, url, **kwargs):
|
|
229
|
+
payloads.append(kwargs["json"])
|
|
230
|
+
return SimpleNamespace(status_code=200, json=lambda: {
|
|
231
|
+
"choices": [{"message": {"content": "Here is the explanation."}}],
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
snapshot = replace(
|
|
235
|
+
_result_snapshot(),
|
|
236
|
+
result_model="Best models",
|
|
237
|
+
result_models=("RF",),
|
|
238
|
+
result_selected_variants=(("No_PFI", "RF"),),
|
|
239
|
+
result_root_reports=("ROBERT_report_No_PFI.pdf",),
|
|
240
|
+
disabled_tabs=("Predictions",),
|
|
241
|
+
popup_active=True,
|
|
242
|
+
popup_text="Select a target column before running.",
|
|
243
|
+
)
|
|
244
|
+
provider = build_provider_registry(transport)["Groq"]
|
|
245
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]), provider_registry={"Groq": provider})
|
|
246
|
+
answer = engine.answer_with_metadata(
|
|
247
|
+
question, snapshot, "Cloud AI", "Groq", "test-key", web_search_enabled=False,
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
assert payloads, answer.text
|
|
251
|
+
system_prompt, user_prompt = (message["content"] for message in payloads[0]["messages"])
|
|
252
|
+
assert ("<WORKFLOW_RESULTS_DATA>" in user_prompt) == (context == "results")
|
|
253
|
+
if context == "general":
|
|
254
|
+
assert "<GUI_STATE_DATA>" not in user_prompt
|
|
255
|
+
assert "only from supplied workflow evidence" not in system_prompt
|
|
256
|
+
if context == "gui":
|
|
257
|
+
assert "Disabled tabs: Predictions" in user_prompt
|
|
258
|
+
if "advertencia" in question:
|
|
259
|
+
assert "Select a target column before running." in user_prompt
|
|
260
|
+
if "test RMSE" in question:
|
|
261
|
+
assert "RMSE=4.2" in user_prompt
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def test_pfi_definition_in_heuristic_mode_with_only_no_pfi_selected():
|
|
265
|
+
snapshot = replace(
|
|
266
|
+
_result_snapshot(), result_models=("RF",),
|
|
267
|
+
result_selected_variants=(("No_PFI", "RF"),),
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
answer = BotEngine().answer("what is PFI", snapshot, "Heuristic", "", "")
|
|
271
|
+
|
|
272
|
+
assert "permutation feature importance" in answer.lower()
|
|
273
|
+
assert "current Results selection" not in answer
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def test_general_follow_up_keeps_the_conversation_without_loading_results():
|
|
277
|
+
question = "Why does that matter?"
|
|
278
|
+
history = [
|
|
279
|
+
{"role": "user", "content": "What is PFI?"},
|
|
280
|
+
{"role": "assistant", "content": "PFI measures the effect of shuffling a feature."},
|
|
281
|
+
]
|
|
282
|
+
|
|
283
|
+
_, user_prompt = build_llm_prompts(
|
|
284
|
+
question, _result_snapshot(), (), conversation_history=history, question_intent="parameter",
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
assert "history-user: What is PFI?" in user_prompt
|
|
288
|
+
assert "<GUI_STATE_DATA>" not in user_prompt
|
|
289
|
+
assert "<WORKFLOW_RESULTS_DATA>" not in user_prompt
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def test_local_model_result_question_does_not_trigger_optional_web_search():
|
|
293
|
+
provider = _RecordingProvider()
|
|
294
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]), provider_registry={"Test": provider})
|
|
295
|
+
|
|
296
|
+
result = engine.answer_with_metadata(
|
|
297
|
+
"¿Cuál de mis modelos es mejor?", _result_snapshot(), "Cloud AI", "Test", "test-key",
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
assert provider.search_modes == [WebSearchMode.OFF]
|
|
301
|
+
assert result.metadata.evidence_origin == EvidenceOrigin.LOCAL_SYSTEM
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def test_generic_metric_definition_is_not_labeled_as_local_result():
|
|
305
|
+
provider = _RecordingProvider()
|
|
306
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]), provider_registry={"Test": provider})
|
|
307
|
+
|
|
308
|
+
result = engine.answer_with_metadata(
|
|
309
|
+
"What is RMSE?", _result_snapshot(), "Cloud AI", "Test", "test-key",
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
assert provider.search_modes == [WebSearchMode.AUTO]
|
|
313
|
+
assert result.metadata.evidence_origin == EvidenceOrigin.GENERAL_KNOWLEDGE
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def test_explicit_web_request_keeps_web_search_for_model_question():
|
|
317
|
+
provider = _RecordingProvider()
|
|
318
|
+
engine = BotEngine(knowledge_base=KnowledgeBase([]), provider_registry={"Test": provider})
|
|
319
|
+
|
|
320
|
+
engine.answer_with_metadata(
|
|
321
|
+
"Busca en internet si este modelo es fiable", _result_snapshot(),
|
|
322
|
+
"Cloud AI", "Test", "test-key",
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
assert provider.search_modes == [WebSearchMode.REQUIRED]
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
@pytest.mark.parametrize("question", ("Can I trust this model?", "¿Puedo confiar en este modelo?"))
|
|
329
|
+
def test_model_trust_question_explains_limits_of_recorded_scores(question):
|
|
330
|
+
workflow = WorkflowResultSnapshot(
|
|
331
|
+
kind="ROBERT",
|
|
332
|
+
status="completed",
|
|
333
|
+
root_name="example",
|
|
334
|
+
summary_available=True,
|
|
335
|
+
report_assessments=(WorkflowReportAssessment(
|
|
336
|
+
variant="PFI", model="RF", prediction_type="regression",
|
|
337
|
+
interpolation_score=7, boundary_score=5,
|
|
338
|
+
),),
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
answer = render_workflow_answer(workflow, question)
|
|
342
|
+
|
|
343
|
+
assert "Prediction suitability" in answer
|
|
344
|
+
assert "acceptable for your use" in answer
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def test_metric_followups_keep_the_original_topic_and_answer_the_new_question():
|
|
348
|
+
engine = BotEngine()
|
|
349
|
+
snapshot = GuiSnapshot(
|
|
350
|
+
"ROBERT", "Full Workflow", "example.csv", "", "yield", "regression",
|
|
351
|
+
False, True, False, "", [],
|
|
352
|
+
)
|
|
353
|
+
first_question = "What does RMSE mean?"
|
|
354
|
+
first_answer = engine.answer(first_question, snapshot, "Heuristic", "Test", "")
|
|
355
|
+
history = [
|
|
356
|
+
{"role": "user", "content": first_question},
|
|
357
|
+
{"role": "assistant", "content": first_answer},
|
|
358
|
+
]
|
|
359
|
+
|
|
360
|
+
second_question = "Is a lower value always better?"
|
|
361
|
+
second_answer = engine.answer(
|
|
362
|
+
second_question, snapshot, "Heuristic", "Test", "", conversation_history=history,
|
|
363
|
+
)
|
|
364
|
+
assert "RMSE" in second_answer
|
|
365
|
+
assert "lower" in second_answer.lower()
|
|
366
|
+
assert "same target" in second_answer.lower()
|
|
367
|
+
assert "QCORR" not in second_answer
|
|
368
|
+
|
|
369
|
+
history.extend((
|
|
370
|
+
{"role": "user", "content": second_question},
|
|
371
|
+
{"role": "assistant", "content": second_answer},
|
|
372
|
+
))
|
|
373
|
+
example_answer = engine.answer(
|
|
374
|
+
"Explain it with a short example.", snapshot, "Heuristic", "Test", "",
|
|
375
|
+
conversation_history=history,
|
|
376
|
+
)
|
|
377
|
+
assert "RMSE" in example_answer
|
|
378
|
+
assert "5" in example_answer
|
|
379
|
+
assert "percentage points" in example_answer
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def test_named_metric_comparison_does_not_inherit_an_unrelated_topic():
|
|
383
|
+
assert not is_follow_up_question("Is a lower RMSE value always better?")
|