syntaxmatrix 2.0.2__tar.gz → 2.1.2__tar.gz
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.
- {syntaxmatrix-2.0.2/SyntaxMatrix.egg-info → syntaxmatrix-2.1.2}/PKG-INFO +2 -2
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2/SyntaxMatrix.egg-info}/PKG-INFO +2 -2
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/SyntaxMatrix.egg-info/SOURCES.txt +5 -38
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/SyntaxMatrix.egg-info/requires.txt +1 -1
- syntaxmatrix-2.1.2/SyntaxMatrix.egg-info/top_level.txt +1 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/setup.py +2 -2
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/__init__.py → syntaxmatrix-2.1.2/syntaxmatrix/__init__.py +12 -7
- syntaxmatrix-2.1.2/syntaxmatrix/commentary.py +295 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/core.py +205 -122
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/generate_page.py +54 -7
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/kernel_manager.py → syntaxmatrix-2.1.2/syntaxmatrix/kernel_manager.py +7 -2
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/plottings.py → syntaxmatrix-2.1.2/syntaxmatrix/plottings.py +3 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/profiles.py +6 -6
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/routes.py +1704 -376
- syntaxmatrix-2.1.2/syntaxmatrix/settings/model_map.py +277 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/settings/prompts.py +67 -2
- syntaxmatrix-2.1.2/syntaxmatrix/settings/string_navbar.py +5 -0
- syntaxmatrix-2.1.2/syntaxmatrix/static/docs.md +272 -0
- syntaxmatrix-2.1.2/syntaxmatrix/static/icons/favicon.png +0 -0
- syntaxmatrix-2.1.2/syntaxmatrix/static/icons/hero_bg.jpg +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/templates/dashboard.html +8 -7
- syntaxmatrix-2.1.2/syntaxmatrix/templates/docs_page_embed.html +20 -0
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/auth.py +0 -163
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/core.py +0 -769
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/generate_page.py +0 -131
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/profiles.py +0 -39
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/routes.py +0 -3027
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/settings/model_map.py +0 -114
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/settings/prompts.py +0 -154
- syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/settings/string_navbar.py +0 -5
- syntaxmatrix-2.0.2/SyntaxMatrix.egg-info/top_level.txt +0 -2
- syntaxmatrix-2.0.2/syntaxmatrix/__init__.py +0 -59
- syntaxmatrix-2.0.2/syntaxmatrix/bootstrap.py +0 -27
- syntaxmatrix-2.0.2/syntaxmatrix/db.py +0 -139
- syntaxmatrix-2.0.2/syntaxmatrix/display.py +0 -132
- syntaxmatrix-2.0.2/syntaxmatrix/emailer.py +0 -26
- syntaxmatrix-2.0.2/syntaxmatrix/file_processor.py +0 -92
- syntaxmatrix-2.0.2/syntaxmatrix/history_store.py +0 -192
- syntaxmatrix-2.0.2/syntaxmatrix/kernel_manager.py +0 -204
- syntaxmatrix-2.0.2/syntaxmatrix/llm_store.py +0 -255
- syntaxmatrix-2.0.2/syntaxmatrix/model_templates.py +0 -29
- syntaxmatrix-2.0.2/syntaxmatrix/models.py +0 -14
- syntaxmatrix-2.0.2/syntaxmatrix/plottings.py +0 -167
- syntaxmatrix-2.0.2/syntaxmatrix/project_root.py +0 -61
- syntaxmatrix-2.0.2/syntaxmatrix/session.py +0 -19
- syntaxmatrix-2.0.2/syntaxmatrix/settings/__init__.py +0 -0
- syntaxmatrix-2.0.2/syntaxmatrix/settings/model_map.py +0 -160
- syntaxmatrix-2.0.2/syntaxmatrix/settings/string_navbar.py +0 -5
- syntaxmatrix-2.0.2/syntaxmatrix/smiv.py +0 -45
- syntaxmatrix-2.0.2/syntaxmatrix/smpv.py +0 -121
- syntaxmatrix-2.0.2/syntaxmatrix/static/icons/favicon.ico +0 -0
- syntaxmatrix-2.0.2/syntaxmatrix/themes.py +0 -112
- syntaxmatrix-2.0.2/syntaxmatrix/utils.py +0 -804
- syntaxmatrix-2.0.2/syntaxmatrix/vector_db.py +0 -202
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/__init__.py +0 -16
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/adapters/__init__.py +0 -0
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/adapters/milvus_adapter.py +0 -0
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/adapters/pgvector_adapter.py +0 -0
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/adapters/sqlite_adapter.py +0 -170
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/base.py +0 -116
- syntaxmatrix-2.0.2/syntaxmatrix/vectordb/registry.py +0 -161
- syntaxmatrix-2.0.2/syntaxmatrix/vectorizer.py +0 -47
- syntaxmatrix-2.0.2/syntaxmatrix/workspace_db.py +0 -100
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/LICENSE.txt +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/README.md +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/SyntaxMatrix.egg-info/dependency_links.txt +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/pyproject.toml +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/setup.cfg +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/auth.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/bootstrap.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/db.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/display.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/emailer.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/file_processor.py +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/gpt_models_latest.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/history_store.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/llm_store.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/model_templates.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/models.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/project_root.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/session.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/settings/__init__.py +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/settings/default.yaml +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/settings/logging.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/smiv.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/smpv.py +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/css/style.css +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/icons/logo.png +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/icons/svg_497526.svg +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/icons/svg_497528.svg +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/js/chat.js +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/js/sidebar.js +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/static/js/widgets.js +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/templates/code_cell.html +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/templates/error.html +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/templates/login.html +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/templates/register.html +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/themes.py +0 -0
- {syntaxmatrix-2.0.2 → syntaxmatrix-2.1.2}/syntaxmatrix/ui_modes.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/utils.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vector_db.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/__init__.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/adapters/__init__.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/adapters/milvus_adapter.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/adapters/pgvector_adapter.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/adapters/sqlite_adapter.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/base.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectordb/registry.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/vectorizer.py +0 -0
- {syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy → syntaxmatrix-2.1.2/syntaxmatrix}/workspace_db.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: syntaxmatrix
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: SyntaxMUI: A customizable framework for Python AI Assistant Projects.
|
|
5
5
|
Home-page: https://github.com/bobganti/syntaxmatrix_demo
|
|
6
6
|
Author: Bob Nti
|
|
@@ -26,7 +26,7 @@ Provides-Extra: mlearning
|
|
|
26
26
|
Requires-Dist: pandas>=2.2.3; extra == "mlearning"
|
|
27
27
|
Requires-Dist: numpy>=2.0.2; extra == "mlearning"
|
|
28
28
|
Requires-Dist: matplotlib>=3.9.4; extra == "mlearning"
|
|
29
|
-
Requires-Dist: plotly>=6.
|
|
29
|
+
Requires-Dist: plotly>=6.3.0; extra == "mlearning"
|
|
30
30
|
Requires-Dist: seaborn>=0.13.2; extra == "mlearning"
|
|
31
31
|
Requires-Dist: scikit-learn>=1.6.1; extra == "mlearning"
|
|
32
32
|
Requires-Dist: jupyter_client>=8.6.3; extra == "mlearning"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: syntaxmatrix
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: SyntaxMUI: A customizable framework for Python AI Assistant Projects.
|
|
5
5
|
Home-page: https://github.com/bobganti/syntaxmatrix_demo
|
|
6
6
|
Author: Bob Nti
|
|
@@ -26,7 +26,7 @@ Provides-Extra: mlearning
|
|
|
26
26
|
Requires-Dist: pandas>=2.2.3; extra == "mlearning"
|
|
27
27
|
Requires-Dist: numpy>=2.0.2; extra == "mlearning"
|
|
28
28
|
Requires-Dist: matplotlib>=3.9.4; extra == "mlearning"
|
|
29
|
-
Requires-Dist: plotly>=6.
|
|
29
|
+
Requires-Dist: plotly>=6.3.0; extra == "mlearning"
|
|
30
30
|
Requires-Dist: seaborn>=0.13.2; extra == "mlearning"
|
|
31
31
|
Requires-Dist: scikit-learn>=1.6.1; extra == "mlearning"
|
|
32
32
|
Requires-Dist: jupyter_client>=8.6.3; extra == "mlearning"
|
|
@@ -2,43 +2,6 @@ LICENSE.txt
|
|
|
2
2
|
README.md
|
|
3
3
|
pyproject.toml
|
|
4
4
|
setup.py
|
|
5
|
-
ASsyntaxmatrix - Copy/__init__.py
|
|
6
|
-
ASsyntaxmatrix - Copy/auth.py
|
|
7
|
-
ASsyntaxmatrix - Copy/bootstrap.py
|
|
8
|
-
ASsyntaxmatrix - Copy/core.py
|
|
9
|
-
ASsyntaxmatrix - Copy/db.py
|
|
10
|
-
ASsyntaxmatrix - Copy/display.py
|
|
11
|
-
ASsyntaxmatrix - Copy/emailer.py
|
|
12
|
-
ASsyntaxmatrix - Copy/file_processor.py
|
|
13
|
-
ASsyntaxmatrix - Copy/generate_page.py
|
|
14
|
-
ASsyntaxmatrix - Copy/history_store.py
|
|
15
|
-
ASsyntaxmatrix - Copy/kernel_manager.py
|
|
16
|
-
ASsyntaxmatrix - Copy/llm_store.py
|
|
17
|
-
ASsyntaxmatrix - Copy/model_templates.py
|
|
18
|
-
ASsyntaxmatrix - Copy/models.py
|
|
19
|
-
ASsyntaxmatrix - Copy/plottings.py
|
|
20
|
-
ASsyntaxmatrix - Copy/profiles.py
|
|
21
|
-
ASsyntaxmatrix - Copy/project_root.py
|
|
22
|
-
ASsyntaxmatrix - Copy/routes.py
|
|
23
|
-
ASsyntaxmatrix - Copy/session.py
|
|
24
|
-
ASsyntaxmatrix - Copy/smiv.py
|
|
25
|
-
ASsyntaxmatrix - Copy/smpv.py
|
|
26
|
-
ASsyntaxmatrix - Copy/themes.py
|
|
27
|
-
ASsyntaxmatrix - Copy/utils.py
|
|
28
|
-
ASsyntaxmatrix - Copy/vector_db.py
|
|
29
|
-
ASsyntaxmatrix - Copy/vectorizer.py
|
|
30
|
-
ASsyntaxmatrix - Copy/workspace_db.py
|
|
31
|
-
ASsyntaxmatrix - Copy/settings/__init__.py
|
|
32
|
-
ASsyntaxmatrix - Copy/settings/model_map.py
|
|
33
|
-
ASsyntaxmatrix - Copy/settings/prompts.py
|
|
34
|
-
ASsyntaxmatrix - Copy/settings/string_navbar.py
|
|
35
|
-
ASsyntaxmatrix - Copy/vectordb/__init__.py
|
|
36
|
-
ASsyntaxmatrix - Copy/vectordb/base.py
|
|
37
|
-
ASsyntaxmatrix - Copy/vectordb/registry.py
|
|
38
|
-
ASsyntaxmatrix - Copy/vectordb/adapters/__init__.py
|
|
39
|
-
ASsyntaxmatrix - Copy/vectordb/adapters/milvus_adapter.py
|
|
40
|
-
ASsyntaxmatrix - Copy/vectordb/adapters/pgvector_adapter.py
|
|
41
|
-
ASsyntaxmatrix - Copy/vectordb/adapters/sqlite_adapter.py
|
|
42
5
|
SyntaxMatrix.egg-info/PKG-INFO
|
|
43
6
|
SyntaxMatrix.egg-info/SOURCES.txt
|
|
44
7
|
SyntaxMatrix.egg-info/dependency_links.txt
|
|
@@ -47,6 +10,7 @@ SyntaxMatrix.egg-info/top_level.txt
|
|
|
47
10
|
syntaxmatrix/__init__.py
|
|
48
11
|
syntaxmatrix/auth.py
|
|
49
12
|
syntaxmatrix/bootstrap.py
|
|
13
|
+
syntaxmatrix/commentary.py
|
|
50
14
|
syntaxmatrix/core.py
|
|
51
15
|
syntaxmatrix/db.py
|
|
52
16
|
syntaxmatrix/display.py
|
|
@@ -83,8 +47,10 @@ syntaxmatrix/settings/logging.py
|
|
|
83
47
|
syntaxmatrix/settings/model_map.py
|
|
84
48
|
syntaxmatrix/settings/prompts.py
|
|
85
49
|
syntaxmatrix/settings/string_navbar.py
|
|
50
|
+
syntaxmatrix/static/docs.md
|
|
86
51
|
syntaxmatrix/static/css/style.css
|
|
87
|
-
syntaxmatrix/static/icons/favicon.
|
|
52
|
+
syntaxmatrix/static/icons/favicon.png
|
|
53
|
+
syntaxmatrix/static/icons/hero_bg.jpg
|
|
88
54
|
syntaxmatrix/static/icons/logo.png
|
|
89
55
|
syntaxmatrix/static/icons/svg_497526.svg
|
|
90
56
|
syntaxmatrix/static/icons/svg_497528.svg
|
|
@@ -93,6 +59,7 @@ syntaxmatrix/static/js/sidebar.js
|
|
|
93
59
|
syntaxmatrix/static/js/widgets.js
|
|
94
60
|
syntaxmatrix/templates/code_cell.html
|
|
95
61
|
syntaxmatrix/templates/dashboard.html
|
|
62
|
+
syntaxmatrix/templates/docs_page_embed.html
|
|
96
63
|
syntaxmatrix/templates/error.html
|
|
97
64
|
syntaxmatrix/templates/login.html
|
|
98
65
|
syntaxmatrix/templates/register.html
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
syntaxmatrix
|
|
@@ -8,7 +8,7 @@ with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="syntaxmatrix",
|
|
11
|
-
version="2.
|
|
11
|
+
version="2.1.2",
|
|
12
12
|
author="Bob Nti",
|
|
13
13
|
author_email="bob.nti@syntaxmatrix.com",
|
|
14
14
|
description="SyntaxMUI: A customizable framework for Python AI Assistant Projects.",
|
|
@@ -43,7 +43,7 @@ setup(
|
|
|
43
43
|
"pandas>=2.2.3",
|
|
44
44
|
"numpy>=2.0.2",
|
|
45
45
|
"matplotlib>=3.9.4",
|
|
46
|
-
"plotly>=6.
|
|
46
|
+
"plotly>=6.3.0",
|
|
47
47
|
"seaborn>=0.13.2",
|
|
48
48
|
"scikit-learn>=1.6.1",
|
|
49
49
|
"jupyter_client>=8.6.3",
|
syntaxmatrix-2.0.2/ASsyntaxmatrix - Copy/__init__.py → syntaxmatrix-2.1.2/syntaxmatrix/__init__.py
RENAMED
|
@@ -9,7 +9,6 @@ file_uploader = _app_instance.file_uploader
|
|
|
9
9
|
set_ui_mode = _app_instance.set_ui_mode
|
|
10
10
|
set_theme = _app_instance.set_theme
|
|
11
11
|
enable_theme_toggle = _app_instance.enable_theme_toggle
|
|
12
|
-
disable_theme_toggle = _app_instance.disable_theme_toggle
|
|
13
12
|
get_text_input_value = _app_instance.get_text_input_value
|
|
14
13
|
clear_text_input_value = _app_instance.clear_text_input_value
|
|
15
14
|
get_file_upload_value = _app_instance.get_file_upload_value
|
|
@@ -17,8 +16,6 @@ get_chat_history = _app_instance.get_chat_history
|
|
|
17
16
|
set_chat_history = _app_instance.set_chat_history
|
|
18
17
|
clear_chat_history = _app_instance.clear_chat_history
|
|
19
18
|
write = _app_instance.write
|
|
20
|
-
markdown = _app_instance.markdown
|
|
21
|
-
latex = _app_instance.latex
|
|
22
19
|
error = _app_instance.error
|
|
23
20
|
success = _app_instance.success
|
|
24
21
|
info = _app_instance.info
|
|
@@ -28,19 +25,19 @@ warning = _app_instance.warning
|
|
|
28
25
|
|
|
29
26
|
set_user_icon = _app_instance.set_user_icon
|
|
30
27
|
set_bot_icon = _app_instance.set_bot_icon
|
|
28
|
+
get_favicon = _app_instance.get_favicon
|
|
31
29
|
set_favicon = _app_instance.set_favicon
|
|
32
|
-
|
|
30
|
+
set_project_name = _app_instance.set_project_name
|
|
33
31
|
set_site_title = _app_instance.set_site_title
|
|
34
32
|
set_site_logo = _app_instance.set_site_logo
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
get_ui_modes = _app_instance.get_ui_modes
|
|
34
|
+
get_themes = _app_instance.get_themes
|
|
37
35
|
load_sys_chunks = _app_instance.load_sys_chunks
|
|
38
36
|
|
|
39
37
|
get_session_id = _app_instance.get_session_id
|
|
40
38
|
add_user_chunks = _app_instance.add_user_chunks
|
|
41
39
|
get_user_chunks = _app_instance.get_user_chunks
|
|
42
40
|
clear_user_chunks = _app_instance.clear_user_chunks
|
|
43
|
-
stream_write = _app_instance.stream_write
|
|
44
41
|
set_plottings = _app_instance.set_plottings
|
|
45
42
|
dropdown = _app_instance.dropdown
|
|
46
43
|
get_widget_value = _app_instance.get_widget_value
|
|
@@ -53,7 +50,15 @@ set_prompt_instructions = _app_instance.set_prompt_instructions
|
|
|
53
50
|
set_website_description = _app_instance.set_website_description
|
|
54
51
|
smiv_index = _app_instance.smiv_index
|
|
55
52
|
smpv_search = _app_instance.smpv_search
|
|
53
|
+
stream_process_query= _app_instance.stream_process_query
|
|
54
|
+
process_query_stream = _app_instance.process_query_stream
|
|
56
55
|
process_query = _app_instance.process_query
|
|
57
56
|
embed_query = _app_instance.embed_query
|
|
57
|
+
enable_user_files = _app_instance.enable_user_files
|
|
58
|
+
stream_write = _app_instance.stream_write
|
|
59
|
+
enable_stream = _app_instance.enable_stream
|
|
60
|
+
stream = _app_instance.stream
|
|
61
|
+
get_stream_args = _app_instance.get_stream_args
|
|
62
|
+
# set_stream_args = _app_instance.set_stream_args
|
|
58
63
|
|
|
59
64
|
app = _app_instance.app
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os, io, re, json, base64
|
|
4
|
+
from typing import Any, Dict, List, Optional
|
|
5
|
+
|
|
6
|
+
from syntaxmatrix import profiles as _prof
|
|
7
|
+
from syntaxmatrix.settings.model_map import GPT_MODELS_LATEST
|
|
8
|
+
from syntaxmatrix.gpt_models_latest import extract_output_text as _out, set_args
|
|
9
|
+
from google.genai import types
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Axes/labels/legend (read-only; no plotting changes)
|
|
13
|
+
MPL_PROBE_SNIPPET = r"""
|
|
14
|
+
import json
|
|
15
|
+
import matplotlib.pyplot as plt
|
|
16
|
+
|
|
17
|
+
out=[]
|
|
18
|
+
for num in plt.get_fignums():
|
|
19
|
+
fig = plt.figure(num)
|
|
20
|
+
for ax in fig.get_axes():
|
|
21
|
+
info = {
|
|
22
|
+
"title": (ax.get_title() or "").strip(),
|
|
23
|
+
"x_label": (ax.get_xlabel() or "").strip(),
|
|
24
|
+
"y_label": (ax.get_ylabel() or "").strip(),
|
|
25
|
+
"legend": []
|
|
26
|
+
}
|
|
27
|
+
try:
|
|
28
|
+
leg = ax.get_legend()
|
|
29
|
+
if leg:
|
|
30
|
+
info["legend"] = [t.get_text().strip() for t in leg.get_texts() if t.get_text().strip()]
|
|
31
|
+
except Exception:
|
|
32
|
+
pass
|
|
33
|
+
out.append(info)
|
|
34
|
+
print("SMX_VIS_SUMMARY::" + json.dumps(out))
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
# 2) Figure images to base64 (tight bbox, high DPI)
|
|
38
|
+
MPL_IMAGE_PROBE_SNIPPET = r"""
|
|
39
|
+
import json, io, base64
|
|
40
|
+
import matplotlib.pyplot as plt
|
|
41
|
+
|
|
42
|
+
payload=[]
|
|
43
|
+
for num in plt.get_fignums():
|
|
44
|
+
fig = plt.figure(num)
|
|
45
|
+
axes=[]
|
|
46
|
+
for ax in fig.get_axes():
|
|
47
|
+
info={"title": (ax.get_title() or "").strip(),
|
|
48
|
+
"x_label": (ax.get_xlabel() or "").strip(),
|
|
49
|
+
"y_label": (ax.get_ylabel() or "").strip(),
|
|
50
|
+
"legend": []}
|
|
51
|
+
try:
|
|
52
|
+
leg = ax.get_legend()
|
|
53
|
+
if leg:
|
|
54
|
+
info["legend"] = [t.get_text().strip() for t in leg.get_texts() if t.get_text().strip()]
|
|
55
|
+
except Exception:
|
|
56
|
+
pass
|
|
57
|
+
axes.append(info)
|
|
58
|
+
|
|
59
|
+
b64 = ""
|
|
60
|
+
try:
|
|
61
|
+
buf = io.BytesIO()
|
|
62
|
+
fig.savefig(buf, format="png", dpi=192, bbox_inches="tight", facecolor="white")
|
|
63
|
+
buf.seek(0)
|
|
64
|
+
b64 = base64.b64encode(buf.read()).decode("ascii")
|
|
65
|
+
except Exception:
|
|
66
|
+
b64 = ""
|
|
67
|
+
payload.append({"png_b64": b64, "axes": axes})
|
|
68
|
+
print("SMX_FIGS_B64::" + json.dumps(payload))
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _json(obj: Any) -> str:
|
|
73
|
+
return json.dumps(obj, ensure_ascii=False, separators=(",", ":"), indent=2)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def parse_mpl_probe_output(text_blocks: List[str]) -> List[Dict[str, Any]]:
|
|
77
|
+
joined = "\n".join(text_blocks)
|
|
78
|
+
m = re.search(r"SMX_VIS_SUMMARY::(\[.*\]|\{.*\})", joined, re.DOTALL)
|
|
79
|
+
if not m:
|
|
80
|
+
return []
|
|
81
|
+
try:
|
|
82
|
+
data = json.loads(m.group(1))
|
|
83
|
+
return data if isinstance(data, list) else []
|
|
84
|
+
except Exception:
|
|
85
|
+
return []
|
|
86
|
+
|
|
87
|
+
def parse_image_probe_output(text_blocks: List[str]) -> List[Dict[str, Any]]:
|
|
88
|
+
joined = "\n".join(text_blocks)
|
|
89
|
+
m = re.search(r"SMX_FIGS_B64::(\[.*\])", joined, re.DOTALL)
|
|
90
|
+
if not m:
|
|
91
|
+
return []
|
|
92
|
+
try:
|
|
93
|
+
data = json.loads(m.group(1))
|
|
94
|
+
return data if isinstance(data, list) else []
|
|
95
|
+
except Exception:
|
|
96
|
+
return []
|
|
97
|
+
|
|
98
|
+
# 3) Table headers (from already-rendered HTML) — optional but helps context
|
|
99
|
+
def _strip_tags(s: str) -> str:
|
|
100
|
+
return re.sub(r"<[^>]+>", " ", s).strip()
|
|
101
|
+
|
|
102
|
+
def sniff_tables_from_html(html: str) -> List[Dict[str, Any]]:
|
|
103
|
+
tables=[]
|
|
104
|
+
for tbl in re.findall(r"<table[^>]*class=[\"'][^\"']*smx-table[^\"']*[\"'][^>]*>(.*?)</table>",
|
|
105
|
+
html, re.DOTALL|re.IGNORECASE):
|
|
106
|
+
ths = re.findall(r"<th[^>]*>(.*?)</th>", tbl, re.DOTALL|re.IGNORECASE)
|
|
107
|
+
headers = [_strip_tags(h) for h in ths][:50]
|
|
108
|
+
trs = re.findall(r"<tr[^>]*>", tbl, re.IGNORECASE)
|
|
109
|
+
tables.append({
|
|
110
|
+
"columns": headers,
|
|
111
|
+
"columns_count": len(headers),
|
|
112
|
+
"rows_approx": max(0, len(trs)-1)
|
|
113
|
+
})
|
|
114
|
+
return tables
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def build_display_summary(question: str,
|
|
118
|
+
mpl_axes: List[Dict[str, Any]],
|
|
119
|
+
html_blocks: List[str]) -> Dict[str, Any]:
|
|
120
|
+
html_joined = "\n".join(str(b) for b in html_blocks)
|
|
121
|
+
tables = sniff_tables_from_html(html_joined)
|
|
122
|
+
|
|
123
|
+
axes_clean=[]
|
|
124
|
+
for ax in mpl_axes:
|
|
125
|
+
axes_clean.append({
|
|
126
|
+
"title": ax.get("title",""),
|
|
127
|
+
"x_label": ax.get("x_label",""),
|
|
128
|
+
"y_label": ax.get("y_label",""),
|
|
129
|
+
"legend": ax.get("legend", []),
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
"question": (question or "").strip(),
|
|
134
|
+
"axes": axes_clean,
|
|
135
|
+
"tables": tables
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
def _context_strings(context: Dict[str, Any]) -> List[str]:
|
|
139
|
+
s = [context.get("question","")]
|
|
140
|
+
for ax in context.get("axes", []) or []:
|
|
141
|
+
s += [ax.get("title",""), ax.get("x_label",""), ax.get("y_label","")]
|
|
142
|
+
s += (ax.get("legend", []) or [])
|
|
143
|
+
for t in context.get("tables", []) or []:
|
|
144
|
+
s += (t.get("columns", []) or [])
|
|
145
|
+
# de-dup
|
|
146
|
+
seen=set(); out=[]
|
|
147
|
+
for it in s:
|
|
148
|
+
it=(it or "").strip()
|
|
149
|
+
if not it: continue
|
|
150
|
+
k=it.lower()
|
|
151
|
+
if k in seen: continue
|
|
152
|
+
seen.add(k); out.append(it)
|
|
153
|
+
return out
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# --- C) LLM prompts ---
|
|
159
|
+
|
|
160
|
+
_SYSTEM_VISION = (
|
|
161
|
+
"You are a data analyst. Write a short, precise commentary in UK English that explains what the "
|
|
162
|
+
"already-rendered visuals mean for the user's question. "
|
|
163
|
+
"Use information visible in the attached figures and the provided context strings (field names, labels). "
|
|
164
|
+
"Do not invent numbers. If the figures/context are insufficient, say: 'Insufficient context to comment usefully.'"
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
_USER_TMPL_VISION = """\
|
|
168
|
+
Question:
|
|
169
|
+
{q}
|
|
170
|
+
|
|
171
|
+
Visible context strings (titles, axes, legends, headers):
|
|
172
|
+
{ctx}
|
|
173
|
+
|
|
174
|
+
Write a concise conclusion (~140-200 words) with:
|
|
175
|
+
- Headline (one sentence answering the question).
|
|
176
|
+
- Evidence (4-5 bullets referencing panels/axes/legend groups seen in the figures).
|
|
177
|
+
- Limitations (1-2 bullets; avoid quoting numbers unless present in context).
|
|
178
|
+
- Next step (1 bullet).
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
def phrase_commentary_vision(context: Dict[str, Any], images_b64: List[str]) -> str:
|
|
182
|
+
"""
|
|
183
|
+
Use the project's 'vision2text' profile (profiles.py). If the provider supports images,
|
|
184
|
+
send figures + text; otherwise fall back to a text-only prompt grounded by labels.
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
visible = _context_strings(context)
|
|
188
|
+
user = _USER_TMPL_VISION.format(
|
|
189
|
+
q=context.get("question",""),
|
|
190
|
+
ctx=json.dumps(visible, ensure_ascii=False, indent=2)
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
# Always try 'vision2text' first, then fall back to 'admin'
|
|
194
|
+
prof = _prof.get_profile("vision2text") or _prof.get_profile("admin")
|
|
195
|
+
if not prof:
|
|
196
|
+
return "Insufficient context to comment usefully."
|
|
197
|
+
client = _prof.get_client(prof)
|
|
198
|
+
provider = (prof.get("provider") or "").lower()
|
|
199
|
+
model = prof.get("model") or ""
|
|
200
|
+
|
|
201
|
+
# Google GenAI (Gemini) — multimodal
|
|
202
|
+
if provider == "google":
|
|
203
|
+
try:
|
|
204
|
+
from google.genai import types
|
|
205
|
+
parts = [types.Part.from_text(text=user)]
|
|
206
|
+
for b64 in images_b64[:4]:
|
|
207
|
+
if b64:
|
|
208
|
+
parts.append(types.Part.from_bytes(data=base64.b64decode(b64), mime_type="image/png"))
|
|
209
|
+
contents = [types.Content(role="user", parts=parts)]
|
|
210
|
+
resp = client.models.generate_content(
|
|
211
|
+
model=model,
|
|
212
|
+
contents=contents,
|
|
213
|
+
system_instruction=_SYSTEM_VISION
|
|
214
|
+
)
|
|
215
|
+
txt = getattr(resp, "text", "") or ""
|
|
216
|
+
if txt.strip():
|
|
217
|
+
return txt.strip()
|
|
218
|
+
except Exception:
|
|
219
|
+
pass # fall through to text-only
|
|
220
|
+
|
|
221
|
+
elif provider == "openai" and model in GPT_MODELS_LATEST:
|
|
222
|
+
# Use the Responses API with multimodal input (text + up to 4 images)
|
|
223
|
+
try:
|
|
224
|
+
parts = [{"type": "input_text", "text": user}]
|
|
225
|
+
for b64 in (images_b64 or [])[:4]:
|
|
226
|
+
if b64:
|
|
227
|
+
parts.append({"type": "input_image", "image_url": f"data:image/png;base64,{b64}"})
|
|
228
|
+
|
|
229
|
+
args = set_args(
|
|
230
|
+
model=model,
|
|
231
|
+
instructions=_SYSTEM_VISION,
|
|
232
|
+
input=[{"role": "user", "content": parts}],
|
|
233
|
+
previous_id=None,
|
|
234
|
+
store=False,
|
|
235
|
+
reasoning_effort="minimal",
|
|
236
|
+
verbosity="low",
|
|
237
|
+
)
|
|
238
|
+
resp = client.responses.create(**args)
|
|
239
|
+
txt = _out(resp) or ""
|
|
240
|
+
if txt.strip():
|
|
241
|
+
return txt.strip()
|
|
242
|
+
except Exception:
|
|
243
|
+
# If the Responses path fails for any reason, fall through to the
|
|
244
|
+
# chat.completions fallback implemented below.
|
|
245
|
+
pass
|
|
246
|
+
|
|
247
|
+
# OpenAI (gpt-4o / gpt-4o-mini) — chat.completions with image parts
|
|
248
|
+
else: # provider in {"openai","xai","deepseek","moonshotai","alibaba"}:
|
|
249
|
+
try:
|
|
250
|
+
parts = [{"type":"text","text": user}]
|
|
251
|
+
for b64 in images_b64[:4]:
|
|
252
|
+
if b64:
|
|
253
|
+
parts.append({"type":"image_url","image_url":{"url": f"data:image/png;base64,{b64}"}})
|
|
254
|
+
resp = client.chat.completions.create(
|
|
255
|
+
model=model,
|
|
256
|
+
temperature=0.2,
|
|
257
|
+
messages=[
|
|
258
|
+
{"role":"system","content":_SYSTEM_VISION},
|
|
259
|
+
{"role":"user","content":parts},
|
|
260
|
+
],
|
|
261
|
+
max_tokens=600,
|
|
262
|
+
)
|
|
263
|
+
return (resp.choices[0].message.content or "").strip()
|
|
264
|
+
except Exception:
|
|
265
|
+
pass # fall through
|
|
266
|
+
|
|
267
|
+
# Text-only fallback via Responses API
|
|
268
|
+
try:
|
|
269
|
+
args = set_args(model=model, instructions=_SYSTEM_VISION,
|
|
270
|
+
input=user, previous_id=None, store=False,
|
|
271
|
+
reasoning_effort="minimal", verbosity="low")
|
|
272
|
+
resp = client.responses.create(**args)
|
|
273
|
+
return _out(resp)
|
|
274
|
+
except Exception:
|
|
275
|
+
# Classic chat fallback
|
|
276
|
+
try:
|
|
277
|
+
resp = client.chat.completions.create(
|
|
278
|
+
model=model,
|
|
279
|
+
temperature=0.2,
|
|
280
|
+
messages=[{"role":"system","content":_SYSTEM_VISION},
|
|
281
|
+
{"role":"user","content":user}],
|
|
282
|
+
max_tokens=600,
|
|
283
|
+
)
|
|
284
|
+
return (resp.choices[0].message.content or "").strip()
|
|
285
|
+
except Exception:
|
|
286
|
+
return "Insufficient context to comment usefully."
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def wrap_html(card_text: str) -> str:
|
|
290
|
+
return f"""
|
|
291
|
+
<div class="smx-commentary-card" style="margin-top:1rem;padding:1rem;border:1px solid #e5e7eb;border-radius:0.75rem;background:#fafafa">
|
|
292
|
+
<div style="font-weight:600;margin-bottom:0.5rem;">Commentary</div>
|
|
293
|
+
<div class="prose" style="white-space:pre-wrap;line-height:1.45">{card_text}</div>
|
|
294
|
+
</div>
|
|
295
|
+
""".strip()
|