markdown-flow 0.2.8__py3-none-any.whl → 0.2.10__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.
markdown_flow/__init__.py CHANGED
@@ -83,4 +83,4 @@ __all__ = [
83
83
  "replace_variables_in_text",
84
84
  ]
85
85
 
86
- __version__ = "0.2.8"
86
+ __version__ = "0.2.10"
markdown_flow/core.py CHANGED
@@ -478,7 +478,7 @@ class MarkdownFlow:
478
478
  error_msg = f"Please select from: {', '.join(button_displays)}"
479
479
  return self._render_error(error_msg, mode)
480
480
 
481
- # Validate input values against available buttons
481
+ # First, check if user input matches available buttons
482
482
  valid_values = []
483
483
  invalid_values = []
484
484
 
@@ -491,19 +491,30 @@ class MarkdownFlow:
491
491
  break
492
492
 
493
493
  if not matched:
494
- if allow_text_input:
495
- # Allow custom text in buttons+text mode
496
- valid_values.append(value)
497
- else:
498
- invalid_values.append(value)
499
-
500
- # Check for validation errors
501
- if invalid_values and not allow_text_input:
494
+ invalid_values.append(value)
495
+
496
+ # If there are invalid values and this interaction allows text input, use LLM validation
497
+ if invalid_values and allow_text_input:
498
+ # Use LLM validation for text input interactions
499
+ button_displays = [btn["display"] for btn in buttons]
500
+ question = parse_result.get("question", "")
501
+
502
+ return self._process_llm_validation_with_options(
503
+ block_index=0, # Not used in the method
504
+ user_input={target_variable: target_values},
505
+ target_variable=target_variable,
506
+ options=button_displays,
507
+ question=question,
508
+ mode=mode
509
+ )
510
+
511
+ # Check for validation errors in pure button mode or when text input not allowed
512
+ if invalid_values:
502
513
  button_displays = [btn["display"] for btn in buttons]
503
514
  error_msg = f"Invalid options: {', '.join(invalid_values)}. Please select from: {', '.join(button_displays)}"
504
515
  return self._render_error(error_msg, mode)
505
516
 
506
- # Success: return validated values
517
+ # Success: return validated button values
507
518
  return LLMResult(
508
519
  content="",
509
520
  variables={target_variable: valid_values},
@@ -513,6 +524,7 @@ class MarkdownFlow:
513
524
  "valid_values": valid_values,
514
525
  "invalid_values": invalid_values,
515
526
  "total_input_count": len(target_values),
527
+ "llm_validated": False,
516
528
  },
517
529
  )
518
530
 
@@ -1132,7 +1144,7 @@ Analyze the content and provide the structured interaction data.""")
1132
1144
  )
1133
1145
 
1134
1146
  # Merge with existing variables for dynamic interactions
1135
- if hasattr(button_result, 'variables') and variables:
1147
+ if hasattr(button_result, 'variables') and button_result.variables is not None and variables:
1136
1148
  merged_variables = dict(variables)
1137
1149
  merged_variables.update(button_result.variables)
1138
1150
  return LLMResult(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-flow
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: An agent library designed to parse and process MarkdownFlow documents
5
5
  Project-URL: Homepage, https://github.com/ai-shifu/markdown-flow-agent-py
6
6
  Project-URL: Bug Tracker, https://github.com/ai-shifu/markdown-flow-agent-py/issues
@@ -0,0 +1,13 @@
1
+ markdown_flow/__init__.py,sha256=BVUJBlr7xrT6ctNgYHPFynvY7bPXcptugNDAsTp4oJU,2875
2
+ markdown_flow/constants.py,sha256=pd_KCpTEVlz_IXYekrByqb9VWCQR_XHXoGsFYdLW1Eg,8006
3
+ markdown_flow/core.py,sha256=HNeSbVBuiu03NF6m_jSo1o7V-W_FbdPsth62VLsG7Nw,49170
4
+ markdown_flow/enums.py,sha256=Wr41zt0Ce5b3fyLtOTE2erEVp1n92g9OVaBF_BZg_l8,820
5
+ markdown_flow/exceptions.py,sha256=9sUZ-Jd3CPLdSRqG8Pw7eMm7cv_S3VZM6jmjUU8OhIc,976
6
+ markdown_flow/llm.py,sha256=7DjOL2h2N1g0L4NF9kn0M5mR45ZL0vPsW3TzuOGy1bw,2547
7
+ markdown_flow/models.py,sha256=ENcvXMVXwpFN-RzbeVHhXTjBN0bbmRpJ96K-XS2rizI,2893
8
+ markdown_flow/utils.py,sha256=cVi0zDRK_rCMAr3EDhgITmx6Po5fSvYjqrprYaitYE0,28450
9
+ markdown_flow-0.2.10.dist-info/licenses/LICENSE,sha256=qz3BziejhHPd1xa5eVtYEU5Qp6L2pn4otuj194uGxmc,1069
10
+ markdown_flow-0.2.10.dist-info/METADATA,sha256=QLL_76xo6kwnmH6_6RdpZ5NuFT8MTAZavmHpCFPQ54A,24287
11
+ markdown_flow-0.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ markdown_flow-0.2.10.dist-info/top_level.txt,sha256=DpigGvQuIt2L0TTLnDU5sylhiTGiZS7MmAMa2hi-AJs,14
13
+ markdown_flow-0.2.10.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- markdown_flow/__init__.py,sha256=rx_PP6l0JOJ3CriXTjlMOycNclrIyvxbgHakpx37SxM,2874
2
- markdown_flow/constants.py,sha256=pd_KCpTEVlz_IXYekrByqb9VWCQR_XHXoGsFYdLW1Eg,8006
3
- markdown_flow/core.py,sha256=k_6cNDp3a0PSnWF3yOWmuIpFHRp7wTsPUcGbnMpw5bg,48548
4
- markdown_flow/enums.py,sha256=Wr41zt0Ce5b3fyLtOTE2erEVp1n92g9OVaBF_BZg_l8,820
5
- markdown_flow/exceptions.py,sha256=9sUZ-Jd3CPLdSRqG8Pw7eMm7cv_S3VZM6jmjUU8OhIc,976
6
- markdown_flow/llm.py,sha256=7DjOL2h2N1g0L4NF9kn0M5mR45ZL0vPsW3TzuOGy1bw,2547
7
- markdown_flow/models.py,sha256=ENcvXMVXwpFN-RzbeVHhXTjBN0bbmRpJ96K-XS2rizI,2893
8
- markdown_flow/utils.py,sha256=cVi0zDRK_rCMAr3EDhgITmx6Po5fSvYjqrprYaitYE0,28450
9
- markdown_flow-0.2.8.dist-info/licenses/LICENSE,sha256=qz3BziejhHPd1xa5eVtYEU5Qp6L2pn4otuj194uGxmc,1069
10
- markdown_flow-0.2.8.dist-info/METADATA,sha256=Yv38um7zSpnztRo60I1bVCsi3U6_XMcg-9WcVFILPg4,24286
11
- markdown_flow-0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- markdown_flow-0.2.8.dist-info/top_level.txt,sha256=DpigGvQuIt2L0TTLnDU5sylhiTGiZS7MmAMa2hi-AJs,14
13
- markdown_flow-0.2.8.dist-info/RECORD,,