pbesa 4.0.41__tar.gz → 4.0.43__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.
- {pbesa-4.0.41 → pbesa-4.0.43}/PKG-INFO +1 -1
- pbesa-4.0.43/pbesa/celulas/celula_verificar_calculos.py +59 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/cognitive.py +36 -22
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/sel_dispatcher_team.py +4 -1
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa.egg-info/PKG-INFO +1 -1
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa.egg-info/SOURCES.txt +1 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/setup.py +1 -1
- {pbesa-4.0.41 → pbesa-4.0.43}/.gitignore +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/LICENSE +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/LICENSE.txt +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/MANIFEST +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/README.md +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/db.sqlite3 +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/__init__.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/pbesa.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/settings.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/urls.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/wsgi.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/asgi.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/pbesa.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/settings.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/urls.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/wsgi.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/manage.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/__init__.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/admin.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/apps.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/models.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/urls.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/views.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/admin.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/apps.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/controller/__pycache__/translatecontroller.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/controller/__pycache__/translatedelegate.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/controller/__pycache__/translateresponse.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/controller/translatecontroller.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/controller/translatedelegate.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/controller/translateresponse.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/worker/__pycache__/translatetask.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/worker/__pycache__/workeragent.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/worker/translatetask.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/worker/workeragent.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/migrations/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/migrations/__pycache__/__init__.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/models.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/tests.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/urls.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/views.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/__pycache__/countercontroller.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/__pycache__/counterdelegate.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/__pycache__/counterresponse.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/__pycache__/translatecontroller.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/__pycache__/translatedelegate.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/__pycache__/translateresponse.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/countercontroller.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/counterdelegate.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/controller/counterresponse.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/counteragent.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/countertask.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/translatetask.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/workeragent.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/counteragent.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/countertask.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/remote_a.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/remote_b.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/remote_c.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_casos.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_consultas.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_conversador.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_cuestionador.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_datos_identificables.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_demanda.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_evaluador.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_expertos.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_extraccion.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_generar_caso.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_generar_documento.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_instruccion.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_parafraseo.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_pertinencia.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_preguntas.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_respuesta.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/celula_saludos.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/data_extraction_cel.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/celulas/web.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/adapter.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/agent.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/io/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/io/system_file.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/io/tcp_server.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/res/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/res/__pycache__/__init__.cpython-36.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/res/__pycache__/__init__.cpython-37.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/res/__pycache__/__init__.cpython-38.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/res/__pycache__/__init__.cpython-39.pyc +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/res/conf.json +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/util.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/kernel/world.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/mas.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/models.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/remote/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/remote/adm_listener.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/remote/adm_listener_handler.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/remote/exceptions.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/remote/remote_adm.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/remote/remote_adm_handler.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/simulator/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/simulator/dialog_simulator.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/__init__.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/collaborative_team.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/delegator.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/delegator_team.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/dialog.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/dispatcher_team.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/prompts.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/selected_dispatcher_team.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/templates.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa/social/worker.py +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa.egg-info/dependency_links.txt +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa.egg-info/requires.txt +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/pbesa.egg-info/top_level.txt +0 -0
- {pbesa-4.0.41 → pbesa-4.0.43}/setup.cfg +0 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
SYSTEM_PROMPT = """
|
4
|
+
|
5
|
+
Tu única tarea es clasificar la siguiente consulta de un usuario en una de dos categorías: PERTINENTE u OTRA.
|
6
|
+
|
7
|
+
- PERTINENTE: Asigna esta etiqueta si la consulta solicita información estadística, datos agregados o cálculos que pueden extraerse de una base de datos de trámites y demandas. Busca preguntas sobre totales, promedios, porcentajes, conteos, distribuciones o tendencias a lo largo del tiempo.
|
8
|
+
|
9
|
+
- OTRA: Asigna esta etiqueta si la consulta es de cualquier otra índole. Esto incluye preguntas sobre un caso personal, cómo realizar un trámite, problemas técnicos, opiniones, o cualquier tema que no sea una solicitud de datos estadísticos del observatorio.
|
10
|
+
|
11
|
+
Regla clave para evitar la inversión: La clasificación depende de si el usuario pide datos agregados, no del tema.
|
12
|
+
|
13
|
+
- Una consulta sobre cómo poner una demanda -> OTRA.
|
14
|
+
|
15
|
+
- Una consulta sobre cuántas demandas se pusieron el mes pasado -> PERTINENTE.
|
16
|
+
|
17
|
+
Ejemplos:
|
18
|
+
|
19
|
+
- Consulta: "¿Cuál es el número total de trámites recibidos por la entidad en 2023?" -> Clasificación: PERTINENTE
|
20
|
+
|
21
|
+
- Consulta: "Necesito ayuda para radicar una demanda contra mi operador de telefonía." -> Clasificación: OTRA
|
22
|
+
|
23
|
+
- Consulta: "Dame un porcentaje de las demandas clasificadas por sector económico y por región." -> Clasificación: PERTINENTE
|
24
|
+
|
25
|
+
- Consulta: "No recuerdo mi contraseña para acceder al portal, ¿cómo la recupero?" -> Clasificación: OTRA
|
26
|
+
|
27
|
+
- Consulta: "¿Cuál es el tiempo promedio de resolución para un caso de protección al consumidor?" -> Clasificación: PERTINENTE
|
28
|
+
|
29
|
+
- Consulta: "¿Qué opina de la nueva reforma a la justicia?" -> Clasificación: OTRA
|
30
|
+
|
31
|
+
Responde únicamente con PERTINENTE u OTRA.
|
32
|
+
"""
|
33
|
+
|
34
|
+
USER_PROMPT = """
|
35
|
+
|
36
|
+
Consulta: "%s"
|
37
|
+
|
38
|
+
Clasificación:
|
39
|
+
"""
|
40
|
+
|
41
|
+
# Efectua la inferencia del modelo.
|
42
|
+
def derive(service, text, max_tkns=2000) -> any:
|
43
|
+
try:
|
44
|
+
tmp_work_memory = []
|
45
|
+
prompt = SYSTEM_PROMPT
|
46
|
+
tmp_work_memory.append({"role": "system", "content": prompt})
|
47
|
+
USER_PROMPT % text
|
48
|
+
tmp_work_memory.append({"role": "user", "content": text})
|
49
|
+
res = service.generate(tmp_work_memory, max_tokens=max_tkns)
|
50
|
+
logging.info(f"[Celula][Odj][Procesando]: {text}")
|
51
|
+
logging.info(f"[Celula][Odj][Respuesta]: {res}")
|
52
|
+
if not res or res == "":
|
53
|
+
res = text
|
54
|
+
logging.warning(f"[Celula][Odj]: No obtener una respuesta.")
|
55
|
+
return res.replace("*", "").strip()
|
56
|
+
except Exception as e:
|
57
|
+
logging.error(f"[Celula][Odj]: Error al procesar: {text}")
|
58
|
+
logging.error(e)
|
59
|
+
return None
|
@@ -29,7 +29,7 @@ from pbesa.social.dialog import (
|
|
29
29
|
from .celulas import (celula_casos, celula_consultas, celula_saludos, celula_datos_identificables,
|
30
30
|
celula_generar_documento, celula_expertos, celula_pertinencia, celula_extraccion,
|
31
31
|
celula_evaluador, celula_respuesta, celula_conversador, celula_parafraseo, celula_cuestionador,
|
32
|
-
celula_instruccion, celula_generar_caso, celula_demanda)
|
32
|
+
celula_instruccion, celula_generar_caso, celula_demanda, celula_verificar_calculos)
|
33
33
|
from pbesa.social.prompts import ANALIZER_PROMPT, CLASSIFICATION_PROMPT, DERIVE_PROMPT, RECOVERY_PROMPT, ADAPT_PROMPT, SINTETIZER_PROMPT
|
34
34
|
|
35
35
|
# --------------------------------------------------------
|
@@ -717,13 +717,13 @@ class Dialog(ABC):
|
|
717
717
|
logging.error(f"Error al enviar notificación: {text}")
|
718
718
|
logging.error(f"Error: {e}")
|
719
719
|
|
720
|
-
def update_conversation(self, session_manager,
|
721
|
-
conversation = session_manager.get_conversation(
|
720
|
+
def update_conversation(self, session_manager, conversation_id, res):
|
721
|
+
conversation = session_manager.get_conversation(conversation_id)
|
722
722
|
if conversation:
|
723
723
|
conversation['team-response'] = res
|
724
|
-
session_manager.update_conversation(
|
724
|
+
session_manager.update_conversation(conversation_id, conversation)
|
725
725
|
else:
|
726
|
-
logging.error(f"Error al actualizar la conversación: {
|
726
|
+
logging.error(f"Error al actualizar la conversación: {conversation_id}")
|
727
727
|
|
728
728
|
def team_inquiry(self, session, team, data, operation, session_flag) -> str:
|
729
729
|
try:
|
@@ -750,11 +750,11 @@ class Dialog(ABC):
|
|
750
750
|
response = canal.post(team.lower(), dto, timeout=300)
|
751
751
|
if response and not response['status']:
|
752
752
|
logging.error(f'No se pudo establecer la comunicación con el agente remoto')
|
753
|
-
self.update_conversation(session_manager, session['
|
753
|
+
self.update_conversation(session_manager, session['conversation_id'], None)
|
754
754
|
return None
|
755
755
|
logging.info(f'>>>> Response: {response}')
|
756
756
|
res = response['message']['response']
|
757
|
-
self.update_conversation(session_manager, session['
|
757
|
+
self.update_conversation(session_manager, session['conversation_id'], res)
|
758
758
|
return res
|
759
759
|
else:
|
760
760
|
if operation and not operation == "Ninguno":
|
@@ -762,7 +762,7 @@ class Dialog(ABC):
|
|
762
762
|
"data": {
|
763
763
|
'text': data,
|
764
764
|
'operation': operation,
|
765
|
-
'
|
765
|
+
'conversation_id': session['conversation_id'],
|
766
766
|
'session_id': session['session_id'],
|
767
767
|
},
|
768
768
|
}
|
@@ -776,10 +776,10 @@ class Dialog(ABC):
|
|
776
776
|
if response['status']:
|
777
777
|
logging.info(f'>>>> Response: {response}')
|
778
778
|
res = response['message']['response']
|
779
|
-
self.update_conversation(session_manager, session['
|
779
|
+
self.update_conversation(session_manager, session['conversation_id'], res)
|
780
780
|
return res
|
781
781
|
else:
|
782
|
-
self.update_conversation(session_manager, session['
|
782
|
+
self.update_conversation(session_manager, session['conversation_id'], None)
|
783
783
|
logging.error(f'No se pudo establecer la comunicación con el agente remoto')
|
784
784
|
return None
|
785
785
|
logging.info("END: team_inquiry")
|
@@ -932,6 +932,9 @@ class Dialog(ABC):
|
|
932
932
|
|
933
933
|
msg = "No puedo ayudarle con su consulta. Dado que no está relacionada con los servicios que presta Justifacil."
|
934
934
|
|
935
|
+
if es_consulta:
|
936
|
+
query = f"En el contexto jurídico. {query}"
|
937
|
+
|
935
938
|
# Verifica los casos
|
936
939
|
if eva > 0 and eva < 3:
|
937
940
|
logging.info("[Stage-1]: Discriminador encontrado")
|
@@ -942,8 +945,9 @@ class Dialog(ABC):
|
|
942
945
|
elif es_consulta and not es_saludo and not es_caso:
|
943
946
|
dicriminador = "consulta"
|
944
947
|
per_res = celula_pertinencia.derive(self.__ai_service, query, max_tkns=10)
|
948
|
+
obj_check = celula_verificar_calculos.derive(self.__ai_service, query, max_tkns=10)
|
945
949
|
if per_res and not per_res == "":
|
946
|
-
if "ABSURDO" in per_res:
|
950
|
+
if "ABSURDO" in per_res and not "PERTINENTE" in obj_check:
|
947
951
|
dicriminador = None
|
948
952
|
res = msg
|
949
953
|
elif es_caso and not es_saludo and not es_consulta:
|
@@ -1019,12 +1023,22 @@ class Dialog(ABC):
|
|
1019
1023
|
if len(messages) > 1:
|
1020
1024
|
message = messages[-2]
|
1021
1025
|
if not message['user'] and '¿Desea que le ayude con una consulta o una demanda?' in message['text']:
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1026
|
+
if 'consulta' in query:
|
1027
|
+
message = messages[-3]
|
1028
|
+
query = message['text']
|
1029
|
+
query = f"En el contexto jurídico. {query}"
|
1030
|
+
per_res = celula_pertinencia.derive(self.__ai_service, query, max_tkns=10)
|
1031
|
+
obj_check = celula_verificar_calculos.derive(self.__ai_service, query, max_tkns=10)
|
1032
|
+
if per_res and "ABSURDO" in per_res and not "PERTINENTE" in obj_check:
|
1033
|
+
return None, "No puedo ayudarle con su consulta. Dado que no está relacionada con los servicios que presta Justifacil."
|
1034
|
+
return 'consulta', query
|
1035
|
+
else:
|
1036
|
+
demanda = celula_demanda.derive(self.__ai_service, query, max_tkns=10)
|
1037
|
+
es_demanda = ("DEMANDA" in demanda) and not ("INDEFINIDO" in demanda)
|
1038
|
+
if es_demanda:
|
1039
|
+
res = self.stage_one_sintetizer(session_id, messages, attemps, query, es_demanda)
|
1040
|
+
dicriminador = "caso"
|
1041
|
+
return dicriminador, res
|
1028
1042
|
|
1029
1043
|
dicriminador, ambiguedad, res = self.stage_one_evaluate(session_id, messages, attemps, query, es_demanda)
|
1030
1044
|
|
@@ -1091,11 +1105,11 @@ class Dialog(ABC):
|
|
1091
1105
|
if owner == "Web" and dialog_state == DialogState.START:
|
1092
1106
|
logging.info(f"TOPTQ: {owner} - {dialog_state} - {team_source} - {query}")
|
1093
1107
|
session_manager = self.state['session_manager']
|
1094
|
-
conversation = session_manager.get_conversation(session['
|
1108
|
+
conversation = session_manager.get_conversation(session['conversation_id'])
|
1095
1109
|
attemps = conversation.get('attemps', 1)
|
1096
1110
|
dicriminador, res = self.stage_one_classification(session['session_id'], conversation['messages'], attemps, query)
|
1097
1111
|
conversation['attemps'] = attemps + 1
|
1098
|
-
session_manager.update_conversation(session['
|
1112
|
+
session_manager.update_conversation(session['conversation_id'], conversation)
|
1099
1113
|
logging.info(f"Discriminador: {dicriminador}")
|
1100
1114
|
# Limpia la memoria de trabajo
|
1101
1115
|
# Para que el agente la utilice en
|
@@ -1348,7 +1362,7 @@ class Dialog(ABC):
|
|
1348
1362
|
if "especialistas" in node.text.lower():
|
1349
1363
|
self.notify(session['session_id'], "consultando especialistas...")
|
1350
1364
|
session_manager = self.state['session_manager']
|
1351
|
-
conversation = session_manager.get_conversation(session['
|
1365
|
+
conversation = session_manager.get_conversation(session['conversation_id'])
|
1352
1366
|
if 'team-response' in conversation:
|
1353
1367
|
res = conversation['team-response']
|
1354
1368
|
else:
|
@@ -1391,9 +1405,9 @@ class Dialog(ABC):
|
|
1391
1405
|
if "expertos" in node.text.lower():
|
1392
1406
|
self.notify(session['session_id'], "consultando expertos...")
|
1393
1407
|
session_manager = self.state['session_manager']
|
1394
|
-
conversation = session_manager.get_conversation(session['
|
1408
|
+
conversation = session_manager.get_conversation(session['conversation_id'])
|
1395
1409
|
conversation['case'] = query
|
1396
|
-
session_manager.update_conversation(session['
|
1410
|
+
session_manager.update_conversation(session['conversation_id'], conversation)
|
1397
1411
|
logging.info("[Node]:[Action]:[Call]:[Continua]:[Consulta]: Caso almacenado")
|
1398
1412
|
else:
|
1399
1413
|
logging.info("[Node]:[Action]:[Call]:[Continua]:[Inferencia]:")
|
@@ -188,7 +188,10 @@ class SelectedDispatcher(Action):
|
|
188
188
|
try:
|
189
189
|
logging.info('Assign to agent...')
|
190
190
|
session_id = data['dto']['session']['session_id'] if 'session' in data['dto'] else None
|
191
|
-
assistant = data['dto']['session']['assistant'] if 'session' in data['dto'] and 'assistant' in data['dto']['session'] else None
|
191
|
+
#assistant = data['dto']['session']['assistant'] if 'session' in data['dto'] and 'assistant' in data['dto']['session'] else None
|
192
|
+
assistant = None
|
193
|
+
if data and 'conversation' in data and data['dto']['conversation']:
|
194
|
+
assistant = data['dto']['conversation']['assistant'] if data['dto']['conversation'] else None
|
192
195
|
if assistant:
|
193
196
|
logging.info('The session is already assigned')
|
194
197
|
logging.info(f'The agent type: {assistant} will be assigned')
|
@@ -88,6 +88,7 @@ pbesa/celulas/celula_pertinencia.py
|
|
88
88
|
pbesa/celulas/celula_preguntas.py
|
89
89
|
pbesa/celulas/celula_respuesta.py
|
90
90
|
pbesa/celulas/celula_saludos.py
|
91
|
+
pbesa/celulas/celula_verificar_calculos.py
|
91
92
|
pbesa/celulas/data_extraction_cel.py
|
92
93
|
pbesa/celulas/web.py
|
93
94
|
pbesa/kernel/__init__.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/pbesa.cpython-36.pyc
RENAMED
File without changes
|
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/urls.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/helloworld/__pycache__/wsgi.cpython-36.pyc
RENAMED
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
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/admin.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/apps.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/models.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/urls.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/__pycache__/views.cpython-36.pyc
RENAMED
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
|
File without changes
|
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/worker/translatetask.py
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/django/helloworld/translate/mas/worker/workeragent.py
RENAMED
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/counteragent.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/countertask.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/translatetask.cpython-36.pyc
RENAMED
File without changes
|
{pbesa-4.0.41 → pbesa-4.0.43}/examples/remote/mas/worker/__pycache__/workeragent.cpython-36.pyc
RENAMED
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
|
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
|
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
|
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
|
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
|
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
|
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
|
File without changes
|
File without changes
|