iatoolkit 0.3.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.

Files changed (32) hide show
  1. iatoolkit-0.3.2/PKG-INFO +208 -0
  2. iatoolkit-0.3.2/pyproject.toml +25 -0
  3. iatoolkit-0.3.2/requirements.txt +200 -0
  4. iatoolkit-0.3.2/setup.cfg +4 -0
  5. iatoolkit-0.3.2/src/iatoolkit/__init__.py +41 -0
  6. iatoolkit-0.3.2/src/iatoolkit/base_company.py +42 -0
  7. iatoolkit-0.3.2/src/iatoolkit/company_registry.py +98 -0
  8. iatoolkit-0.3.2/src/iatoolkit/iatoolkit.py +405 -0
  9. iatoolkit-0.3.2/src/iatoolkit.egg-info/PKG-INFO +208 -0
  10. iatoolkit-0.3.2/src/iatoolkit.egg-info/SOURCES.txt +30 -0
  11. iatoolkit-0.3.2/src/iatoolkit.egg-info/dependency_links.txt +1 -0
  12. iatoolkit-0.3.2/src/iatoolkit.egg-info/requires.txt +200 -0
  13. iatoolkit-0.3.2/src/iatoolkit.egg-info/top_level.txt +2 -0
  14. iatoolkit-0.3.2/src/services/__init__.py +5 -0
  15. iatoolkit-0.3.2/src/services/api_service.py +30 -0
  16. iatoolkit-0.3.2/src/services/benchmark_service.py +139 -0
  17. iatoolkit-0.3.2/src/services/dispatcher_service.py +312 -0
  18. iatoolkit-0.3.2/src/services/document_service.py +159 -0
  19. iatoolkit-0.3.2/src/services/excel_service.py +98 -0
  20. iatoolkit-0.3.2/src/services/file_processor_service.py +92 -0
  21. iatoolkit-0.3.2/src/services/history_service.py +45 -0
  22. iatoolkit-0.3.2/src/services/jwt_service.py +91 -0
  23. iatoolkit-0.3.2/src/services/load_documents_service.py +212 -0
  24. iatoolkit-0.3.2/src/services/mail_service.py +62 -0
  25. iatoolkit-0.3.2/src/services/profile_service.py +376 -0
  26. iatoolkit-0.3.2/src/services/prompt_manager_service.py +180 -0
  27. iatoolkit-0.3.2/src/services/query_service.py +332 -0
  28. iatoolkit-0.3.2/src/services/search_service.py +32 -0
  29. iatoolkit-0.3.2/src/services/sql_service.py +42 -0
  30. iatoolkit-0.3.2/src/services/tasks_service.py +188 -0
  31. iatoolkit-0.3.2/src/services/user_feedback_service.py +67 -0
  32. iatoolkit-0.3.2/src/services/user_session_context_service.py +85 -0
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: iatoolkit
3
+ Version: 0.3.2
4
+ Summary: IAToolkit
5
+ Author: Fernando Libedinsky
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: aiohappyeyeballs==2.4.4
10
+ Requires-Dist: aiohttp==3.11.9
11
+ Requires-Dist: aiosignal==1.3.1
12
+ Requires-Dist: annotated-types==0.7.0
13
+ Requires-Dist: anyio==4.6.2.post1
14
+ Requires-Dist: asgiref==3.8.1
15
+ Requires-Dist: async-timeout==4.0.3
16
+ Requires-Dist: attrs==24.3.0
17
+ Requires-Dist: backoff==2.2.1
18
+ Requires-Dist: bcrypt==4.2.1
19
+ Requires-Dist: beautifulsoup4==4.12.3
20
+ Requires-Dist: blinker==1.9.0
21
+ Requires-Dist: boto3==1.36.22
22
+ Requires-Dist: botocore==1.36.22
23
+ Requires-Dist: build==1.2.2.post1
24
+ Requires-Dist: cachelib==0.13.0
25
+ Requires-Dist: cachetools==5.5.0
26
+ Requires-Dist: certifi==2024.12.14
27
+ Requires-Dist: cffi==1.17.1
28
+ Requires-Dist: charset-normalizer==3.4.0
29
+ Requires-Dist: click==8.1.8
30
+ Requires-Dist: coloredlogs==15.0.1
31
+ Requires-Dist: contourpy==1.3.3
32
+ Requires-Dist: coverage==7.6.10
33
+ Requires-Dist: cryptography==44.0.3
34
+ Requires-Dist: cycler==0.12.1
35
+ Requires-Dist: dataclasses-json==0.6.7
36
+ Requires-Dist: Deprecated==1.2.15
37
+ Requires-Dist: distro==1.9.0
38
+ Requires-Dist: durationpy==0.9
39
+ Requires-Dist: ecs-logging==2.2.0
40
+ Requires-Dist: elastic-apm==6.23.0
41
+ Requires-Dist: et_xmlfile==2.0.0
42
+ Requires-Dist: exceptiongroup==1.2.2
43
+ Requires-Dist: fastapi==0.115.6
44
+ Requires-Dist: filelock==3.16.1
45
+ Requires-Dist: Flask==3.1.0
46
+ Requires-Dist: Flask-Bcrypt==1.0.1
47
+ Requires-Dist: flask-cors==6.0.0
48
+ Requires-Dist: Flask-Injector==0.15.0
49
+ Requires-Dist: Flask-Session==0.8.0
50
+ Requires-Dist: flatbuffers==24.3.25
51
+ Requires-Dist: fonttools==4.59.2
52
+ Requires-Dist: frozenlist==1.5.0
53
+ Requires-Dist: fsspec==2024.10.0
54
+ Requires-Dist: google-ai-generativelanguage==0.6.15
55
+ Requires-Dist: google-api-core==2.24.1
56
+ Requires-Dist: google-api-python-client==2.161.0
57
+ Requires-Dist: google-auth==2.37.0
58
+ Requires-Dist: google-auth-httplib2==0.2.0
59
+ Requires-Dist: google-auth-oauthlib==1.2.1
60
+ Requires-Dist: google-cloud-core==2.4.1
61
+ Requires-Dist: google-cloud-storage==3.0.0
62
+ Requires-Dist: google-crc32c==1.6.0
63
+ Requires-Dist: google-generativeai==0.8.5
64
+ Requires-Dist: google-resumable-media==2.7.2
65
+ Requires-Dist: googleapis-common-protos==1.66.0
66
+ Requires-Dist: grpcio==1.74.0
67
+ Requires-Dist: grpcio-status==1.71.2
68
+ Requires-Dist: gunicorn==23.0.0
69
+ Requires-Dist: h11==0.14.0
70
+ Requires-Dist: httpcore==1.0.7
71
+ Requires-Dist: httplib2==0.22.0
72
+ Requires-Dist: httptools==0.6.4
73
+ Requires-Dist: httpx==0.28.0
74
+ Requires-Dist: httpx-sse==0.4.0
75
+ Requires-Dist: huggingface-hub==0.31.4
76
+ Requires-Dist: humanfriendly==10.0
77
+ Requires-Dist: idna==3.10
78
+ Requires-Dist: importlib_metadata==8.5.0
79
+ Requires-Dist: importlib_resources==6.4.5
80
+ Requires-Dist: iniconfig==2.0.0
81
+ Requires-Dist: injector==0.22.0
82
+ Requires-Dist: itsdangerous==2.2.0
83
+ Requires-Dist: Jinja2==3.1.5
84
+ Requires-Dist: jiter==0.8.0
85
+ Requires-Dist: jmespath==1.0.1
86
+ Requires-Dist: joblib==1.4.2
87
+ Requires-Dist: jsonpatch==1.33
88
+ Requires-Dist: jsonpointer==3.0.0
89
+ Requires-Dist: kiwisolver==1.4.9
90
+ Requires-Dist: kubernetes==31.0.0
91
+ Requires-Dist: langchain==0.3.19
92
+ Requires-Dist: langchain-core==0.3.35
93
+ Requires-Dist: langchain-text-splitters==0.3.6
94
+ Requires-Dist: langsmith==0.3.8
95
+ Requires-Dist: lxml==5.3.0
96
+ Requires-Dist: markdown-it-py==3.0.0
97
+ Requires-Dist: markdown2==2.5.3
98
+ Requires-Dist: MarkupSafe==3.0.2
99
+ Requires-Dist: marshmallow==3.23.1
100
+ Requires-Dist: matplotlib==3.10.6
101
+ Requires-Dist: mdurl==0.1.2
102
+ Requires-Dist: mmh3==5.0.1
103
+ Requires-Dist: monotonic==1.6
104
+ Requires-Dist: mpmath==1.3.0
105
+ Requires-Dist: msgspec==0.19.0
106
+ Requires-Dist: multidict==6.1.0
107
+ Requires-Dist: mypy-extensions==1.0.0
108
+ Requires-Dist: narwhals==2.3.0
109
+ Requires-Dist: networkx==3.4.2
110
+ Requires-Dist: numpy==2.2.3
111
+ Requires-Dist: oauth2client==4.1.3
112
+ Requires-Dist: oauthlib==3.2.2
113
+ Requires-Dist: onnxruntime==1.19.2
114
+ Requires-Dist: openai==1.79.0
115
+ Requires-Dist: openpyxl==3.1.5
116
+ Requires-Dist: opentelemetry-api==1.28.2
117
+ Requires-Dist: opentelemetry-exporter-otlp-proto-common==1.28.2
118
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc==1.28.2
119
+ Requires-Dist: opentelemetry-instrumentation==0.49b2
120
+ Requires-Dist: opentelemetry-instrumentation-asgi==0.49b2
121
+ Requires-Dist: opentelemetry-instrumentation-fastapi==0.49b2
122
+ Requires-Dist: opentelemetry-proto==1.28.2
123
+ Requires-Dist: opentelemetry-sdk==1.28.2
124
+ Requires-Dist: opentelemetry-semantic-conventions==0.49b2
125
+ Requires-Dist: opentelemetry-util-http==0.49b2
126
+ Requires-Dist: orjson==3.10.12
127
+ Requires-Dist: overrides==7.7.0
128
+ Requires-Dist: packaging==24.2
129
+ Requires-Dist: pandas==2.3.1
130
+ Requires-Dist: pgvector==0.3.6
131
+ Requires-Dist: pillow==11.0.0
132
+ Requires-Dist: plotly==6.3.0
133
+ Requires-Dist: pluggy==1.5.0
134
+ Requires-Dist: posthog==3.7.4
135
+ Requires-Dist: propcache==0.2.1
136
+ Requires-Dist: proto-plus==1.26.0
137
+ Requires-Dist: protobuf==5.29.1
138
+ Requires-Dist: psutil==7.0.0
139
+ Requires-Dist: psycopg2-binary==2.9.10
140
+ Requires-Dist: pyarrow==21.0.0
141
+ Requires-Dist: pyasn1==0.6.1
142
+ Requires-Dist: pyasn1_modules==0.4.1
143
+ Requires-Dist: pycparser==2.22
144
+ Requires-Dist: pydantic==2.10.2
145
+ Requires-Dist: pydantic-settings==2.6.1
146
+ Requires-Dist: pydantic_core==2.27.1
147
+ Requires-Dist: PyDrive==1.3.1
148
+ Requires-Dist: Pygments==2.18.0
149
+ Requires-Dist: PyJWT==2.10.1
150
+ Requires-Dist: PyMuPDF==1.25.0
151
+ Requires-Dist: pyparsing==3.2.1
152
+ Requires-Dist: pypdf==5.1.0
153
+ Requires-Dist: PyPika==0.48.9
154
+ Requires-Dist: pyproject_hooks==1.2.0
155
+ Requires-Dist: pytesseract==0.3.13
156
+ Requires-Dist: pytest==8.3.4
157
+ Requires-Dist: pytest-cov==5.0.0
158
+ Requires-Dist: pytest-mock==3.14.0
159
+ Requires-Dist: python-dateutil==2.9.0.post0
160
+ Requires-Dist: python-docx==1.1.2
161
+ Requires-Dist: python-dotenv==1.0.1
162
+ Requires-Dist: pytz==2025.2
163
+ Requires-Dist: PyYAML==6.0.2
164
+ Requires-Dist: redis==5.2.1
165
+ Requires-Dist: regex==2024.11.6
166
+ Requires-Dist: requests==2.32.3
167
+ Requires-Dist: requests-oauthlib==2.0.0
168
+ Requires-Dist: requests-toolbelt==1.0.0
169
+ Requires-Dist: rich==13.9.4
170
+ Requires-Dist: rsa==4.9
171
+ Requires-Dist: s3transfer==0.11.2
172
+ Requires-Dist: safetensors==0.5.2
173
+ Requires-Dist: scikit-learn==1.7.1
174
+ Requires-Dist: scipy==1.15.1
175
+ Requires-Dist: seaborn==0.13.2
176
+ Requires-Dist: setuptools==75.8.0
177
+ Requires-Dist: shellingham==1.5.4
178
+ Requires-Dist: sib-api-v3-sdk==7.6.0
179
+ Requires-Dist: six==1.17.0
180
+ Requires-Dist: sniffio==1.3.1
181
+ Requires-Dist: soupsieve==2.6
182
+ Requires-Dist: SQLAlchemy==2.0.36
183
+ Requires-Dist: starlette==0.41.3
184
+ Requires-Dist: sympy==1.13.1
185
+ Requires-Dist: tenacity==9.0.0
186
+ Requires-Dist: threadpoolctl==3.5.0
187
+ Requires-Dist: tiktoken==0.8.0
188
+ Requires-Dist: tokenizers==0.21.0
189
+ Requires-Dist: tomli==2.2.1
190
+ Requires-Dist: tqdm==4.67.1
191
+ Requires-Dist: typer==0.15.1
192
+ Requires-Dist: typing-inspect==0.9.0
193
+ Requires-Dist: typing_extensions==4.12.2
194
+ Requires-Dist: tzdata==2025.2
195
+ Requires-Dist: uritemplate==4.1.1
196
+ Requires-Dist: urllib3==2.3.0
197
+ Requires-Dist: uvicorn==0.32.1
198
+ Requires-Dist: uvloop==0.21.0
199
+ Requires-Dist: watchfiles==1.0.0
200
+ Requires-Dist: websocket-client==1.8.0
201
+ Requires-Dist: websockets==14.1
202
+ Requires-Dist: Werkzeug==3.1.3
203
+ Requires-Dist: whitenoise==6.8.2
204
+ Requires-Dist: wikipedia==1.4.0
205
+ Requires-Dist: wrapt==1.17.0
206
+ Requires-Dist: yarl==1.18.3
207
+ Requires-Dist: zipp==3.21.0
208
+ Requires-Dist: zstandard==0.23.0
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel", "build"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iatoolkit"
7
+ version = "0.3.2"
8
+ requires-python = ">=3.10"
9
+ description = "IAToolkit"
10
+ readme = "README.md"
11
+ license = "MIT"
12
+ authors = [{ name = "Fernando Libedinsky" }]
13
+
14
+ # Si quieres seguir leyendo deps de requirements.txt:
15
+ dynamic = ["dependencies"]
16
+
17
+ [tool.setuptools]
18
+ package-dir = {"" = "src"}
19
+
20
+ [tool.setuptools.packages.find]
21
+ where = ["src"]
22
+ include = ["iatoolkit*", "services*"]
23
+
24
+ [tool.setuptools.dynamic]
25
+ dependencies = { file = ["requirements.txt"] }
@@ -0,0 +1,200 @@
1
+ aiohappyeyeballs==2.4.4
2
+ aiohttp==3.11.9
3
+ aiosignal==1.3.1
4
+ annotated-types==0.7.0
5
+ anyio==4.6.2.post1
6
+ asgiref==3.8.1
7
+ async-timeout==4.0.3
8
+ attrs==24.3.0
9
+ backoff==2.2.1
10
+ bcrypt==4.2.1
11
+ beautifulsoup4==4.12.3
12
+ blinker==1.9.0
13
+ boto3==1.36.22
14
+ botocore==1.36.22
15
+ build==1.2.2.post1
16
+ cachelib==0.13.0
17
+ cachetools==5.5.0
18
+ certifi==2024.12.14
19
+ cffi==1.17.1
20
+ charset-normalizer==3.4.0
21
+ click==8.1.8
22
+ coloredlogs==15.0.1
23
+ contourpy==1.3.3
24
+ coverage==7.6.10
25
+ cryptography==44.0.3
26
+ cycler==0.12.1
27
+ dataclasses-json==0.6.7
28
+ Deprecated==1.2.15
29
+ distro==1.9.0
30
+ durationpy==0.9
31
+ ecs-logging==2.2.0
32
+ elastic-apm==6.23.0
33
+ et_xmlfile==2.0.0
34
+ exceptiongroup==1.2.2
35
+ fastapi==0.115.6
36
+ filelock==3.16.1
37
+ Flask==3.1.0
38
+ Flask-Bcrypt==1.0.1
39
+ flask-cors==6.0.0
40
+ Flask-Injector==0.15.0
41
+ Flask-Session==0.8.0
42
+ flatbuffers==24.3.25
43
+ fonttools==4.59.2
44
+ frozenlist==1.5.0
45
+ fsspec==2024.10.0
46
+ google-ai-generativelanguage==0.6.15
47
+ google-api-core==2.24.1
48
+ google-api-python-client==2.161.0
49
+ google-auth==2.37.0
50
+ google-auth-httplib2==0.2.0
51
+ google-auth-oauthlib==1.2.1
52
+ google-cloud-core==2.4.1
53
+ google-cloud-storage==3.0.0
54
+ google-crc32c==1.6.0
55
+ google-generativeai==0.8.5
56
+ google-resumable-media==2.7.2
57
+ googleapis-common-protos==1.66.0
58
+ grpcio==1.74.0
59
+ grpcio-status==1.71.2
60
+ gunicorn==23.0.0
61
+ h11==0.14.0
62
+ httpcore==1.0.7
63
+ httplib2==0.22.0
64
+ httptools==0.6.4
65
+ httpx==0.28.0
66
+ httpx-sse==0.4.0
67
+ huggingface-hub==0.31.4
68
+ humanfriendly==10.0
69
+ idna==3.10
70
+ importlib_metadata==8.5.0
71
+ importlib_resources==6.4.5
72
+ iniconfig==2.0.0
73
+ injector==0.22.0
74
+ itsdangerous==2.2.0
75
+ Jinja2==3.1.5
76
+ jiter==0.8.0
77
+ jmespath==1.0.1
78
+ joblib==1.4.2
79
+ jsonpatch==1.33
80
+ jsonpointer==3.0.0
81
+ kiwisolver==1.4.9
82
+ kubernetes==31.0.0
83
+ langchain==0.3.19
84
+ langchain-core==0.3.35
85
+ langchain-text-splitters==0.3.6
86
+ langsmith==0.3.8
87
+ lxml==5.3.0
88
+ markdown-it-py==3.0.0
89
+ markdown2==2.5.3
90
+ MarkupSafe==3.0.2
91
+ marshmallow==3.23.1
92
+ matplotlib==3.10.6
93
+ mdurl==0.1.2
94
+ mmh3==5.0.1
95
+ monotonic==1.6
96
+ mpmath==1.3.0
97
+ msgspec==0.19.0
98
+ multidict==6.1.0
99
+ mypy-extensions==1.0.0
100
+ narwhals==2.3.0
101
+ networkx==3.4.2
102
+ numpy==2.2.3
103
+ oauth2client==4.1.3
104
+ oauthlib==3.2.2
105
+ onnxruntime==1.19.2
106
+ openai==1.79.0
107
+ openpyxl==3.1.5
108
+ opentelemetry-api==1.28.2
109
+ opentelemetry-exporter-otlp-proto-common==1.28.2
110
+ opentelemetry-exporter-otlp-proto-grpc==1.28.2
111
+ opentelemetry-instrumentation==0.49b2
112
+ opentelemetry-instrumentation-asgi==0.49b2
113
+ opentelemetry-instrumentation-fastapi==0.49b2
114
+ opentelemetry-proto==1.28.2
115
+ opentelemetry-sdk==1.28.2
116
+ opentelemetry-semantic-conventions==0.49b2
117
+ opentelemetry-util-http==0.49b2
118
+ orjson==3.10.12
119
+ overrides==7.7.0
120
+ packaging==24.2
121
+ pandas==2.3.1
122
+ pgvector==0.3.6
123
+ pillow==11.0.0
124
+ plotly==6.3.0
125
+ pluggy==1.5.0
126
+ posthog==3.7.4
127
+ propcache==0.2.1
128
+ proto-plus==1.26.0
129
+ protobuf==5.29.1
130
+ psutil==7.0.0
131
+ psycopg2-binary==2.9.10
132
+ pyarrow==21.0.0
133
+ pyasn1==0.6.1
134
+ pyasn1_modules==0.4.1
135
+ pycparser==2.22
136
+ pydantic==2.10.2
137
+ pydantic-settings==2.6.1
138
+ pydantic_core==2.27.1
139
+ PyDrive==1.3.1
140
+ Pygments==2.18.0
141
+ PyJWT==2.10.1
142
+ PyMuPDF==1.25.0
143
+ pyparsing==3.2.1
144
+ pypdf==5.1.0
145
+ PyPika==0.48.9
146
+ pyproject_hooks==1.2.0
147
+ pytesseract==0.3.13
148
+ pytest==8.3.4
149
+ pytest-cov==5.0.0
150
+ pytest-mock==3.14.0
151
+ python-dateutil==2.9.0.post0
152
+ python-docx==1.1.2
153
+ python-dotenv==1.0.1
154
+ pytz==2025.2
155
+ PyYAML==6.0.2
156
+ redis==5.2.1
157
+ regex==2024.11.6
158
+ requests==2.32.3
159
+ requests-oauthlib==2.0.0
160
+ requests-toolbelt==1.0.0
161
+ rich==13.9.4
162
+ rsa==4.9
163
+ s3transfer==0.11.2
164
+ safetensors==0.5.2
165
+ scikit-learn==1.7.1
166
+ scipy==1.15.1
167
+ seaborn==0.13.2
168
+ setuptools==75.8.0
169
+ shellingham==1.5.4
170
+ sib-api-v3-sdk==7.6.0
171
+ six==1.17.0
172
+ sniffio==1.3.1
173
+ soupsieve==2.6
174
+ SQLAlchemy==2.0.36
175
+ starlette==0.41.3
176
+ sympy==1.13.1
177
+ tenacity==9.0.0
178
+ threadpoolctl==3.5.0
179
+ tiktoken==0.8.0
180
+ tokenizers==0.21.0
181
+ tomli==2.2.1
182
+ tqdm==4.67.1
183
+ typer==0.15.1
184
+ typing-inspect==0.9.0
185
+ typing_extensions==4.12.2
186
+ tzdata==2025.2
187
+ uritemplate==4.1.1
188
+ urllib3==2.3.0
189
+ uvicorn==0.32.1
190
+ uvloop==0.21.0
191
+ watchfiles==1.0.0
192
+ websocket-client==1.8.0
193
+ websockets==14.1
194
+ Werkzeug==3.1.3
195
+ whitenoise==6.8.2
196
+ wikipedia==1.4.0
197
+ wrapt==1.17.0
198
+ yarl==1.18.3
199
+ zipp==3.21.0
200
+ zstandard==0.23.0
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,41 @@
1
+ """
2
+ IAToolkit Package
3
+ """
4
+
5
+ # Expose main classes and functions at the top level of the package
6
+
7
+ # Assuming 'toolkit.py' contains the IAToolkit class
8
+ from .iatoolkit import IAToolkit, create_app
9
+ from .iatoolkit import current_iatoolkit
10
+
11
+ # Assuming 'app_factory.py' contains create_app and register_company
12
+ from .company_registry import register_company
13
+
14
+ # Assuming 'base_company.py' contains BaseCompany
15
+ from .base_company import BaseCompany
16
+
17
+ # --- Services ---
18
+ # Assuming they are in a 'services' sub-package
19
+ from services.sql_service import SqlService
20
+ from services.excel_service import ExcelService
21
+ from services.dispatcher_service import Dispatcher
22
+ from services.document_service import DocumentService
23
+ from services.search_service import SearchService
24
+ from repositories.profile_repo import ProfileRepo
25
+ from repositories.database_manager import DatabaseManager
26
+
27
+
28
+ __all__ = [
29
+ 'IAToolkit',
30
+ 'create_app',
31
+ 'current_iatoolkit',
32
+ 'register_company',
33
+ 'BaseCompany',
34
+ 'SqlService',
35
+ 'ExcelService',
36
+ 'Dispatcher',
37
+ 'DocumentService',
38
+ 'SearchService',
39
+ 'ProfileRepo',
40
+ 'DatabaseManager',
41
+ ]
@@ -0,0 +1,42 @@
1
+ # Copyright (c) 2024 Fernando Libedinsky
2
+ # Producto: IAToolkit
3
+ # Todos los derechos reservados.
4
+ # En trámite de registro en el Registro de Propiedad Intelectual de Chile.
5
+
6
+ # companies/base_company.py
7
+ from abc import ABC, abstractmethod
8
+ from typing import Any
9
+
10
+
11
+ class BaseCompany(ABC):
12
+ def __init__(self, profile_repo: Any = None, llm_query_repo: Any = None):
13
+ self.profile_repo = profile_repo
14
+ self.llm_query_repo = llm_query_repo
15
+
16
+ @abstractmethod
17
+ # initialize all the database tables needed
18
+ def init_db(self):
19
+ raise NotImplementedError("La subclase debe implementar el método init_db()")
20
+
21
+ @abstractmethod
22
+ # get context specific for this company
23
+ def get_company_context(self, **kwargs) -> str:
24
+ raise NotImplementedError("La subclase debe implementar el método get_company_context()")
25
+
26
+ @abstractmethod
27
+ # execute the specific action configured in the intent table
28
+ def handle_request(self, tag: str, params: dict) -> dict:
29
+ raise NotImplementedError("La subclase debe implementar el método handle_request()")
30
+
31
+ @abstractmethod
32
+ # get context specific for the query
33
+ def start_execution(self):
34
+ raise NotImplementedError("La subclase debe implementar el método start_execution()")
35
+
36
+ @abstractmethod
37
+ # get context specific for the query
38
+ def get_metadata_from_filename(self, filename: str) -> dict:
39
+ raise NotImplementedError("La subclase debe implementar el método get_query_context()")
40
+
41
+ def unsupported_operation(self, tag):
42
+ raise NotImplementedError(f"La operación '{tag}' no está soportada por esta empresa.")
@@ -0,0 +1,98 @@
1
+ # Copyright (c) 2024 Fernando Libedinsky
2
+ # Producto: IAToolkit
3
+
4
+ from typing import Dict, Type, Any
5
+ from .base_company import BaseCompany
6
+ import logging
7
+
8
+
9
+ class CompanyRegistry:
10
+ """
11
+ Registro centralizado de empresas para iatoolkit.
12
+
13
+ Permite a los clientes registrar sus clases de empresa de forma explícita
14
+ en lugar de usar autodiscovery.
15
+ """
16
+
17
+ def __init__(self):
18
+ self._company_classes: Dict[str, Type[BaseCompany]] = {}
19
+ self._company_instances: Dict[str, BaseCompany] = {}
20
+ self._injector = None
21
+
22
+ def register_company(self, name: str, company_class: Type[BaseCompany]) -> None:
23
+ """
24
+ Registra una clase de empresa.
25
+
26
+ Args:
27
+ name: Nombre de la empresa (ej: 'maxxa')
28
+ company_class: Clase que hereda de BaseCompany
29
+ """
30
+ if not issubclass(company_class, BaseCompany):
31
+ raise ValueError(f"La clase {company_class.__name__} debe heredar de BaseCompany")
32
+
33
+ company_key = name.lower()
34
+ self._company_classes[company_key] = company_class
35
+
36
+ logging.info(f"Empresa registrada: {company_key} -> {company_class.__name__}")
37
+
38
+ def set_injector(self, injector) -> None:
39
+ """Establece el injector para crear instancias con dependencias"""
40
+ self._injector = injector
41
+
42
+ def instantiate_companies(self) -> Dict[str, BaseCompany]:
43
+ """
44
+ Instancia todas las empresas registradas con inyección de dependencias.
45
+
46
+ Returns:
47
+ Dict con instancias de empresas {name: instance}
48
+ """
49
+ if not self._injector:
50
+ raise RuntimeError("Injector no configurado. Llame a set_injector() primero.")
51
+
52
+ for company_key, company_class in self._company_classes.items():
53
+ if company_key not in self._company_instances:
54
+ try:
55
+ # use de injector to create the instance
56
+ company_instance = self._injector.get(company_class)
57
+ self._company_instances[company_key] = company_instance
58
+ logging.info(f"company '{company_key}' created in dispatcher")
59
+
60
+ except Exception as e:
61
+ logging.error(f"Error instanciando empresa {company_key}: {e}")
62
+ logging.exception(e)
63
+ raise
64
+
65
+ return self._company_instances.copy()
66
+
67
+ def get_registered_companies(self) -> Dict[str, Type[BaseCompany]]:
68
+ """Retorna las clases registradas"""
69
+ return self._company_classes.copy()
70
+
71
+ def get_company_instances(self) -> Dict[str, BaseCompany]:
72
+ """Retorna las instancias de empresas"""
73
+ return self._company_instances.copy()
74
+
75
+ def clear(self) -> None:
76
+ """Limpia el registro (útil para tests)"""
77
+ self._company_classes.clear()
78
+ self._company_instances.clear()
79
+
80
+
81
+ # Instancia global del registry
82
+ _company_registry = CompanyRegistry()
83
+
84
+
85
+ def register_company(name: str, company_class: Type[BaseCompany]) -> None:
86
+ """
87
+ Función pública para registrar empresas.
88
+
89
+ Args:
90
+ name: Nombre de la empresa
91
+ company_class: Clase que hereda de BaseCompany
92
+ """
93
+ _company_registry.register_company(name, company_class)
94
+
95
+
96
+ def get_company_registry() -> CompanyRegistry:
97
+ """Obtiene el registry global"""
98
+ return _company_registry