iatoolkit 0.4.1__tar.gz → 0.4.2__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.
Potentially problematic release.
This version of iatoolkit might be problematic. Click here for more details.
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/PKG-INFO +1 -1
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/pyproject.toml +1 -1
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit.egg-info/PKG-INFO +1 -1
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/dispatcher_service.py +2 -2
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/document_service.py +1 -1
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/load_documents_service.py +10 -93
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/readme.md +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/requirements.txt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/setup.cfg +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/__init__.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/base_company.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/cli_commands.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/company_registry.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/iatoolkit.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/system_prompts/arquitectura.prompt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/system_prompts/format_styles.prompt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/system_prompts/query_main.prompt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit/system_prompts/sql_rules.prompt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit.egg-info/SOURCES.txt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit.egg-info/dependency_links.txt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit.egg-info/requires.txt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/iatoolkit.egg-info/top_level.txt +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/__init__.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/api_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/benchmark_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/excel_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/file_processor_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/history_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/jwt_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/mail_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/profile_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/prompt_manager_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/query_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/search_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/sql_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/tasks_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/user_feedback_service.py +0 -0
- {iatoolkit-0.4.1 → iatoolkit-0.4.2}/src/services/user_session_context_service.py +0 -0
|
@@ -109,7 +109,7 @@ class Dispatcher:
|
|
|
109
109
|
prompt_name=prompt['name'],
|
|
110
110
|
description=prompt['description'],
|
|
111
111
|
order=1,
|
|
112
|
-
is_system_prompt=True
|
|
112
|
+
is_system_prompt=True,
|
|
113
113
|
)
|
|
114
114
|
i += 1
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ class Dispatcher:
|
|
|
117
117
|
for company in self.company_instances.values():
|
|
118
118
|
company.register_company()
|
|
119
119
|
|
|
120
|
-
def dispatch(self, company_name: str, action: str, **kwargs) ->
|
|
120
|
+
def dispatch(self, company_name: str, action: str, **kwargs) -> dict:
|
|
121
121
|
company_key = company_name.lower()
|
|
122
122
|
|
|
123
123
|
if company_key not in self.company_instances:
|
|
@@ -16,7 +16,7 @@ class DocumentService:
|
|
|
16
16
|
@inject
|
|
17
17
|
def __init__(self):
|
|
18
18
|
# max number of pages to load
|
|
19
|
-
self.max_doc_pages = int(os.getenv("MAX_DOC_PAGES", "
|
|
19
|
+
self.max_doc_pages = int(os.getenv("MAX_DOC_PAGES", "200"))
|
|
20
20
|
|
|
21
21
|
def file_to_txt(self, filename, file_content):
|
|
22
22
|
try:
|
|
@@ -52,103 +52,16 @@ class LoadDocumentsService:
|
|
|
52
52
|
separators=["\n\n", "\n", "."]
|
|
53
53
|
)
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
def load_company_files(self,
|
|
56
|
+
company: Company,
|
|
57
|
+
connector_config: Dict,
|
|
58
|
+
predefined_metadata: Dict = None,
|
|
59
|
+
filters: Dict = None):
|
|
57
60
|
"""
|
|
58
|
-
|
|
59
|
-
It can load all document types or a specific one if provided.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
doc_type (str, optional): A specific document type to load.
|
|
63
|
-
If None, all configured types are loaded.
|
|
64
|
-
|
|
65
|
-
Returns:
|
|
66
|
-
Dict: A dictionary with a summary message.
|
|
67
|
-
"""
|
|
68
|
-
# doc_type: an optional document_type for loading
|
|
69
|
-
files_loaded = 0
|
|
70
|
-
companies = self.profile_repo.get_companies()
|
|
71
|
-
|
|
72
|
-
for company in companies:
|
|
73
|
-
load_config = company.parameters.get('load', {})
|
|
74
|
-
if not load_config:
|
|
75
|
-
continue
|
|
76
|
-
|
|
77
|
-
print(f"Cargando datos de ** {company.short_name} **")
|
|
78
|
-
|
|
79
|
-
# Si hay configuraciones de tipos de documento específicos
|
|
80
|
-
doc_types_config = load_config.get('document_types', {})
|
|
81
|
-
|
|
82
|
-
if doc_types_config and len(doc_types_config) > 0:
|
|
83
|
-
# Si se especificó un tipo de documento, cargar solo ese tipo
|
|
84
|
-
if doc_type and doc_type in doc_types_config:
|
|
85
|
-
files_loaded += self._load_document_type(company, doc_type, doc_types_config[doc_type])
|
|
86
|
-
# Si no se especificó, cargar todos los tipos configurados
|
|
87
|
-
elif not doc_type:
|
|
88
|
-
for type_name, type_config in doc_types_config.items():
|
|
89
|
-
files_loaded += self._load_document_type(company, type_name, type_config)
|
|
90
|
-
else:
|
|
91
|
-
# Comportamiento anterior: usar la configuración general
|
|
92
|
-
connector = load_config.get('connector', {})
|
|
93
|
-
if not connector:
|
|
94
|
-
raise IAToolkitException(IAToolkitException.ErrorType.MISSING_PARAMETER,
|
|
95
|
-
f"Falta configurar conector en empresa {company.short_name}")
|
|
96
|
-
|
|
97
|
-
files_loaded += self.load_data_source(company=company,
|
|
98
|
-
connector_config=connector)
|
|
99
|
-
|
|
100
|
-
return {'message': f'{files_loaded} files processed'}
|
|
101
|
-
|
|
102
|
-
def load_company_files(self, company: Company,
|
|
103
|
-
connector: dict,
|
|
104
|
-
predefined_metadata: Dict = None,
|
|
105
|
-
filters: Dict = None):
|
|
106
|
-
"""
|
|
107
|
-
Loads all files for a specific company using a given connector.
|
|
61
|
+
Loads all the company files from a connector
|
|
108
62
|
|
|
109
63
|
Args:
|
|
110
64
|
company (Company): The company to load files for.
|
|
111
|
-
connector (dict): The connector configuration.
|
|
112
|
-
|
|
113
|
-
Returns:
|
|
114
|
-
Dict: A dictionary with a summary message.
|
|
115
|
-
"""
|
|
116
|
-
if not connector:
|
|
117
|
-
raise IAToolkitException(IAToolkitException.ErrorType.MISSING_PARAMETER,
|
|
118
|
-
f"Falta configurar conector")
|
|
119
|
-
|
|
120
|
-
files_loaded = self.load_data_source(
|
|
121
|
-
company=company,
|
|
122
|
-
connector_config=connector,
|
|
123
|
-
predefined_metadata=predefined_metadata,
|
|
124
|
-
filters=filters)
|
|
125
|
-
|
|
126
|
-
return {'message': f'{files_loaded} files processed'}
|
|
127
|
-
|
|
128
|
-
def _load_document_type(self, company: Company, doc_type_name: str, type_config: Dict) -> int:
|
|
129
|
-
# load specific document_types for a company
|
|
130
|
-
connector = type_config.get('connector')
|
|
131
|
-
if not connector:
|
|
132
|
-
logging.warning(f"Falta configurar conector para tipo {doc_type_name} en empresa {company.short_name}")
|
|
133
|
-
raise IAToolkitException(IAToolkitException.ErrorType.MISSING_PARAMETER,
|
|
134
|
-
f"Falta configurar conector para tipo {doc_type_name} en empresa {company.short_name}")
|
|
135
|
-
|
|
136
|
-
# get the metadata for this connector
|
|
137
|
-
predefined_metadata = type_config.get('metadata', {})
|
|
138
|
-
|
|
139
|
-
# config specific filters
|
|
140
|
-
filters = type_config.get('filters', {"filename_contains": ".pdf"})
|
|
141
|
-
|
|
142
|
-
return self.load_data_source(company=company,
|
|
143
|
-
connector_config=connector,
|
|
144
|
-
predefined_metadata=predefined_metadata,
|
|
145
|
-
filters=filters)
|
|
146
|
-
|
|
147
|
-
def load_data_source(self, company: Company, connector_config: Dict, predefined_metadata: Dict = None, filters: Dict = None):
|
|
148
|
-
"""
|
|
149
|
-
Loads files from a data source using a connector and a FileProcessor.
|
|
150
|
-
|
|
151
|
-
Args:
|
|
152
65
|
connector_config (Dict): The configuration for the file connector.
|
|
153
66
|
predefined_metadata (Dict, optional): Metadata to be added to all documents from this source.
|
|
154
67
|
filters (Dict, optional): Filters to apply to the files.
|
|
@@ -156,6 +69,10 @@ class LoadDocumentsService:
|
|
|
156
69
|
Returns:
|
|
157
70
|
int: The number of processed files.
|
|
158
71
|
"""
|
|
72
|
+
if not connector_config:
|
|
73
|
+
raise IAToolkitException(IAToolkitException.ErrorType.MISSING_PARAMETER,
|
|
74
|
+
f"Falta configurar conector")
|
|
75
|
+
|
|
159
76
|
try:
|
|
160
77
|
if not filters:
|
|
161
78
|
filters = {"filename_contains": ".pdf"}
|
|
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
|