evolutia 0.1.2__py3-none-any.whl → 0.1.4__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.
@@ -1,16 +1,16 @@
1
- """
2
- Analizador de complejidad de ejercicios.
3
- Identifica tipo, pasos, conceptos y variables de ejercicios.
4
- """
5
- import re
6
- import logging
7
- from typing import Dict, List, Set, Optional, TYPE_CHECKING
8
- from collections import Counter
9
-
10
- if TYPE_CHECKING:
11
- from evolutia.cache.exercise_cache import ExerciseAnalysisCache
12
-
13
- logger = logging.getLogger(__name__)
1
+ """
2
+ Analizador de complejidad de ejercicios.
3
+ Identifica tipo, pasos, conceptos y variables de ejercicios.
4
+ """
5
+ import re
6
+ import logging
7
+ from typing import Dict, List, Set, Optional, TYPE_CHECKING
8
+ from collections import Counter
9
+
10
+ if TYPE_CHECKING:
11
+ from evolutia.cache.exercise_cache import ExerciseAnalysisCache
12
+
13
+ logger = logging.getLogger(__name__)
14
14
 
15
15
  try:
16
16
  from utils.math_extractor import (
@@ -28,19 +28,39 @@ except ImportError:
28
28
  )
29
29
 
30
30
 
31
- class ExerciseAnalyzer:
32
- """Analiza la complejidad y estructura de ejercicios."""
33
-
34
- def __init__(self, cache: Optional['ExerciseAnalysisCache'] = None):
35
- """
36
- Inicializa el analizador.
37
-
38
- Args:
39
- cache: Instancia opcional de ExerciseAnalysisCache para cachear análisis
40
- """
41
- pass
42
-
43
- self.cache = cache
31
+ class ExerciseAnalyzer:
32
+ """Analiza la complejidad y estructura de ejercicios."""
33
+
34
+ TYPE_PATTERNS = {
35
+ 'demostracion': re.compile(r'(?i)(demuestre|pruebe|verifique|muestre|justifique|demostraci[oó]n)'),
36
+ 'calculo': re.compile(r'(?i)(calcule|halle|encuentre|resuelva|eval[uú]e|calcular|obtenga|determinar)'),
37
+ 'aplicacion': re.compile(r'(?i)(aplicaci[oó]n|problema|vida real|modelo|f[íi]sic[ao]|ingenier[íi]a|econom[íi]a|contexto)')
38
+ }
39
+
40
+ STEP_KEYWORDS_PATTERN = re.compile(
41
+ r'(?i)(primero|luego|despu[ée]s|finalmente|entonces|por lo tanto|conclusi[oó]n|paso|seguidamente)',
42
+ re.MULTILINE
43
+ )
44
+
45
+ CONCEPT_PATTERNS = {
46
+ 'integrals': [r'(?i)integral', r'\\int', r'\\iint', r'\\iiint', r'\\oint'],
47
+ 'derivatives': [r'(?i)derivada', r'\\frac{d}{d', r'\\[dp]artial', r'\''],
48
+ 'limits': [r'(?i)l[íi]mite', r'\\lim'],
49
+ 'series': [r'(?i)serie', r'(?i)sucesi[oó]n', r'\\sum', r'convergencia'],
50
+ 'vectors': [r'(?i)vector', r'\\vec', r'\\mathbf', r'producto punto', r'producto cruz'],
51
+ 'matrices': [r'(?i)matriz', r'(?i)determinante', r'\\begin{pmatrix}', r'\\begin{bmatrix}', r'autovalor'],
52
+ 'coordinate_systems': [r'(?i)coordenadas', r'(?i)polares', r'(?i)esf[ée]ricas', r'(?i)cil[íi]ndricas', r'jacobian[oa]'],
53
+ 'vector_operations': [r'(?i)gradiente', r'(?i)divergencia', r'(?i)rotacional', r'\\nabla', r'teorema de stokes', r'teorema de green', r'teorema de la divergencia']
54
+ }
55
+
56
+ def __init__(self, cache: Optional['ExerciseAnalysisCache'] = None):
57
+ """
58
+ Inicializa el analizador.
59
+
60
+ Args:
61
+ cache: Instancia opcional de ExerciseAnalysisCache para cachear análisis
62
+ """
63
+ self.cache = cache
44
64
 
45
65
  def identify_exercise_type(self, content: str) -> str:
46
66
  """
@@ -135,34 +155,34 @@ class ExerciseAnalyzer:
135
155
 
136
156
  return concepts
137
157
 
138
- def analyze(self, exercise: Dict[str, Optional[str]]) -> Dict[str, Optional[str | int | float | List[str]]]:
139
- """
140
- Analiza un ejercicio completo y retorna metadatos de complejidad.
141
-
142
- Args:
143
- exercise: Diccionario con información del ejercicio
144
- - 'content': Contenido del ejercicio
145
- - 'solution': Contenido de la solución (opcional)
146
-
147
- Returns:
148
- Diccionario con análisis de complejidad
149
- """
150
- content = exercise.get('content', '')
151
- solution = exercise.get('solution', '')
152
-
153
- # Intentar caché primero
154
- if self.cache:
155
- cached_analysis = self.cache.get(exercise)
156
- if cached_analysis:
157
- logger.info(f"[ExerciseAnalyzer] Análisis obtenido del caché para exercise={exercise.get('label', 'unknown')}")
158
- return cached_analysis['analysis']
159
-
160
- # Análisis normal (cache miss)
161
- if not content:
162
- return {}
163
-
164
- # Extraer expresiones matemáticas
165
- math_expressions = extract_math_expressions(content)
158
+ def analyze(self, exercise: Dict[str, Optional[str]]) -> Dict[str, Optional[str | int | float | List[str]]]:
159
+ """
160
+ Analiza un ejercicio completo y retorna metadatos de complejidad.
161
+
162
+ Args:
163
+ exercise: Diccionario con información del ejercicio
164
+ - 'content': Contenido del ejercicio
165
+ - 'solution': Contenido de la solución (opcional)
166
+
167
+ Returns:
168
+ Diccionario con análisis de complejidad
169
+ """
170
+ content = exercise.get('content', '')
171
+ solution = exercise.get('solution', '')
172
+
173
+ # Intentar caché primero
174
+ if self.cache:
175
+ cached_analysis = self.cache.get(exercise)
176
+ if cached_analysis:
177
+ logger.info(f"[ExerciseAnalyzer] Análisis obtenido del caché para exercise={exercise.get('label', 'unknown')}")
178
+ return cached_analysis['analysis']
179
+
180
+ # Análisis normal (cache miss)
181
+ if not content:
182
+ return {}
183
+
184
+ # Extraer expresiones matemáticas
185
+ math_expressions = extract_math_expressions(content)
166
186
  if solution:
167
187
  math_expressions.extend(extract_math_expressions(solution))
168
188
 
@@ -0,0 +1,210 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Evolutia Configuration",
4
+ "description": "Configuration schema for Evolutia AI tool",
5
+ "type": "object",
6
+ "properties": {
7
+ "api": {
8
+ "type": "object",
9
+ "properties": {
10
+ "default_provider": {
11
+ "type": "string"
12
+ },
13
+ "openai": {
14
+ "$ref": "#/definitions/modelConfig"
15
+ },
16
+ "anthropic": {
17
+ "$ref": "#/definitions/modelConfig"
18
+ },
19
+ "gemini": {
20
+ "$ref": "#/definitions/modelConfig"
21
+ },
22
+ "local": {
23
+ "allOf": [
24
+ {
25
+ "$ref": "#/definitions/modelConfig"
26
+ },
27
+ {
28
+ "properties": {
29
+ "base_url": {
30
+ "type": "string"
31
+ }
32
+ }
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ "required": [
38
+ "default_provider"
39
+ ]
40
+ },
41
+ "paths": {
42
+ "type": "object",
43
+ "properties": {
44
+ "base_path": {
45
+ "type": "string"
46
+ },
47
+ "materials_directories": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ },
54
+ "required": [
55
+ "materials_directories"
56
+ ]
57
+ },
58
+ "complexity": {
59
+ "type": "object",
60
+ "properties": {
61
+ "min_complexity_increase": {
62
+ "type": "number"
63
+ },
64
+ "min_improvements": {
65
+ "type": "integer"
66
+ },
67
+ "weights": {
68
+ "type": "object",
69
+ "patternProperties": {
70
+ "^.*$": {
71
+ "type": "number"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ },
77
+ "exam": {
78
+ "type": "object",
79
+ "properties": {
80
+ "default": {
81
+ "type": "object",
82
+ "properties": {
83
+ "subject": {
84
+ "type": "string"
85
+ },
86
+ "points_per_exercise": {
87
+ "type": "integer"
88
+ },
89
+ "duration_hours": {
90
+ "type": "number"
91
+ }
92
+ }
93
+ },
94
+ "keywords": {
95
+ "type": "object",
96
+ "patternProperties": {
97
+ "^.*$": {
98
+ "type": "array",
99
+ "items": {
100
+ "type": "string"
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ },
107
+ "logging": {
108
+ "type": "object",
109
+ "properties": {
110
+ "level": {
111
+ "type": "string"
112
+ },
113
+ "format": {
114
+ "type": "string"
115
+ }
116
+ }
117
+ },
118
+ "rag": {
119
+ "type": "object",
120
+ "properties": {
121
+ "vector_store": {
122
+ "type": "object",
123
+ "properties": {
124
+ "type": {
125
+ "type": "string"
126
+ },
127
+ "persist_directory": {
128
+ "type": "string"
129
+ },
130
+ "collection_name": {
131
+ "type": "string"
132
+ }
133
+ },
134
+ "required": [
135
+ "type"
136
+ ]
137
+ },
138
+ "embeddings": {
139
+ "type": "object",
140
+ "properties": {
141
+ "provider": {
142
+ "type": "string"
143
+ },
144
+ "model": {
145
+ "type": "string"
146
+ },
147
+ "batch_size": {
148
+ "type": "integer"
149
+ }
150
+ },
151
+ "required": [
152
+ "provider",
153
+ "model"
154
+ ]
155
+ },
156
+ "retrieval": {
157
+ "type": "object",
158
+ "properties": {
159
+ "top_k": {
160
+ "type": "integer"
161
+ },
162
+ "similarity_threshold": {
163
+ "type": "number"
164
+ },
165
+ "use_metadata_filters": {
166
+ "type": "boolean"
167
+ }
168
+ }
169
+ },
170
+ "chunking": {
171
+ "type": "object",
172
+ "properties": {
173
+ "chunk_size": {
174
+ "type": "integer"
175
+ },
176
+ "chunk_overlap": {
177
+ "type": "integer"
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ },
184
+ "required": [
185
+ "api",
186
+ "paths"
187
+ ],
188
+ "definitions": {
189
+ "modelConfig": {
190
+ "type": "object",
191
+ "properties": {
192
+ "model": {
193
+ "type": "string"
194
+ },
195
+ "temperature": {
196
+ "type": "number"
197
+ },
198
+ "max_tokens": {
199
+ "type": "integer"
200
+ },
201
+ "api_key": {
202
+ "type": "string"
203
+ }
204
+ },
205
+ "required": [
206
+ "model"
207
+ ]
208
+ }
209
+ }
210
+ }
@@ -1 +1,2 @@
1
- # Tests package for EvolutIA validation
1
+ from .config_validator import ConfigValidator, ConfigValidationError
2
+ from .args_validator import ArgsValidator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolutia
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Sistema automatizado para generar preguntas de examen desafiantes basadas en materiales didácticos existentes
5
5
  Home-page: https://github.com/glacy/evolutIA
6
6
  Author: Gerardo Lacy-Mora
@@ -6,7 +6,7 @@ evolutia/config_manager.py,sha256=Cf_MQzUq-g5rQuJN_csKt9gJSwPJ6kYg-Dw8uYp1um0,91
6
6
  evolutia/evolutia_engine.py,sha256=PDpXPydffrQfT_VUX4BYyW2jqKFIUbO0QVQARk76Yp8,22351
7
7
  evolutia/exam_generator.py,sha256=7CKdo86u8bC6yYJY7I3WITcyV_4L8lMRETngGYf2WbU,13837
8
8
  evolutia/exceptions.py,sha256=A1xnYmPlySYEeTHR12ct7Apet2n6JhGugjOYX4mmobw,779
9
- evolutia/exercise_analyzer.py,sha256=kGcjajxF2AynCTOuxQOweVa5Y3JqFTzyv8ZFDkzS-ts,7200
9
+ evolutia/exercise_analyzer.py,sha256=bY4c-hqeef_xrDTVC9X4MzZlglrhNejWtwEgI_NJ-Mw,8666
10
10
  evolutia/imports.py,sha256=CTsHJ5FukEKMh5GM_O9EsoH61F6xMGj_A3gV0H869Hc,5914
11
11
  evolutia/llm_providers.py,sha256=TMOVWv9kZcj5Ydp_nBvaJaEohjPdhHPmFPa-VHC2yJA,14955
12
12
  evolutia/material_extractor.py,sha256=CQGgCS9sRBNIhKeR2ya4V7TYBz47yWcEQdjpGEduZRY,12429
@@ -22,16 +22,17 @@ evolutia/rag/enhanced_variation_generator.py,sha256=hFA60OW6-02d8HqluiDTgh7Apwkj
22
22
  evolutia/rag/rag_indexer.py,sha256=Rg-PtvEJXW5IGo-nLh3h1TT51YXnbz9mwoifUTwUiZM,16732
23
23
  evolutia/rag/rag_manager.py,sha256=ODfOiREv8OyQ7WfCdIOPmynJ6grckN6uLYjuECrt3LU,8071
24
24
  evolutia/rag/rag_retriever.py,sha256=It8gB-dL0Ip2r2zCD5Oq_Hmc-C8fbCyrCLaNOghqhLw,14370
25
+ evolutia/schemas/config.schema.json,sha256=GzQxWpJeog5BMYlkEFkzzwk3UNVX0ndDyKRh6tvOafs,6481
25
26
  evolutia/utils/__init__.py,sha256=rD3hl92fM5L3_7QCRrCjyR91bx_bOsw0baVQrCjy6vg,56
26
27
  evolutia/utils/json_parser.py,sha256=71yA15bYCGkZ7pAhLoqoGuKTrFyAsjWDNEgG7rhsloo,3308
27
28
  evolutia/utils/markdown_parser.py,sha256=LjMFMuq4liXaRVXBd6FsH1ZlfiFlO8Hryg-CNAgaYYk,5743
28
29
  evolutia/utils/math_extractor.py,sha256=tKfzwnmj8Puw9w624bBAnRjgxr3my-O3a9UcIyi8XTk,5125
29
- evolutia/validation/__init__.py,sha256=q56nc4RekrPSuOAxJdogBMZHik8Lj69V2SyLD5DfRqg,40
30
+ evolutia/validation/__init__.py,sha256=TxFTXvjfbDaD26gIDy3XE7SEGdzwMV-aocX-OMs_wxE,111
30
31
  evolutia/validation/args_validator.py,sha256=lhlQ5_swUBYTO_7MXUgTgtwd_JLCCEjvh4YxM7KbtkE,10051
31
32
  evolutia/validation/config_validator.py,sha256=ATTI0--zZIG85WzASU59M2nW-nZbNSxWOe82QJ1vIMQ,20968
32
- evolutia-0.1.2.dist-info/licenses/LICENSE,sha256=jyOI5zt59oNBGE33KX2L1py7ZwWKqVFNcgEePR6o6YA,11564
33
- evolutia-0.1.2.dist-info/METADATA,sha256=iKHGOtSDC78nhpMcoGsnVJhnL8k6jxRtvujpAJHpfnA,16955
34
- evolutia-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
- evolutia-0.1.2.dist-info/entry_points.txt,sha256=BMYhya9XcbrfsjGfp4lMVQF0TK3Bd_Kj6mZtFhVJ7zo,47
36
- evolutia-0.1.2.dist-info/top_level.txt,sha256=GrIvEW8qAI8CIW5XTPnCqC7o06qJIL8p9CGwVhCEC4s,22
37
- evolutia-0.1.2.dist-info/RECORD,,
33
+ evolutia-0.1.4.dist-info/licenses/LICENSE,sha256=jyOI5zt59oNBGE33KX2L1py7ZwWKqVFNcgEePR6o6YA,11564
34
+ evolutia-0.1.4.dist-info/METADATA,sha256=jgg9w2XMu1Q3bCzIClKhjStV-zZxxsacJ7fljN2oN-4,16955
35
+ evolutia-0.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
36
+ evolutia-0.1.4.dist-info/entry_points.txt,sha256=BMYhya9XcbrfsjGfp4lMVQF0TK3Bd_Kj6mZtFhVJ7zo,47
37
+ evolutia-0.1.4.dist-info/top_level.txt,sha256=GrIvEW8qAI8CIW5XTPnCqC7o06qJIL8p9CGwVhCEC4s,22
38
+ evolutia-0.1.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5