iatoolkit 0.4.4__py3-none-any.whl → 0.6.0__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.
Potentially problematic release.
This version of iatoolkit might be problematic. Click here for more details.
- iatoolkit/base_company.py +6 -0
- iatoolkit/cli_commands.py +1 -1
- iatoolkit/system_prompts/query_main.prompt +2 -3
- {iatoolkit-0.4.4.dist-info → iatoolkit-0.6.0.dist-info}/METADATA +1 -1
- {iatoolkit-0.4.4.dist-info → iatoolkit-0.6.0.dist-info}/RECORD +9 -9
- services/dispatcher_service.py +13 -8
- services/profile_service.py +0 -7
- {iatoolkit-0.4.4.dist-info → iatoolkit-0.6.0.dist-info}/WHEEL +0 -0
- {iatoolkit-0.4.4.dist-info → iatoolkit-0.6.0.dist-info}/top_level.txt +0 -0
iatoolkit/base_company.py
CHANGED
|
@@ -49,5 +49,11 @@ class BaseCompany(ABC):
|
|
|
49
49
|
"""
|
|
50
50
|
pass
|
|
51
51
|
|
|
52
|
+
def get_ui_component_config(self)-> dict:
|
|
53
|
+
"""
|
|
54
|
+
optional method for a company definition of it's UI config
|
|
55
|
+
"""
|
|
56
|
+
pass
|
|
57
|
+
|
|
52
58
|
def unsupported_operation(self, tag):
|
|
53
59
|
raise NotImplementedError(f"La operación '{tag}' no está soportada por esta empresa.")
|
iatoolkit/cli_commands.py
CHANGED
|
@@ -40,7 +40,7 @@ def register_core_commands(app):
|
|
|
40
40
|
click.echo("👉 Asegúrate de que el nombre de la compañía es correcto y está registrada.")
|
|
41
41
|
else:
|
|
42
42
|
click.echo("✅ ¡Configuración lista! Agrega esta variable a tu entorno:")
|
|
43
|
-
click.echo(f"IATOOLKIT_API_KEY={result['api-key']}")
|
|
43
|
+
click.echo(f"IATOOLKIT_API_KEY='{result['api-key']}'")
|
|
44
44
|
except Exception as e:
|
|
45
45
|
logging.exception(e)
|
|
46
46
|
click.echo(f"❌ Ocurrió un error inesperado durante la configuración: {e}")
|
|
@@ -28,9 +28,9 @@ El usuario que consulta se identifica como: {{ user_id }}
|
|
|
28
28
|
Eres un asistente que responde preguntas sobre empresas y sus clientes.
|
|
29
29
|
|
|
30
30
|
**Reglas obligatorias de contexto:**
|
|
31
|
-
1. Cada vez que el usuario consulte por un cliente
|
|
31
|
+
1. Cada vez que el usuario consulte por un cliente,
|
|
32
32
|
debes memorizarlo y usarlo como cliente de contexto.
|
|
33
|
-
2. Si el usuario hace una pregunta **sin especificar un cliente
|
|
33
|
+
2. Si el usuario hace una pregunta **sin especificar un cliente**,
|
|
34
34
|
siempre debes asumir que la pregunta se refiere al **último cliente identificado** en la conversación.
|
|
35
35
|
3. Nunca cambies de cliente de contexto a menos que el usuario especifique uno nuevo.
|
|
36
36
|
4. Si el usuario pregunta por un cliente que no está en tus registros, responde indicando que no tienes información, pero **no borres el contexto anterior**.
|
|
@@ -38,7 +38,6 @@ siempre debes asumir que la pregunta se refiere al **último cliente identificad
|
|
|
38
38
|
6. No debes incluir explicaciones, comentarios o texto adicional.
|
|
39
39
|
|
|
40
40
|
**IMPORTANTE:**
|
|
41
|
-
Si el usuario no menciona explícitamente nombre ni RUT en la pregunta, SIEMPRE responde usando el **último cliente** del que se obtuvo información.
|
|
42
41
|
|
|
43
42
|
No respondas nunca sobre un cliente anterior si ya se identificó uno nuevo, y nunca pierdas el contexto salvo que el usuario lo cambie explícitamente.
|
|
44
43
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
iatoolkit/__init__.py,sha256=GkFxAQHKPifz4Kd8M73Rc8TWRVIxjxkl1N0nsPvb_sU,1743
|
|
2
|
-
iatoolkit/base_company.py,sha256=
|
|
3
|
-
iatoolkit/cli_commands.py,sha256=
|
|
2
|
+
iatoolkit/base_company.py,sha256=brCO8Z6hnsE31l1S2Jfaah6K9847AB-xRn4MOPLDD4o,2089
|
|
3
|
+
iatoolkit/cli_commands.py,sha256=9zL_UEjaduxVeKXClBbFNzS9I9tKcbmOS695jy94OEY,3013
|
|
4
4
|
iatoolkit/company_registry.py,sha256=tduqt3oV8iDX_IB1eA7KIgvIxE4edTcy-3qZIXh3Lzw,2549
|
|
5
5
|
iatoolkit/iatoolkit.py,sha256=WgBm34nAeVBCpfDDZD13Pos9xIoRx5viVwxjyYCXAmY,15790
|
|
6
6
|
iatoolkit/system_prompts/format_styles.prompt,sha256=MSMe1qvR3cF_0IbFshn8R0z6Wx6VCHQq1p37rpu5wwk,3576
|
|
7
|
-
iatoolkit/system_prompts/query_main.prompt,sha256=
|
|
7
|
+
iatoolkit/system_prompts/query_main.prompt,sha256=w_9ybgWgiQH4V_RbAXqsvz0M7oOuiyhxcwf-D0CgfA4,3017
|
|
8
8
|
iatoolkit/system_prompts/sql_rules.prompt,sha256=y4nURVnb9AyFwt-lrbMNBHHtZlhk6kC9grYoOhRnrJo,59174
|
|
9
9
|
services/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
10
10
|
services/api_service.py,sha256=7FxO9_g-gxuEmYIl5PhgJb7lHVgXJ1btHdH9fDrdhvY,2840
|
|
11
11
|
services/benchmark_service.py,sha256=_ruKh9YzrTLtR0ZKrRNxqJQW0HdbwWuFz1gfLzJ9owA,5850
|
|
12
|
-
services/dispatcher_service.py,sha256=
|
|
12
|
+
services/dispatcher_service.py,sha256=0FG8tOYHgptjm_nUROe41-TdfKgV_x91Bu7fHquu5ms,14779
|
|
13
13
|
services/document_service.py,sha256=r9EPjkhkjbAdfdZ0LCmUcvQbmGZR7BWgOsBiaeSmuoU,5890
|
|
14
14
|
services/excel_service.py,sha256=ATPaeAvkLwQAkPZ3AKIUpO73RVyRg0D8c6i37_mcql0,3559
|
|
15
15
|
services/file_processor_service.py,sha256=98yWYF7nIq1nm7nh6IzMmTKaOMTIeqCFWYwXVtV-ZJI,4102
|
|
@@ -17,7 +17,7 @@ services/history_service.py,sha256=j0QCqcIIyw7DBy3GrZrEZNk0I4m-uuRoG5g0Z2RCcOE,1
|
|
|
17
17
|
services/jwt_service.py,sha256=YoZ9h7_o9xBko-arNQv4MbcwnxoSWVNj4VbZmMo_QGY,3908
|
|
18
18
|
services/load_documents_service.py,sha256=XQ_Ck1pvj6TfJRIC1cNrWRbLmC0u7E0VJkNWC6L2gI4,7027
|
|
19
19
|
services/mail_service.py,sha256=_67pctxZO46DHnWBip51ayuYtWd4bEoS1kg29ACO7_I,2162
|
|
20
|
-
services/profile_service.py,sha256=
|
|
20
|
+
services/profile_service.py,sha256=vTK9TvH_2AFdqgL3sGjhck9LyLGIbvdC2USoaRx82G8,17561
|
|
21
21
|
services/prompt_manager_service.py,sha256=wz5hhthLKt_tsj7WhsbuerXfpTCJhY4aIfjvCXREjs4,7690
|
|
22
22
|
services/query_service.py,sha256=yITLcopc1stgzTkFdrBuF84k_XYsZyoKGue1GfXsb-U,15614
|
|
23
23
|
services/search_service.py,sha256=bB3FWFxJi1iYsOdBxyu9tzIO406nQxcyeQzEowpmpjY,1803
|
|
@@ -25,7 +25,7 @@ services/sql_service.py,sha256=s84K1ADlvMtum949wgMh8jsmqlOUeL-m_SWfAM4Wsv4,2141
|
|
|
25
25
|
services/tasks_service.py,sha256=1DdbERlAxIkCpGEylnHDKC-KAsXRJugbaRSzRbPfL58,6790
|
|
26
26
|
services/user_feedback_service.py,sha256=_LeNBYz4hHFapXfYTQVfkkD34gE8j2UeKnyOZ8H0nWo,2442
|
|
27
27
|
services/user_session_context_service.py,sha256=GluNSgqP6W_hFke4oslSnfGnU_b-ph28BHH6jf3EIm0,3797
|
|
28
|
-
iatoolkit-0.
|
|
29
|
-
iatoolkit-0.
|
|
30
|
-
iatoolkit-0.
|
|
31
|
-
iatoolkit-0.
|
|
28
|
+
iatoolkit-0.6.0.dist-info/METADATA,sha256=IX_RfRTUcGQHyF-iZhIOAKn93zwl79ifaDj6J19TcHc,9300
|
|
29
|
+
iatoolkit-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
iatoolkit-0.6.0.dist-info/top_level.txt,sha256=dqlBbmgo9okD9d_WMR9uYzdup7Rxgj26yFF85jRGeu4,19
|
|
31
|
+
iatoolkit-0.6.0.dist-info/RECORD,,
|
services/dispatcher_service.py
CHANGED
|
@@ -202,7 +202,6 @@ class Dispatcher:
|
|
|
202
202
|
"id": raw_data.get("id", 0),
|
|
203
203
|
"user_email": raw_data.get("email", ""),
|
|
204
204
|
"user_fullname": raw_data.get("user_fullname", ""),
|
|
205
|
-
"super_user": raw_data.get("super_user", False),
|
|
206
205
|
"company_id": raw_data.get("company_id", 0),
|
|
207
206
|
"company_name": raw_data.get("company", ""),
|
|
208
207
|
"company_short_name": raw_data.get("company_short_name", ""),
|
|
@@ -217,6 +216,19 @@ class Dispatcher:
|
|
|
217
216
|
|
|
218
217
|
return normalized_user
|
|
219
218
|
|
|
219
|
+
def get_ui_component_config(self, company_name: str) -> dict:
|
|
220
|
+
if company_name not in self.company_instances:
|
|
221
|
+
raise IAToolkitException(IAToolkitException.ErrorType.EXTERNAL_SOURCE_ERROR,
|
|
222
|
+
f"Empresa no configurada: {company_name}")
|
|
223
|
+
|
|
224
|
+
company_instance = self.company_instances[company_name]
|
|
225
|
+
try:
|
|
226
|
+
return company_instance.get_ui_component_config()
|
|
227
|
+
except Exception as e:
|
|
228
|
+
logging.exception(e)
|
|
229
|
+
raise IAToolkitException(IAToolkitException.ErrorType.EXTERNAL_SOURCE_ERROR,
|
|
230
|
+
f"Error en get_ui_component_config de {company_name}: {str(e)}") from e
|
|
231
|
+
|
|
220
232
|
def get_metadata_from_filename(self, company_name: str, filename: str) -> dict:
|
|
221
233
|
if company_name not in self.company_instances:
|
|
222
234
|
raise IAToolkitException(IAToolkitException.ErrorType.EXTERNAL_SOURCE_ERROR,
|
|
@@ -234,13 +246,6 @@ class Dispatcher:
|
|
|
234
246
|
"""Returns the instance for a given company name."""
|
|
235
247
|
return self.company_instances.get(company_name)
|
|
236
248
|
|
|
237
|
-
def get_registered_companies(self) -> dict:
|
|
238
|
-
"""Gets all registered companies (for debugging/admin purposes)"""
|
|
239
|
-
return {
|
|
240
|
-
"registered_classes": list(self.company_registry.get_registered_companies().keys()),
|
|
241
|
-
"instantiated": list(self.company_instances.keys()),
|
|
242
|
-
"count": len(self.company_instances)
|
|
243
|
-
}
|
|
244
249
|
|
|
245
250
|
|
|
246
251
|
# iatoolkit system prompts
|
services/profile_service.py
CHANGED
|
@@ -80,7 +80,6 @@ class ProfileService:
|
|
|
80
80
|
"id": user.id,
|
|
81
81
|
"email": user.email,
|
|
82
82
|
"user_fullname": f'{user.first_name} {user.last_name}',
|
|
83
|
-
"super_user": user.super_user,
|
|
84
83
|
"company_id": company.id,
|
|
85
84
|
"company": company.name,
|
|
86
85
|
"company_short_name": company.short_name,
|
|
@@ -98,7 +97,6 @@ class ProfileService:
|
|
|
98
97
|
email: str,
|
|
99
98
|
first_name: str,
|
|
100
99
|
last_name: str,
|
|
101
|
-
rut: str,
|
|
102
100
|
password: str,
|
|
103
101
|
confirm_password: str,
|
|
104
102
|
verification_url: str) -> dict:
|
|
@@ -110,7 +108,6 @@ class ProfileService:
|
|
|
110
108
|
return {"error": f"la empresa {company_short_name} no existe"}
|
|
111
109
|
|
|
112
110
|
# normalize format's
|
|
113
|
-
rut = rut.lower().replace(" ", "")
|
|
114
111
|
email = email.lower()
|
|
115
112
|
|
|
116
113
|
# check if user exists
|
|
@@ -120,9 +117,6 @@ class ProfileService:
|
|
|
120
117
|
if not self.bcrypt.check_password_hash(existing_user.password, password):
|
|
121
118
|
return {"error": "La contraseña es incorrecta. No se puede agregar a la nueva empresa."}
|
|
122
119
|
|
|
123
|
-
if rut != existing_user.rut:
|
|
124
|
-
return {"error": "El RUT ingresado no corresponde al email existente."}
|
|
125
|
-
|
|
126
120
|
# check if register
|
|
127
121
|
if company in existing_user.companies:
|
|
128
122
|
return {"error": "Usuario ya registrado en esta empresa"}
|
|
@@ -145,7 +139,6 @@ class ProfileService:
|
|
|
145
139
|
|
|
146
140
|
# create the new user
|
|
147
141
|
new_user = User(email=email,
|
|
148
|
-
rut=rut,
|
|
149
142
|
password=hashed_password,
|
|
150
143
|
first_name=first_name.lower(),
|
|
151
144
|
last_name=last_name.lower(),
|
|
File without changes
|
|
File without changes
|