syntaxmatrix 2.5.8__py3-none-any.whl → 2.5.8.1__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.
@@ -288,6 +288,7 @@ def mlearning_agent(user_prompt, system_prompt, coding_profile):
288
288
  else:
289
289
  code = openai_sdk_generate_code()
290
290
 
291
+ code = str(code or "")
291
292
  return code, usage
292
293
 
293
294
 
syntaxmatrix/core.py CHANGED
@@ -54,7 +54,7 @@ class SyntaxMUI:
54
54
  port="5080",
55
55
  user_icon="👩🏿‍🦲",
56
56
  bot_icon="<img src='/static/icons/favicon.png' width=20' alt='bot'/>",
57
- favicon="", # /static/icons/favicon.png",
57
+ favicon="/static/icons/favicon.png",
58
58
  site_logo="<img src='/static/icons/logo.png' width='30' alt='logo'/>",
59
59
  site_title="SyntaxMatrix",
60
60
  project_name="smxAI",
syntaxmatrix/routes.py CHANGED
@@ -6525,7 +6525,7 @@ def setup_routes(smx):
6525
6525
  cell["highlighted_code"] = Markup(_pygmentize(cell["code"]))
6526
6526
 
6527
6527
  highlighted_ai_code = _pygmentize(ai_code)
6528
- smxAI = "Orion"
6528
+ smxAI = "smxAI"
6529
6529
 
6530
6530
  return render_template(
6531
6531
  "dashboard.html",
syntaxmatrix/utils.py CHANGED
@@ -1,9 +1,7 @@
1
1
  from __future__ import annotations
2
- import re, textwrap
3
- import pandas as pd
4
- import numpy as np
2
+ import re, textwrap, ast
3
+ import pandas as pd, numpy as np
5
4
  import warnings
6
-
7
5
  from difflib import get_close_matches
8
6
  from typing import Iterable, Tuple, Dict
9
7
  import inspect
@@ -645,6 +643,18 @@ def harden_ai_code(code: str) -> str:
645
643
  fixed = _patch_feature_coef_dataframe(fixed)
646
644
  fixed = _strip_file_io_ops(fixed)
647
645
 
646
+ metric_defaults = "\n".join([
647
+ "acc = None",
648
+ "accuracy = None",
649
+ "r2 = None",
650
+ "mae = None",
651
+ "rmse = None",
652
+ "f1 = None",
653
+ "precision = None",
654
+ "recall = None",
655
+ ]) + "\n"
656
+ fixed = metric_defaults + fixed
657
+
648
658
  # Import shared preface helpers once and wrap the LLM body safely
649
659
  header = "from syntaxmatrix.preface import *\n\n"
650
660
  wrapped = header + wrap_llm_code_safe(fixed)
@@ -1622,6 +1632,44 @@ def clean_llm_code(code: str) -> str:
1622
1632
  """
1623
1633
  code = str(code or "")
1624
1634
 
1635
+ # Special case: sometimes the OpenAI SDK object repr (e.g. ChatCompletion(...))
1636
+ # is accidentally passed here as `code`. In that case, extract the actual
1637
+ # Python code from the ChatCompletionMessage(content=...) field.
1638
+ if "ChatCompletion(" in code and "ChatCompletionMessage" in code and "content=" in code:
1639
+ try:
1640
+ extracted = None
1641
+
1642
+ class _ChatCompletionVisitor(ast.NodeVisitor):
1643
+ def visit_Call(self, node):
1644
+ nonlocal extracted
1645
+ func = node.func
1646
+ fname = getattr(func, "id", None) or getattr(func, "attr", None)
1647
+ if fname == "ChatCompletionMessage":
1648
+ for kw in node.keywords:
1649
+ if kw.arg == "content" and isinstance(kw.value, ast.Constant) and isinstance(kw.value.value, str):
1650
+ extracted = kw.value.value
1651
+ self.generic_visit(node)
1652
+
1653
+ tree = ast.parse(code, mode="exec")
1654
+ _ChatCompletionVisitor().visit(tree)
1655
+ if extracted:
1656
+ code = extracted
1657
+ except Exception:
1658
+ # Best-effort regex fallback if AST parsing fails
1659
+ m = re.search(r"content=(?P<q>['\\\"])(?P<body>.*?)(?P=q)", code, flags=re.S)
1660
+ if m:
1661
+ code = m.group("body")
1662
+
1663
+ # Existing logic continues unchanged below...
1664
+ # Extract fenced blocks (```python ... ``` or ``` ... ```)
1665
+ blocks = re.findall(r"```(?:python)?\s*(.*?)```", code, flags=re.I | re.S)
1666
+
1667
+ if blocks:
1668
+ # pick the largest block; small trailing blocks are usually garbage
1669
+ largest = max(blocks, key=lambda b: len(b.strip()))
1670
+ if len(largest.strip().splitlines()) >= 10:
1671
+ code = largest
1672
+
1625
1673
  # Extract fenced blocks (```python ... ``` or ``` ... ```)
1626
1674
  blocks = re.findall(r"```(?:python)?\s*(.*?)```", code, flags=re.I | re.S)
1627
1675
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syntaxmatrix
3
- Version: 2.5.8
3
+ Version: 2.5.8.1
4
4
  Summary: SyntaxMUI: A customizable framework for Python AI Assistant Projects.
5
5
  Author: Bob Nti
6
6
  Author-email: bob.nti@syntaxmatrix.net
@@ -2,7 +2,7 @@ syntaxmatrix/__init__.py,sha256=_LnTrYAW2tbYA37Y233Vv4OMOk8NUnoJi-1yzFyHxEI,2573
2
2
  syntaxmatrix/auth.py,sha256=SCD6uWojXjj9yjUTKzgV5kBYe6ZkXASEG2VopLFkEtM,18140
3
3
  syntaxmatrix/bootstrap.py,sha256=Y7ZNg-Z3ecrr1iYem5EMzPmGstXnEKmO9kqKVoOoljo,817
4
4
  syntaxmatrix/commentary.py,sha256=3uSlbaQ1zl-gYtEtEpFbv2M-IH-HSdFdMvhxa7UCNHk,12025
5
- syntaxmatrix/core.py,sha256=7o5givPq7Io9DCnJQjTy-izgYvJivE2POxvG45i3dBk,61338
5
+ syntaxmatrix/core.py,sha256=hebGEXJLL4q9X7jQkl_OJptIh_5AEIAy7T3HchIcjdI,61332
6
6
  syntaxmatrix/dataset_preprocessing.py,sha256=wtV4MWzkyfOsBHTsS0H1gqHho77ZQHGDI9skJryyZWA,8732
7
7
  syntaxmatrix/db.py,sha256=xkCpyhFxnAwrnZCTd13NkJsahVze0i4egjMcbB7kPfs,5000
8
8
  syntaxmatrix/display.py,sha256=TgMrE5WW80VlLcL_XvEz936mekFccJgLTfzbCIozSc8,3728
@@ -18,19 +18,19 @@ syntaxmatrix/plottings.py,sha256=MjHQ9T1_oC5oyr4_wkM2GJDrpjp0sbvudbs2lGaMyzk,610
18
18
  syntaxmatrix/preface.py,sha256=EOK3lflMJ-0B6SRJtVXhzZjhvu-bfXzw-sy1TbTYOVs,17009
19
19
  syntaxmatrix/profiles.py,sha256=0-lky7Wj-WQlP5CbvTyw1tI2M0FiqhhTkLZYLRhD5AU,2251
20
20
  syntaxmatrix/project_root.py,sha256=1ckvbFVV1szHtHsfSCoGcImHkRwbfszmPG1kGh9ZZlE,2227
21
- syntaxmatrix/routes.py,sha256=z8ANOl2MQIzcLGbFxiUNviE4E4xQwOWH_gb8zZgU2dA,310998
21
+ syntaxmatrix/routes.py,sha256=WRLKCtwGFzIetMFUyvE5cb9tl2-j54qx-JA-VlDwcQM,310998
22
22
  syntaxmatrix/session.py,sha256=v0qgxnVM_LEaNvZQJSa-13Q2eiwc3RDnjd2SahNnHQk,599
23
23
  syntaxmatrix/smiv.py,sha256=1lSN3UYpXvYoVNd6VrkY5iZuF_nDxD6xxvLnTn9wcbQ,1405
24
24
  syntaxmatrix/smpv.py,sha256=rrCgYqfjBaK2n5qzfQyXK3bHFMvgNcCIqPaXquOLtDM,3600
25
25
  syntaxmatrix/themes.py,sha256=qa90vPZTuNNKB37loZhChQfu5QqkaJG4JxgI_4QgCxw,3576
26
26
  syntaxmatrix/ui_modes.py,sha256=5lfKK3AKAB-JQCWfi1GRYp4sQqg4Z0fC3RJ8G3VGCMw,152
27
- syntaxmatrix/utils.py,sha256=NrClmFCAoPO7Rgd93SAaWTrMjLNkY1zPf7b8aoK8Ohw,123940
27
+ syntaxmatrix/utils.py,sha256=deyPiM-sHaqudspFKX9i7VPdmZlWMKcEx-PxjYOZ_lg,126045
28
28
  syntaxmatrix/vector_db.py,sha256=ozvOcMHt52xFAvcp-vAqT69kECPq9BwL8Rzgq3AJaMs,5824
29
29
  syntaxmatrix/vectorizer.py,sha256=5w_UQiUIirm_W-Q9TcaEI8LTcTYIuDBdKfz79T1aZ8g,1366
30
30
  syntaxmatrix/workspace_db.py,sha256=Xu9OlW8wo3iaH5Y88ZMdLOf-fiZxF1NBb5rAw3KcbfY,4715
31
31
  syntaxmatrix/agentic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  syntaxmatrix/agentic/agent_tools.py,sha256=yQwavONP23ziMxNQf3j2Y4TVo_LxEsiAWecKuBK8WDg,866
33
- syntaxmatrix/agentic/agents.py,sha256=sK_lgmZTBah-8B86yuRowUGjpLjUsNPmlWKhjSuP75A,29380
33
+ syntaxmatrix/agentic/agents.py,sha256=_dCEuAMV-OWZ-omXUVPgDpfJkzg9AtIb48ZK5s8TICE,29408
34
34
  syntaxmatrix/agentic/code_tools_registry.py,sha256=Wp4-KHtp0BUVciqSbmionBsQMVFOnvJPruBJeNiuwkk,1564
35
35
  syntaxmatrix/agentic/model_templates.py,sha256=A3ROE3BHkvnU9cxqSGjlCBIw9U15zRaTKgK-WxcZtUI,76033
36
36
  syntaxmatrix/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -64,8 +64,8 @@ syntaxmatrix/vectordb/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
64
64
  syntaxmatrix/vectordb/adapters/milvus_adapter.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
65
  syntaxmatrix/vectordb/adapters/pgvector_adapter.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  syntaxmatrix/vectordb/adapters/sqlite_adapter.py,sha256=L8M2qHfwZRAFVxWeurUVdHaJXz6F5xTUSWh3uy6TSUs,6035
67
- syntaxmatrix-2.5.8.dist-info/licenses/LICENSE.txt,sha256=j1P8naTdy1JMxTC80XYQjbyAQnuOlpDusCUhncrvpy8,1083
68
- syntaxmatrix-2.5.8.dist-info/METADATA,sha256=0n7w_0wpDvswlDt7bSklNnXuA2CrL3pZns-9ZSRbkVQ,18090
69
- syntaxmatrix-2.5.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
- syntaxmatrix-2.5.8.dist-info/top_level.txt,sha256=HKP_zkl4V_nt7osC15DlacoBZktHrbZYOqf_pPkF3T8,13
71
- syntaxmatrix-2.5.8.dist-info/RECORD,,
67
+ syntaxmatrix-2.5.8.1.dist-info/licenses/LICENSE.txt,sha256=j1P8naTdy1JMxTC80XYQjbyAQnuOlpDusCUhncrvpy8,1083
68
+ syntaxmatrix-2.5.8.1.dist-info/METADATA,sha256=6TyiQ5hh35pNXj0PvjF7Tk0mcG3hTO920PeRBEoOOWk,18092
69
+ syntaxmatrix-2.5.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
+ syntaxmatrix-2.5.8.1.dist-info/top_level.txt,sha256=HKP_zkl4V_nt7osC15DlacoBZktHrbZYOqf_pPkF3T8,13
71
+ syntaxmatrix-2.5.8.1.dist-info/RECORD,,