querycraft 2.5.0__tar.gz → 2.6.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 (140) hide show
  1. {querycraft-2.5.0/querycraft.egg-info → querycraft-2.6.0}/PKG-INFO +1 -1
  2. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/LLM.py +18 -4
  3. querycraft-2.6.0/querycraft/__init__.py +2 -0
  4. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/config/codemata.json +2 -2
  5. {querycraft-2.5.0 → querycraft-2.6.0/querycraft.egg-info}/PKG-INFO +1 -1
  6. querycraft-2.5.0/querycraft/__init__.py +0 -2
  7. {querycraft-2.5.0 → querycraft-2.6.0}/AUTHORS +0 -0
  8. {querycraft-2.5.0 → querycraft-2.6.0}/LICENSE +0 -0
  9. {querycraft-2.5.0 → querycraft-2.6.0}/MANIFEST.in +0 -0
  10. {querycraft-2.5.0 → querycraft-2.6.0}/README.md +0 -0
  11. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/LLM_providers.py +0 -0
  12. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/LRS.py +0 -0
  13. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/PlantUML.py +0 -0
  14. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/SQLException.py +0 -0
  15. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/cache/readme.txt +0 -0
  16. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/cachemanager.py +0 -0
  17. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/config/config-sbs-std.cfg +0 -0
  18. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/config/config-sbs.cfg +0 -0
  19. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/configmanager.py +0 -0
  20. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/cinema.db +0 -0
  21. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/cours.db +0 -0
  22. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/em.db +0 -0
  23. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/entreprise.db +0 -0
  24. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/librairie.db +0 -0
  25. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/lutins.db +0 -0
  26. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/robots.db +0 -0
  27. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/data/vols.db +0 -0
  28. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/database/MYSQL.py +0 -0
  29. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/database/PGSQL.py +0 -0
  30. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/database/SQLITE.py +0 -0
  31. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/database/__init__.py +0 -0
  32. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/database/base.py +0 -0
  33. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exceptions/OperationNotSupportedException.py +0 -0
  34. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exceptions/__init__.py +0 -0
  35. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exercicemanager.py +0 -0
  36. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exos/Didapro11.json +0 -0
  37. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exos/OENU2026.json +0 -0
  38. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exos/ex1.json +0 -0
  39. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exos/exos1.json +0 -0
  40. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/exos/readme.txt +0 -0
  41. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/logger.py +0 -0
  42. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/logs/readme.txt +0 -0
  43. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/__init__.py +0 -0
  44. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/CliOutputFactory.py +0 -0
  45. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/__init__.py +0 -0
  46. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/CliCodeBuilder.py +0 -0
  47. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/CliListBuilder.py +0 -0
  48. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/CliParagraphBuilder.py +0 -0
  49. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/CliTableBuilder.py +0 -0
  50. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/CliTextBuilder.py +0 -0
  51. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/CliTitleBuilder.py +0 -0
  52. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/cli/outputBuilder/__init__.py +0 -0
  53. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/OutputBuilder.py +0 -0
  54. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/OutputCodeFactory.py +0 -0
  55. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/OutputFactory.py +0 -0
  56. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/OutputListBuilder.py +0 -0
  57. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/OutputParagraphFactory.py +0 -0
  58. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/OutputTableBuilder.py +0 -0
  59. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/SimpleOutputBuilder.py +0 -0
  60. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/__init__.py +0 -0
  61. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/commons/utils.py +0 -0
  62. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/HtmlOutputFactory.py +0 -0
  63. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/__init__.py +0 -0
  64. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/HTMLCodeBuilder.py +0 -0
  65. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/HTMLListBuilder.py +0 -0
  66. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/HTMLParagraphBuilder.py +0 -0
  67. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/HTMLTableBuilder.py +0 -0
  68. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/HTMLTextBuilder.py +0 -0
  69. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/HTMLTitleBuilder.py +0 -0
  70. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/html/outputBuilder/__init__.py +0 -0
  71. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/MarkdownOutputFactory.py +0 -0
  72. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/__init__.py +0 -0
  73. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/MarkdownCodeBuilder.py +0 -0
  74. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/MarkdownListBuilder.py +0 -0
  75. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/MarkdownParagraphBuilder.py +0 -0
  76. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/MarkdownTableBuilder.py +0 -0
  77. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/MarkdownTextBuilder.py +0 -0
  78. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/MarkdownTitleBuilder.py +0 -0
  79. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/output/markdown/outputBuilder/__init__.py +0 -0
  80. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/paths.py +0 -0
  81. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/security.py +0 -0
  82. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sql/SQLContext.py +0 -0
  83. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sql/SQLExecutionService.py +0 -0
  84. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sql/SQLNormalizationService.py +0 -0
  85. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sql/SQLQueryService.py +0 -0
  86. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sql/SQLStepByStepService.py +0 -0
  87. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sql/__init__.py +0 -0
  88. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/sqlsbs.py +0 -0
  89. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-0973b307dafc25e2b7a5f12be0f68d1786cedbf5ad0371c3f3d5f051fc00b626.puml +0 -0
  90. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-18be2287f8920a2975f21fe98022750b27c222b85ac8d6de95a686835f147e9e.puml +0 -0
  91. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-3d819e30e542ba328af562eb160d23140f2193d92354b0897289767e1c041e96.puml +0 -0
  92. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-54c49d1ad35ea5cf736dfd64c3ed9c42ea90d7b82a5f3783f73f46de99bf0987.puml +0 -0
  93. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-5b552498722250bebfe20f44257243a9f9e08d2f3865955c60f4469ff1c12fea.puml +0 -0
  94. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-a70191192c2a1640bfec39afd281537d4ede20bb5c9e87ccb32b883e1e58bcab.puml +0 -0
  95. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-d1881606867eea2d5f0cf600fa342f8e04e8d5cc388946a09cffb855052b22ad.puml +0 -0
  96. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/static/qc-eb48d0ac9258e52c7715e6313b6da064ed9ab2efab6ba7b3225b9568a3c2545e.puml +0 -0
  97. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/admin_login.html +0 -0
  98. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/base.html +0 -0
  99. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/config.html +0 -0
  100. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/correction_prompt.md +0 -0
  101. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/credits.html +0 -0
  102. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/database_prompt.md +0 -0
  103. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/didactique.md +0 -0
  104. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/didapro11.html +0 -0
  105. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/erreur_prompt.md +0 -0
  106. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/exercices.html +0 -0
  107. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/index.html +0 -0
  108. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/instance_error.html +0 -0
  109. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/requete_prompt.md +0 -0
  110. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/systeme_prompt.md +0 -0
  111. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/systeme_prompt_factuel.md +0 -0
  112. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/systeme_prompt_valideur.md +0 -0
  113. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/templates/valideur_prompt.md +0 -0
  114. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/tenantadmin.py +0 -0
  115. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/tenantlogging.py +0 -0
  116. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/tenantregistry.py +0 -0
  117. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/tools.py +0 -0
  118. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/__init__.py +0 -0
  119. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/admin_routes.py +0 -0
  120. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/app.py +0 -0
  121. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/context.py +0 -0
  122. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/exercices_routes.py +0 -0
  123. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/helpers.py +0 -0
  124. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/pages.py +0 -0
  125. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/sql_routes.py +0 -0
  126. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web/tenancy.py +0 -0
  127. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft/web_sbs.py +0 -0
  128. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft.egg-info/SOURCES.txt +0 -0
  129. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft.egg-info/dependency_links.txt +0 -0
  130. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft.egg-info/entry_points.txt +0 -0
  131. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft.egg-info/requires.txt +0 -0
  132. {querycraft-2.5.0 → querycraft-2.6.0}/querycraft.egg-info/top_level.txt +0 -0
  133. {querycraft-2.5.0 → querycraft-2.6.0}/setup.cfg +0 -0
  134. {querycraft-2.5.0 → querycraft-2.6.0}/setup.py +0 -0
  135. {querycraft-2.5.0 → querycraft-2.6.0}/test/testAnthropic.py +0 -0
  136. {querycraft-2.5.0 → querycraft-2.6.0}/test/testLRS.py +0 -0
  137. {querycraft-2.5.0 → querycraft-2.6.0}/test/testOllama.py +0 -0
  138. {querycraft-2.5.0 → querycraft-2.6.0}/test/testParse.py +0 -0
  139. {querycraft-2.5.0 → querycraft-2.6.0}/test/test_exercicemanager.py +0 -0
  140. {querycraft-2.5.0 → querycraft-2.6.0}/test/test_litellm_provider.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: querycraft
3
- Version: 2.5.0
3
+ Version: 2.6.0
4
4
  Summary: Provide usefully SQL classes and functions to execute SQL queries step by step
5
5
  Home-page: https://gitlab.univ-nantes.fr/ls2n-didactique/querycraft
6
6
  Author: Emmanuel Desmontils
@@ -99,7 +99,8 @@ class LLMService:
99
99
  self.__logger.error(f"Error building prompt context: {e}")
100
100
  return ""
101
101
 
102
- def __call_with_cache(self, prompt: str, cache_key: str, kind: str, prompt_systeme: str = None) -> LLMResponse:
102
+ def __call_with_cache(self, prompt: str, cache_key: str, kind: str, prompt_systeme: str = None,
103
+ postprocess=None) -> LLMResponse:
103
104
  """Appelle le LLM en utilisant le cache si activé. La clé est basée sur les requêtes SQL.
104
105
 
105
106
  Args:
@@ -107,6 +108,10 @@ class LLMService:
107
108
  fonctionnalité dans son propre fichier, plutôt que de tout mélanger dans un
108
109
  cache partagé par tenant.
109
110
  prompt_systeme: Prompt système à utiliser ; par défaut le prompt système général.
111
+ postprocess: Fonction optionnelle appliquée au texte de la réponse avant sa mise
112
+ en cache (ex. validation par un second LLM). N'est appelée qu'au cache-miss :
113
+ c'est son résultat qui est caché, pas la réponse brute, pour qu'un cache-hit
114
+ renvoie directement un texte déjà post-traité sans refaire l'appel.
110
115
  """
111
116
  normalized_key = normalizeCacheKey(cache_key)
112
117
 
@@ -127,6 +132,8 @@ class LLMService:
127
132
  if response is None:
128
133
  raw = self.provider.get_response(prompt_systeme or self.prompt_systeme, prompt)
129
134
  response = self.__build_response(raw, self.provider)
135
+ if postprocess is not None:
136
+ response = (postprocess(response[0]), response[1])
130
137
  if (
131
138
  self.cache_enabled
132
139
  and cache_file is not None
@@ -197,9 +204,16 @@ class LLMService:
197
204
  # deux exercices différents peuvent partager la même requête soumise/attendue tout en
198
205
  # ayant une intention ou un commentaire de correction différents, qui font partie du
199
206
  # prompt envoyé au LLM.
200
- response: LLMResponse = self.__call_with_cache(prompt, prompt, "exo")
201
- response.response = self.validator.valider_texte(sql_attendu, sql_soumis, intention, response.response,
202
- self.typeOutput)
207
+ #
208
+ # La validation (second appel LLM, cf. LLMValideur) est passée en postprocess : elle
209
+ # n'a lieu qu'au cache-miss, et c'est son résultat qui est caché — un cache-hit renvoie
210
+ # donc directement un texte déjà validé, sans repasser par le validateur à chaque fois.
211
+ response: LLMResponse = self.__call_with_cache(
212
+ prompt, prompt, "exo",
213
+ postprocess=lambda texte: self.validator.valider_texte(
214
+ sql_attendu, sql_soumis, intention, texte, self.typeOutput
215
+ ),
216
+ )
203
217
  return self.format_ia(response, "Commentaires sur la requête", self.typeOutput)
204
218
 
205
219
  def analyseDbSchema(self, db_key: str,outputType: TypeOutput = "text") -> OutputFactory:
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = "2.6.0"
@@ -30,12 +30,12 @@
30
30
  }
31
31
  ],
32
32
  "dateCreated": "2024-07-15",
33
- "dateModified": "2026-07-24",
33
+ "dateModified": "2026-07-25",
34
34
  "datePublished": "2024-12-04",
35
35
  "description": "Ce programme permet de proposer une exécution \"pas à pas\" d'une requête SQL. Il doit être utilisé dans le cadre d'un enseignement de SQL en bases de données. Cette bibliothèque propose des classes Python permettant de manipuler des requêtes SQL. Elle propose aussi des applications pour décomposer l'exécution d'une requête SQL sur une base de données PostgreSQL, MySQL ou SQLite.",
36
36
  "downloadUrl": "https://gitlab.univ-nantes.fr/ls2n-didactique/querycraft.git",
37
37
  "license": "https://spdx.org/licenses/GPL-3.0",
38
38
  "name": "QueryCraft",
39
39
  "programmingLanguage": "Python 3",
40
- "version": "2.5.0"
40
+ "version": "2.6.0"
41
41
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: querycraft
3
- Version: 2.5.0
3
+ Version: 2.6.0
4
4
  Summary: Provide usefully SQL classes and functions to execute SQL queries step by step
5
5
  Home-page: https://gitlab.univ-nantes.fr/ls2n-didactique/querycraft
6
6
  Author: Emmanuel Desmontils
@@ -1,2 +0,0 @@
1
-
2
- __version__ = "2.5.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes