text2model 1.0.0__tar.gz → 1.1.0__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.
Files changed (148) hide show
  1. {text2model-1.0.0/text2model.egg-info → text2model-1.1.0}/PKG-INFO +81 -18
  2. {text2model-1.0.0 → text2model-1.1.0}/README.md +78 -15
  3. {text2model-1.0.0 → text2model-1.1.0}/pyproject.toml +4 -4
  4. text2model-1.1.0/text2model/editor/__init__.py +10 -0
  5. text2model-1.1.0/text2model/editor/app.py +1246 -0
  6. text2model-1.1.0/text2model/editor/data/text2zinc.csv +64680 -0
  7. text2model-1.1.0/text2model/generate_knowledge_graph.py +110 -0
  8. {text2model-1.0.0 → text2model-1.1.0}/text2model/main.py +84 -31
  9. {text2model-1.0.0 → text2model-1.1.0}/text2model/utils.py +41 -0
  10. {text2model-1.0.0 → text2model-1.1.0/text2model.egg-info}/PKG-INFO +81 -18
  11. {text2model-1.0.0 → text2model-1.1.0}/text2model.egg-info/SOURCES.txt +4 -0
  12. {text2model-1.0.0 → text2model-1.1.0}/text2model.egg-info/requires.txt +1 -2
  13. {text2model-1.0.0 → text2model-1.1.0}/LICENSE +0 -0
  14. {text2model-1.0.0 → text2model-1.1.0}/setup.cfg +0 -0
  15. {text2model-1.0.0 → text2model-1.1.0}/tests/test_integration.py +0 -0
  16. {text2model-1.0.0 → text2model-1.1.0}/tests/test_main.py +0 -0
  17. {text2model-1.0.0 → text2model-1.1.0}/tests/test_utils.py +0 -0
  18. {text2model-1.0.0 → text2model-1.1.0}/text2model/__init__.py +0 -0
  19. {text2model-1.0.0 → text2model-1.1.0}/text2model/grammar.mzn +0 -0
  20. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_12.ttl +0 -0
  21. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_14.ttl +0 -0
  22. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_2.ttl +0 -0
  23. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_22.ttl +0 -0
  24. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_28.ttl +0 -0
  25. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_30.ttl +0 -0
  26. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_34.ttl +0 -0
  27. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_39.ttl +0 -0
  28. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_54.ttl +0 -0
  29. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_6.ttl +0 -0
  30. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/CSPLib_8.ttl +0 -0
  31. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/LPWP_128.ttl +0 -0
  32. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/LPWP_232.ttl +0 -0
  33. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/LPWP_53.ttl +0 -0
  34. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/LPWP_66.ttl +0 -0
  35. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/LPWP_85.ttl +0 -0
  36. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_1.ttl +0 -0
  37. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_18.ttl +0 -0
  38. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_2.ttl +0 -0
  39. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_28.ttl +0 -0
  40. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_31.ttl +0 -0
  41. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_4.ttl +0 -0
  42. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_5.ttl +0 -0
  43. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_6.ttl +0 -0
  44. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/OR_LP_IP_Scheduling_problem_8.ttl +0 -0
  45. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/combinatorial_problem_1.ttl +0 -0
  46. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/combinatorial_problem_31.ttl +0 -0
  47. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/combinatorial_problem_32.ttl +0 -0
  48. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/combinatorial_problem_7.ttl +0 -0
  49. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_AircraftAssignment.ttl +0 -0
  50. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_AircraftLanding.ttl +0 -0
  51. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_CFLP.ttl +0 -0
  52. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_CapacitatedWarehouseLocation.ttl +0 -0
  53. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_CarSelection.ttl +0 -0
  54. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_TSP.ttl +0 -0
  55. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/complexor_VRPTW.ttl +0 -0
  56. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_1.ttl +0 -0
  57. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_10.ttl +0 -0
  58. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_11.ttl +0 -0
  59. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_12.ttl +0 -0
  60. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_13.ttl +0 -0
  61. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_14.ttl +0 -0
  62. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_15.ttl +0 -0
  63. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_16.ttl +0 -0
  64. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_17.ttl +0 -0
  65. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_18.ttl +0 -0
  66. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_19.ttl +0 -0
  67. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_2.ttl +0 -0
  68. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_20.ttl +0 -0
  69. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_21.ttl +0 -0
  70. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_22.ttl +0 -0
  71. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_23.ttl +0 -0
  72. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_24.ttl +0 -0
  73. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_25.ttl +0 -0
  74. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_27.ttl +0 -0
  75. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_28.ttl +0 -0
  76. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_29.ttl +0 -0
  77. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_3.ttl +0 -0
  78. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_30.ttl +0 -0
  79. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_31.ttl +0 -0
  80. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_32.ttl +0 -0
  81. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_33.ttl +0 -0
  82. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_34.ttl +0 -0
  83. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_35.ttl +0 -0
  84. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_36.ttl +0 -0
  85. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_37.ttl +0 -0
  86. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_38.ttl +0 -0
  87. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_39.ttl +0 -0
  88. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_4.ttl +0 -0
  89. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_40.ttl +0 -0
  90. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_41.ttl +0 -0
  91. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_42.ttl +0 -0
  92. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_43.ttl +0 -0
  93. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_44.ttl +0 -0
  94. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_45.ttl +0 -0
  95. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_46.ttl +0 -0
  96. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_47.ttl +0 -0
  97. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_48.ttl +0 -0
  98. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_49.ttl +0 -0
  99. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_5.ttl +0 -0
  100. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_50.ttl +0 -0
  101. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_51.ttl +0 -0
  102. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_52.ttl +0 -0
  103. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_53.ttl +0 -0
  104. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_54.ttl +0 -0
  105. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_55.ttl +0 -0
  106. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_56.ttl +0 -0
  107. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_57.ttl +0 -0
  108. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_58.ttl +0 -0
  109. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_6.ttl +0 -0
  110. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_60.ttl +0 -0
  111. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_61.ttl +0 -0
  112. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_62.ttl +0 -0
  113. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_63.ttl +0 -0
  114. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_64.ttl +0 -0
  115. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_65.ttl +0 -0
  116. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_66.ttl +0 -0
  117. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_67.ttl +0 -0
  118. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_7.ttl +0 -0
  119. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_8.ttl +0 -0
  120. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/nlp4lp_9.ttl +0 -0
  121. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/non_linear_problem_10.ttl +0 -0
  122. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/non_linear_problem_15.ttl +0 -0
  123. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/non_linear_problem_23.ttl +0 -0
  124. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/non_linear_problem_9.ttl +0 -0
  125. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/puzzles_problem_1.ttl +0 -0
  126. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/puzzles_problem_11.ttl +0 -0
  127. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/puzzles_problem_12.ttl +0 -0
  128. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/puzzles_problem_13.ttl +0 -0
  129. {text2model-1.0.0 → text2model-1.1.0}/text2model/knowledge_graphs/puzzles_problem_31.ttl +0 -0
  130. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/assembler_prompt.txt +0 -0
  131. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/code_stitching_prompt.txt +0 -0
  132. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/code_validation_prompt.txt +0 -0
  133. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/constraint_generation_prompt.txt +0 -0
  134. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/cot_prompt.txt +0 -0
  135. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/global_constraint_prompts/all_different_prompt.txt +0 -0
  136. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/global_constraint_prompts/count_prompt.txt +0 -0
  137. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/global_constraint_prompts/cumulative_prompt.txt +0 -0
  138. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/global_constraint_prompts/global_cardinality_prompt.txt +0 -0
  139. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/global_constraint_prompts/increasing_prompt.txt +0 -0
  140. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/global_constraint_prompts/lex_less_prompt.txt +0 -0
  141. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/grammar_validation_prompt.txt +0 -0
  142. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/kg_code_generation_prompt.txt +0 -0
  143. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/kg_generation_prompt.txt +0 -0
  144. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/objective_generation_prompt.txt +0 -0
  145. {text2model-1.0.0 → text2model-1.1.0}/text2model/prompts/parameter_and_variable_generation_prompt.txt +0 -0
  146. {text2model-1.0.0 → text2model-1.1.0}/text2model.egg-info/dependency_links.txt +0 -0
  147. {text2model-1.0.0 → text2model-1.1.0}/text2model.egg-info/entry_points.txt +0 -0
  148. {text2model-1.0.0 → text2model-1.1.0}/text2model.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: text2model
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: LLM Modeling Copilots for Text-to-Model Translation
5
5
  License: Apache-2.0
6
6
  Keywords: minizinc,constraint-programming,LLM,text-to-model
@@ -14,13 +14,13 @@ Requires-Dist: openai
14
14
  Requires-Dist: datasets
15
15
  Requires-Dist: tqdm
16
16
  Requires-Dist: langchain-ollama
17
- Provides-Extra: test
18
- Requires-Dist: pytest; extra == "test"
17
+ Requires-Dist: flet==0.21.2
18
+ Requires-Dist: pytest
19
19
  Dynamic: license-file
20
20
 
21
21
  [![Tests](https://github.com/skadio/text2model/actions/workflows/tests.yml/badge.svg)](https://github.com/skadio/text2model/actions/workflows/tests.yml)
22
- [![PyPI version](https://img.shields.io/pypi/v/text2model.svg)](https://pypi.org/project/text2model/)
23
- [![PyPI license](https://img.shields.io/pypi/l/text2model.svg)](https://pypi.python.org/pypi/text2model/)
22
+ [![PyPI version](https://img.shields.io/pypi/v/text2model.svg?cacheSeconds=1)](https://pypi.org/project/text2model/)
23
+ [![PyPI license](https://img.shields.io/pypi/l/text2model.svg?cacheSeconds=1)](https://pypi.python.org/pypi/text2model/)
24
24
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
25
25
  [![Downloads](https://static.pepy.tech/personalized-badge/text2model?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/text2model)
26
26
 
@@ -30,8 +30,10 @@ Dynamic: license-file
30
30
  <h3>
31
31
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#text-mode">Text Mode</a> •
32
32
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#text2zinc-mode">Text2Zinc Mode</a> •
33
+ <a href="https://github.com/skadio/text2model?tab=readme-ov-file#interactive-mode">Interactive Mode</a> •
33
34
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#copilots">Copilots</a> •
34
35
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#installation">Installation</a> •
36
+ <a href="https://github.com/skadio/text2model?tab=readme-ov-file#dataset-editor">Dataset Editor</a> •
35
37
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#evaluation">Evaluation</a> •
36
38
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#leaderboard">Leaderboard</a>
37
39
  </h3>
@@ -49,7 +51,7 @@ Please visit [Text2Model](https://skadio.github.io/text2model/) for latest publi
49
51
 
50
52
  ## Quick Start
51
53
 
52
- Text2Model supports translating given problem descriptions, **Text mode**, or specific problems from our dataset, **Text2Zinc mode**.
54
+ Text2Model supports translating given problem descriptions (**Text mode**), specific problems from our dataset (**Text2Zinc mode**), or running interactively using the [editor](https://github.com/skadio/text2model?tab=readme-ov-file#dataset-editor) (**Editor mode**).
53
55
 
54
56
  ### Text Mode
55
57
 
@@ -86,8 +88,8 @@ text2model --source nlp4lp --strategies cot --model gpt-4 --output-dir my_result
86
88
  # List all available data sources
87
89
  text2model --list-sources
88
90
 
89
- # List all available model options
90
- # --model accepts gpt-4, gpt-4o, gpt-5.2 (OpenAI, requires OPENAI_API_KEY), or phi4 (served locally through Ollama, no API key needed)
91
+ # List all available --model options (which need OPENAI_API_KEY vs. run locally through Ollama)
92
+ text2model --list-models
91
93
 
92
94
  # Advanced options
93
95
  text2model --strategies agents --model gpt-4 \
@@ -96,8 +98,22 @@ text2model --strategies agents --model gpt-4 \
96
98
  --max-tokens 8192 \
97
99
  --sleep-time 2 \
98
100
  --include-unverified
101
+
102
+ # Use a local dataset (e.g. one saved by `text2model --editor`) instead of the
103
+ # default skadio/text2zinc HuggingFace dataset
104
+ text2model --strategies cot --model gpt-4 --output-dir my_results \
105
+ --dataset-path text2zinc_edited.csv
106
+ ```
107
+
108
+ ### Interactive Mode
109
+
110
+ ```bash
111
+ text2model --editor
112
+ text2model --editor --dataset-path text2zinc_edited.csv
99
113
  ```
100
114
 
115
+ See [Dataset Editor](https://github.com/skadio/text2model?tab=readme-ov-file#dataset-editor) for details.
116
+
101
117
  ## Copilots
102
118
 
103
119
  Text2Model offers different copilot strategies, ranging from simple single-call approaches to sophisticated multi-agent systems. Each makes different trade-offs between speed and accuracy.
@@ -114,6 +130,18 @@ Text2Model offers different copilot strategies, ranging from simple single-call
114
130
  | `agents_with_code_validation` | Agents approach plus a final validation/fix step. |
115
131
  | `gala` | Global Agents for different constraint types (all_different, cumulative, etc.) plus an assembler. See the [GALA paper](https://arxiv.org/abs/2509.08970).|
116
132
 
133
+ > **Want to use `knowledge_graph` on your own problems?** It requires a pre-built `.ttl` knowledge-graph file per problem. See [`text2model/generate_knowledge_graph.py`](text2model/generate_knowledge_graph.py) and any example file under [`text2model/knowledge_graphs/`](text2model/knowledge_graphs/) (e.g. `nlp4lp_1.ttl`) and do similar — either adapt the script to your problem or hand-write a `.ttl` following the same structure.
134
+
135
+ ### Adding a Custom Copilot
136
+
137
+ Every strategy in the table above follows the same shape, so plugging in a new one is mechanical:
138
+
139
+ 1. **Add prompt(s)** under [`text2model/prompts/`](text2model/prompts/) (`.txt` files with `{problem_description}`, `{input_data}`, etc. placeholders — see any existing prompt for the pattern).
140
+ 2. **Write a `run_<name>_strategy(client, model, problem, problem_identifier, output_dir)` function** in [`text2model/main.py`](text2model/main.py). Use `utils.prepare_problem_data`, `utils.get_effective_input_data`, and `utils.load_file` to build your prompt(s), call `utils.call_api(client, model, prompt)` to get code back, and stitch/combine calls the way `run_agents_strategy` does if your copilot needs multiple LLM calls. Finish with `utils.save_solution(output_dir, problem_identifier, code)`.
141
+ 3. **Register it** by adding `'<name>': run_<name>_strategy` to `_STRATEGY_MAP` in `main.py`, and add `'<name>'` to the `--strategies` argparse `choices` list (and to the `'all'` expansion list if it should run as part of `--strategies all`).
142
+
143
+ That's it — your strategy is now available via `--strategies <name>` in both `--problem` and batch modes.
144
+
117
145
  ## Installation
118
146
 
119
147
  Text2Model requires **Python 3.8+** and can be installed from PyPI or by building from source.
@@ -136,9 +164,35 @@ cd text2model
136
164
  pip install -e .
137
165
  ```
138
166
 
167
+ ## Dataset Editor
168
+
169
+ Text2Model ships a GUI editor (built with [Flet](https://flet.dev)) for browsing and editing Text2Zinc problems (input.json, data.dzn, model.mzn, output.json), running them through MiniZinc, and chatting with an AI assistant for help rephrasing descriptions or fixing model code.
170
+
171
+ ### Launch
172
+
173
+ ```bash
174
+ text2model --editor
175
+ ```
176
+
177
+ By default the editor opens, in order: a previous editing session (`text2zinc_edited.csv` in the current directory), otherwise the dataset bundled with the package. Use the **"Load from HuggingFace"** button inside the editor to instead start from a fresh copy of `skadio/text2zinc`, or open any other local dataset with **"Open CSV..."** — or non-interactively:
178
+
179
+ ```bash
180
+ text2model --editor --dataset-path my_dataset.csv
181
+ ```
182
+
183
+ ### Save and Benchmark
184
+
185
+ - **Save** (or Ctrl+S) quick-saves your edits to `text2zinc_edited.csv` in the current directory.
186
+ - **Save As New Dataset...** exports to any path you choose. That path is a complete Text2Zinc dataset you can pass to `--dataset-path` to generate or benchmark against your edits instead of the default HuggingFace dataset:
187
+
188
+ ```bash
189
+ text2model --strategies cot --model gpt-4 --output-dir my_results --dataset-path my_dataset.csv
190
+ python evals/evaluate.py --output-dir my_results --dataset-path my_dataset.csv
191
+ ```
192
+
139
193
  ## Evaluation
140
194
 
141
- After generating models, evaluate their correctness via `evaluate.py`. This script compiles and runs each generated MiniZinc model against test instances, checking for both execution success and solution correctness.
195
+ After generating models, evaluate their correctness via [`evals/evaluate.py`](evals/evaluate.py). This script compiles and runs each generated MiniZinc model against test instances, checking for both execution success and solution correctness.
142
196
 
143
197
  #### Prerequisite
144
198
 
@@ -148,9 +202,15 @@ Install MiniZinc solver: https://www.minizinc.org/doc-2.5.5/en/installation.html
148
202
  ```bash
149
203
  # Evaluate all generated code
150
204
  # `--output-dir` is required. Point it at the directory produced by the batch-mode `text2model` run.
151
- python evaluate.py --output-dir my_results
205
+ python evals/evaluate.py --output-dir my_results
206
+
207
+ # Evaluate against a local dataset (e.g. one saved by `text2model --editor`) instead
208
+ # of the default skadio/text2zinc HuggingFace dataset
209
+ python evals/evaluate.py --output-dir my_results --dataset-path text2zinc_edited.csv
152
210
  ```
153
211
 
212
+ Running the eval generates a JSON file (`evals/evaluation_results.json` by default, via `--output-json`) with your accuracy metrics. You can PR that file to the [Text2Model Leaderboard](https://huggingface.co/spaces/skadio/text2model-leaderboard) on Hugging Face to get your results added to the online leaderboard.
213
+
154
214
  #### Metrics
155
215
 
156
216
  | Metric | Description |
@@ -169,8 +229,6 @@ Text2Model hosts an online leaderboard tracking execution accuracy, solution acc
169
229
 
170
230
  ## Testing
171
231
 
172
- Install test dependencies with `pip install -e ".[test]"`.
173
-
174
232
  **Default tests** (`tests/test_main.py`, `tests/test_utils.py`) do not need an API key, network, or MiniZinc.
175
233
  They are pure logic tests with mocked API calls and is run by the CI:
176
234
 
@@ -199,15 +257,20 @@ text2model/
199
257
  │ │ ├── global_constraint_prompts/
200
258
  │ │ └── ...
201
259
  │ ├── knowledge_graphs/ # KG files (.ttl) for knowledge_graph strategy
260
+ │ ├── editor/ # Dataset editor GUI (`text2model --editor`)
261
+ │ │ ├── app.py # Flet app: browse/edit/execute Text2Zinc problems, AI chat assistant
262
+ │ │ └── data/text2zinc.csv # Bundled default dataset the editor opens on first run
202
263
  │ ├── grammar.mzn # MiniZinc grammar for validation
203
264
  │ ├── main.py # Copilot strategies and CLI entry point
204
- └── utils.py # Shared utilities (API calls, validation)
265
+ ├── generate_knowledge_graph.py # Generates KGs for the knowledge_graph strategy
266
+ │ └── utils.py # Shared utilities (API calls, validation, dataset loading)
205
267
  ├── tests/ # Unit and integration tests (pytest)
206
- ├── output/ # Generated models (created automatically)
207
- │ ├── [model]/[strategy]/ # e.g., gpt-4/cot/problem_1.mzn
208
- └── evaluation_results/ # Accuracy metrics and leaderboard
209
- ├── evaluate.py # Evaluates generated MiniZinc models
210
- ├── generate_knowledge_graph.py # Generates KGs for knowledge_graph strategy
268
+ ├── evals/ # Evaluation tooling
269
+ │ ├── evaluate.py # Evaluates generated MiniZinc models
270
+ ├── evaluation_results.json # Latest evaluation results (PR-able to the HF leaderboard)
271
+ │ └── results/ # Accuracy metrics and leaderboard from paper runs
272
+ ├── output/ # Original outputs per strategy, kept for reproducing paper results
273
+ │ └── [model]/[strategy]/ # e.g., gpt-4/cot/problem_1.mzn
211
274
  ├── pyproject.toml # Package metadata and install config
212
275
  ├── CHANGELOG.txt # Release history
213
276
  └── LICENSE # Apache License 2.0
@@ -1,6 +1,6 @@
1
1
  [![Tests](https://github.com/skadio/text2model/actions/workflows/tests.yml/badge.svg)](https://github.com/skadio/text2model/actions/workflows/tests.yml)
2
- [![PyPI version](https://img.shields.io/pypi/v/text2model.svg)](https://pypi.org/project/text2model/)
3
- [![PyPI license](https://img.shields.io/pypi/l/text2model.svg)](https://pypi.python.org/pypi/text2model/)
2
+ [![PyPI version](https://img.shields.io/pypi/v/text2model.svg?cacheSeconds=1)](https://pypi.org/project/text2model/)
3
+ [![PyPI license](https://img.shields.io/pypi/l/text2model.svg?cacheSeconds=1)](https://pypi.python.org/pypi/text2model/)
4
4
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
5
5
  [![Downloads](https://static.pepy.tech/personalized-badge/text2model?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/text2model)
6
6
 
@@ -10,8 +10,10 @@
10
10
  <h3>
11
11
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#text-mode">Text Mode</a> •
12
12
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#text2zinc-mode">Text2Zinc Mode</a> •
13
+ <a href="https://github.com/skadio/text2model?tab=readme-ov-file#interactive-mode">Interactive Mode</a> •
13
14
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#copilots">Copilots</a> •
14
15
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#installation">Installation</a> •
16
+ <a href="https://github.com/skadio/text2model?tab=readme-ov-file#dataset-editor">Dataset Editor</a> •
15
17
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#evaluation">Evaluation</a> •
16
18
  <a href="https://github.com/skadio/text2model?tab=readme-ov-file#leaderboard">Leaderboard</a>
17
19
  </h3>
@@ -29,7 +31,7 @@ Please visit [Text2Model](https://skadio.github.io/text2model/) for latest publi
29
31
 
30
32
  ## Quick Start
31
33
 
32
- Text2Model supports translating given problem descriptions, **Text mode**, or specific problems from our dataset, **Text2Zinc mode**.
34
+ Text2Model supports translating given problem descriptions (**Text mode**), specific problems from our dataset (**Text2Zinc mode**), or running interactively using the [editor](https://github.com/skadio/text2model?tab=readme-ov-file#dataset-editor) (**Editor mode**).
33
35
 
34
36
  ### Text Mode
35
37
 
@@ -66,8 +68,8 @@ text2model --source nlp4lp --strategies cot --model gpt-4 --output-dir my_result
66
68
  # List all available data sources
67
69
  text2model --list-sources
68
70
 
69
- # List all available model options
70
- # --model accepts gpt-4, gpt-4o, gpt-5.2 (OpenAI, requires OPENAI_API_KEY), or phi4 (served locally through Ollama, no API key needed)
71
+ # List all available --model options (which need OPENAI_API_KEY vs. run locally through Ollama)
72
+ text2model --list-models
71
73
 
72
74
  # Advanced options
73
75
  text2model --strategies agents --model gpt-4 \
@@ -76,8 +78,22 @@ text2model --strategies agents --model gpt-4 \
76
78
  --max-tokens 8192 \
77
79
  --sleep-time 2 \
78
80
  --include-unverified
81
+
82
+ # Use a local dataset (e.g. one saved by `text2model --editor`) instead of the
83
+ # default skadio/text2zinc HuggingFace dataset
84
+ text2model --strategies cot --model gpt-4 --output-dir my_results \
85
+ --dataset-path text2zinc_edited.csv
86
+ ```
87
+
88
+ ### Interactive Mode
89
+
90
+ ```bash
91
+ text2model --editor
92
+ text2model --editor --dataset-path text2zinc_edited.csv
79
93
  ```
80
94
 
95
+ See [Dataset Editor](https://github.com/skadio/text2model?tab=readme-ov-file#dataset-editor) for details.
96
+
81
97
  ## Copilots
82
98
 
83
99
  Text2Model offers different copilot strategies, ranging from simple single-call approaches to sophisticated multi-agent systems. Each makes different trade-offs between speed and accuracy.
@@ -94,6 +110,18 @@ Text2Model offers different copilot strategies, ranging from simple single-call
94
110
  | `agents_with_code_validation` | Agents approach plus a final validation/fix step. |
95
111
  | `gala` | Global Agents for different constraint types (all_different, cumulative, etc.) plus an assembler. See the [GALA paper](https://arxiv.org/abs/2509.08970).|
96
112
 
113
+ > **Want to use `knowledge_graph` on your own problems?** It requires a pre-built `.ttl` knowledge-graph file per problem. See [`text2model/generate_knowledge_graph.py`](text2model/generate_knowledge_graph.py) and any example file under [`text2model/knowledge_graphs/`](text2model/knowledge_graphs/) (e.g. `nlp4lp_1.ttl`) and do similar — either adapt the script to your problem or hand-write a `.ttl` following the same structure.
114
+
115
+ ### Adding a Custom Copilot
116
+
117
+ Every strategy in the table above follows the same shape, so plugging in a new one is mechanical:
118
+
119
+ 1. **Add prompt(s)** under [`text2model/prompts/`](text2model/prompts/) (`.txt` files with `{problem_description}`, `{input_data}`, etc. placeholders — see any existing prompt for the pattern).
120
+ 2. **Write a `run_<name>_strategy(client, model, problem, problem_identifier, output_dir)` function** in [`text2model/main.py`](text2model/main.py). Use `utils.prepare_problem_data`, `utils.get_effective_input_data`, and `utils.load_file` to build your prompt(s), call `utils.call_api(client, model, prompt)` to get code back, and stitch/combine calls the way `run_agents_strategy` does if your copilot needs multiple LLM calls. Finish with `utils.save_solution(output_dir, problem_identifier, code)`.
121
+ 3. **Register it** by adding `'<name>': run_<name>_strategy` to `_STRATEGY_MAP` in `main.py`, and add `'<name>'` to the `--strategies` argparse `choices` list (and to the `'all'` expansion list if it should run as part of `--strategies all`).
122
+
123
+ That's it — your strategy is now available via `--strategies <name>` in both `--problem` and batch modes.
124
+
97
125
  ## Installation
98
126
 
99
127
  Text2Model requires **Python 3.8+** and can be installed from PyPI or by building from source.
@@ -116,9 +144,35 @@ cd text2model
116
144
  pip install -e .
117
145
  ```
118
146
 
147
+ ## Dataset Editor
148
+
149
+ Text2Model ships a GUI editor (built with [Flet](https://flet.dev)) for browsing and editing Text2Zinc problems (input.json, data.dzn, model.mzn, output.json), running them through MiniZinc, and chatting with an AI assistant for help rephrasing descriptions or fixing model code.
150
+
151
+ ### Launch
152
+
153
+ ```bash
154
+ text2model --editor
155
+ ```
156
+
157
+ By default the editor opens, in order: a previous editing session (`text2zinc_edited.csv` in the current directory), otherwise the dataset bundled with the package. Use the **"Load from HuggingFace"** button inside the editor to instead start from a fresh copy of `skadio/text2zinc`, or open any other local dataset with **"Open CSV..."** — or non-interactively:
158
+
159
+ ```bash
160
+ text2model --editor --dataset-path my_dataset.csv
161
+ ```
162
+
163
+ ### Save and Benchmark
164
+
165
+ - **Save** (or Ctrl+S) quick-saves your edits to `text2zinc_edited.csv` in the current directory.
166
+ - **Save As New Dataset...** exports to any path you choose. That path is a complete Text2Zinc dataset you can pass to `--dataset-path` to generate or benchmark against your edits instead of the default HuggingFace dataset:
167
+
168
+ ```bash
169
+ text2model --strategies cot --model gpt-4 --output-dir my_results --dataset-path my_dataset.csv
170
+ python evals/evaluate.py --output-dir my_results --dataset-path my_dataset.csv
171
+ ```
172
+
119
173
  ## Evaluation
120
174
 
121
- After generating models, evaluate their correctness via `evaluate.py`. This script compiles and runs each generated MiniZinc model against test instances, checking for both execution success and solution correctness.
175
+ After generating models, evaluate their correctness via [`evals/evaluate.py`](evals/evaluate.py). This script compiles and runs each generated MiniZinc model against test instances, checking for both execution success and solution correctness.
122
176
 
123
177
  #### Prerequisite
124
178
 
@@ -128,9 +182,15 @@ Install MiniZinc solver: https://www.minizinc.org/doc-2.5.5/en/installation.html
128
182
  ```bash
129
183
  # Evaluate all generated code
130
184
  # `--output-dir` is required. Point it at the directory produced by the batch-mode `text2model` run.
131
- python evaluate.py --output-dir my_results
185
+ python evals/evaluate.py --output-dir my_results
186
+
187
+ # Evaluate against a local dataset (e.g. one saved by `text2model --editor`) instead
188
+ # of the default skadio/text2zinc HuggingFace dataset
189
+ python evals/evaluate.py --output-dir my_results --dataset-path text2zinc_edited.csv
132
190
  ```
133
191
 
192
+ Running the eval generates a JSON file (`evals/evaluation_results.json` by default, via `--output-json`) with your accuracy metrics. You can PR that file to the [Text2Model Leaderboard](https://huggingface.co/spaces/skadio/text2model-leaderboard) on Hugging Face to get your results added to the online leaderboard.
193
+
134
194
  #### Metrics
135
195
 
136
196
  | Metric | Description |
@@ -149,8 +209,6 @@ Text2Model hosts an online leaderboard tracking execution accuracy, solution acc
149
209
 
150
210
  ## Testing
151
211
 
152
- Install test dependencies with `pip install -e ".[test]"`.
153
-
154
212
  **Default tests** (`tests/test_main.py`, `tests/test_utils.py`) do not need an API key, network, or MiniZinc.
155
213
  They are pure logic tests with mocked API calls and is run by the CI:
156
214
 
@@ -179,15 +237,20 @@ text2model/
179
237
  │ │ ├── global_constraint_prompts/
180
238
  │ │ └── ...
181
239
  │ ├── knowledge_graphs/ # KG files (.ttl) for knowledge_graph strategy
240
+ │ ├── editor/ # Dataset editor GUI (`text2model --editor`)
241
+ │ │ ├── app.py # Flet app: browse/edit/execute Text2Zinc problems, AI chat assistant
242
+ │ │ └── data/text2zinc.csv # Bundled default dataset the editor opens on first run
182
243
  │ ├── grammar.mzn # MiniZinc grammar for validation
183
244
  │ ├── main.py # Copilot strategies and CLI entry point
184
- └── utils.py # Shared utilities (API calls, validation)
245
+ ├── generate_knowledge_graph.py # Generates KGs for the knowledge_graph strategy
246
+ │ └── utils.py # Shared utilities (API calls, validation, dataset loading)
185
247
  ├── tests/ # Unit and integration tests (pytest)
186
- ├── output/ # Generated models (created automatically)
187
- │ ├── [model]/[strategy]/ # e.g., gpt-4/cot/problem_1.mzn
188
- └── evaluation_results/ # Accuracy metrics and leaderboard
189
- ├── evaluate.py # Evaluates generated MiniZinc models
190
- ├── generate_knowledge_graph.py # Generates KGs for knowledge_graph strategy
248
+ ├── evals/ # Evaluation tooling
249
+ │ ├── evaluate.py # Evaluates generated MiniZinc models
250
+ ├── evaluation_results.json # Latest evaluation results (PR-able to the HF leaderboard)
251
+ │ └── results/ # Accuracy metrics and leaderboard from paper runs
252
+ ├── output/ # Original outputs per strategy, kept for reproducing paper results
253
+ │ └── [model]/[strategy]/ # e.g., gpt-4/cot/problem_1.mzn
191
254
  ├── pyproject.toml # Package metadata and install config
192
255
  ├── CHANGELOG.txt # Release history
193
256
  └── LICENSE # Apache License 2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "text2model"
7
- version = "1.0.0"
7
+ version = "1.1.0"
8
8
  description = "LLM Modeling Copilots for Text-to-Model Translation"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -20,11 +20,10 @@ dependencies = [
20
20
  "datasets",
21
21
  "tqdm",
22
22
  "langchain-ollama",
23
+ "flet==0.21.2",
24
+ "pytest",
23
25
  ]
24
26
 
25
- [project.optional-dependencies]
26
- test = ["pytest"]
27
-
28
27
  [tool.pytest.ini_options]
29
28
  markers = [
30
29
  "integration: hits a real external dependency (OpenAI API, MiniZinc binary). Skipped automatically when the credential/binary is missing, and always excluded in CI.",
@@ -43,4 +42,5 @@ include = ["text2model*"]
43
42
  "prompts/global_constraint_prompts/*.txt",
44
43
  "grammar.mzn",
45
44
  "knowledge_graphs/*.ttl",
45
+ "editor/data/*.csv",
46
46
  ]
@@ -0,0 +1,10 @@
1
+ """Text2Zinc dataset editor (flet GUI). Launched via `text2model --editor`.
2
+
3
+ Import of this subpackage is deliberately kept out of text2model/__init__.py
4
+ and text2model/main.py's module scope, so plain `--problem`/Text2Zinc-mode
5
+ invocations don't pay the cost of importing flet at startup; it's only
6
+ imported inside the `--editor` CLI branch.
7
+ """
8
+ from text2model.editor.app import launch
9
+
10
+ __all__ = ["launch"]