iatoolkit 0.91.1__py3-none-any.whl → 1.7.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.
- iatoolkit/__init__.py +6 -4
- iatoolkit/base_company.py +0 -16
- iatoolkit/cli_commands.py +3 -14
- iatoolkit/common/exceptions.py +1 -0
- iatoolkit/common/interfaces/__init__.py +0 -0
- iatoolkit/common/interfaces/asset_storage.py +34 -0
- iatoolkit/common/interfaces/database_provider.py +43 -0
- iatoolkit/common/model_registry.py +159 -0
- iatoolkit/common/routes.py +47 -5
- iatoolkit/common/util.py +32 -13
- iatoolkit/company_registry.py +5 -0
- iatoolkit/core.py +51 -20
- iatoolkit/infra/connectors/file_connector_factory.py +1 -0
- iatoolkit/infra/connectors/s3_connector.py +4 -2
- iatoolkit/infra/llm_providers/__init__.py +0 -0
- iatoolkit/infra/llm_providers/deepseek_adapter.py +278 -0
- iatoolkit/infra/{gemini_adapter.py → llm_providers/gemini_adapter.py} +11 -17
- iatoolkit/infra/{openai_adapter.py → llm_providers/openai_adapter.py} +41 -7
- iatoolkit/infra/llm_proxy.py +235 -134
- iatoolkit/infra/llm_response.py +5 -0
- iatoolkit/locales/en.yaml +158 -2
- iatoolkit/locales/es.yaml +158 -0
- iatoolkit/repositories/database_manager.py +52 -47
- iatoolkit/repositories/document_repo.py +7 -0
- iatoolkit/repositories/filesystem_asset_repository.py +36 -0
- iatoolkit/repositories/llm_query_repo.py +2 -0
- iatoolkit/repositories/models.py +72 -79
- iatoolkit/repositories/profile_repo.py +59 -3
- iatoolkit/repositories/vs_repo.py +22 -24
- iatoolkit/services/company_context_service.py +126 -53
- iatoolkit/services/configuration_service.py +299 -73
- iatoolkit/services/dispatcher_service.py +21 -3
- iatoolkit/services/file_processor_service.py +0 -5
- iatoolkit/services/history_manager_service.py +43 -24
- iatoolkit/services/knowledge_base_service.py +425 -0
- iatoolkit/{infra/llm_client.py → services/llm_client_service.py} +38 -29
- iatoolkit/services/load_documents_service.py +26 -48
- iatoolkit/services/profile_service.py +32 -4
- iatoolkit/services/prompt_service.py +32 -30
- iatoolkit/services/query_service.py +51 -26
- iatoolkit/services/sql_service.py +122 -74
- iatoolkit/services/tool_service.py +26 -11
- iatoolkit/services/user_session_context_service.py +115 -63
- iatoolkit/static/js/chat_main.js +44 -4
- iatoolkit/static/js/chat_model_selector.js +227 -0
- iatoolkit/static/js/chat_onboarding_button.js +1 -1
- iatoolkit/static/js/chat_reload_button.js +4 -1
- iatoolkit/static/styles/chat_iatoolkit.css +58 -2
- iatoolkit/static/styles/llm_output.css +34 -1
- iatoolkit/system_prompts/query_main.prompt +26 -2
- iatoolkit/templates/base.html +13 -0
- iatoolkit/templates/chat.html +45 -2
- iatoolkit/templates/onboarding_shell.html +0 -1
- iatoolkit/views/base_login_view.py +7 -2
- iatoolkit/views/chat_view.py +76 -0
- iatoolkit/views/configuration_api_view.py +163 -0
- iatoolkit/views/load_document_api_view.py +14 -10
- iatoolkit/views/login_view.py +8 -3
- iatoolkit/views/rag_api_view.py +216 -0
- iatoolkit/views/users_api_view.py +33 -0
- {iatoolkit-0.91.1.dist-info → iatoolkit-1.7.0.dist-info}/METADATA +4 -4
- {iatoolkit-0.91.1.dist-info → iatoolkit-1.7.0.dist-info}/RECORD +66 -58
- iatoolkit/repositories/tasks_repo.py +0 -52
- iatoolkit/services/search_service.py +0 -55
- iatoolkit/services/tasks_service.py +0 -188
- iatoolkit/views/tasks_api_view.py +0 -72
- iatoolkit/views/tasks_review_api_view.py +0 -55
- {iatoolkit-0.91.1.dist-info → iatoolkit-1.7.0.dist-info}/WHEEL +0 -0
- {iatoolkit-0.91.1.dist-info → iatoolkit-1.7.0.dist-info}/licenses/LICENSE +0 -0
- {iatoolkit-0.91.1.dist-info → iatoolkit-1.7.0.dist-info}/licenses/LICENSE_COMMUNITY.md +0 -0
- {iatoolkit-0.91.1.dist-info → iatoolkit-1.7.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Copyright (c) 2024 Fernando Libedinsky
|
|
2
|
+
# Product: IAToolkit
|
|
3
|
+
#
|
|
4
|
+
# IAToolkit is open source software.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
from iatoolkit.common.exceptions import IAToolkitException
|
|
8
|
+
from iatoolkit.services.knowledge_base_service import KnowledgeBaseService
|
|
9
|
+
from iatoolkit.services.auth_service import AuthService
|
|
10
|
+
from iatoolkit.common.util import Utility
|
|
11
|
+
from iatoolkit.services.i18n_service import I18nService
|
|
12
|
+
from flask import request, jsonify, send_file
|
|
13
|
+
from flask.views import MethodView
|
|
14
|
+
from injector import inject
|
|
15
|
+
from datetime import datetime
|
|
16
|
+
import io
|
|
17
|
+
import mimetypes
|
|
18
|
+
|
|
19
|
+
class RagApiView(MethodView):
|
|
20
|
+
"""
|
|
21
|
+
API Endpoints for managing the RAG Knowledge Base.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
@inject
|
|
25
|
+
def __init__(self,
|
|
26
|
+
knowledge_base_service: KnowledgeBaseService,
|
|
27
|
+
auth_service: AuthService,
|
|
28
|
+
i18n_service: I18nService,
|
|
29
|
+
utility: Utility):
|
|
30
|
+
self.knowledge_base_service = knowledge_base_service
|
|
31
|
+
self.auth_service = auth_service
|
|
32
|
+
self.utility = utility
|
|
33
|
+
self.i18n_service = i18n_service
|
|
34
|
+
|
|
35
|
+
def dispatch_request(self, *args, **kwargs):
|
|
36
|
+
"""
|
|
37
|
+
Sobreescribimos el dispatch para soportar el mapeo de acciones personalizadas
|
|
38
|
+
pasadas a través de 'defaults' en add_url_rule (ej: action='list_files').
|
|
39
|
+
"""
|
|
40
|
+
action = kwargs.pop('action', None)
|
|
41
|
+
if action:
|
|
42
|
+
method = getattr(self, action, None)
|
|
43
|
+
if method:
|
|
44
|
+
return method(*args, **kwargs)
|
|
45
|
+
else:
|
|
46
|
+
raise AttributeError(self.i18n_service.t('rag.management.action_not_found', action=action))
|
|
47
|
+
|
|
48
|
+
return super().dispatch_request(*args, **kwargs)
|
|
49
|
+
|
|
50
|
+
def list_files(self, company_short_name):
|
|
51
|
+
"""
|
|
52
|
+
POST /api/rag/<company_short_name>/files
|
|
53
|
+
Returns a paginated list of documents based on filters provided in the JSON body.
|
|
54
|
+
"""
|
|
55
|
+
try:
|
|
56
|
+
# 1. Authenticate the user from the current session.
|
|
57
|
+
auth_result = self.auth_service.verify()
|
|
58
|
+
if not auth_result.get("success"):
|
|
59
|
+
return jsonify(auth_result), auth_result.get("status_code")
|
|
60
|
+
|
|
61
|
+
# 2. Parse Input
|
|
62
|
+
data = request.get_json() or {}
|
|
63
|
+
|
|
64
|
+
status = data.get('status', [])
|
|
65
|
+
user_identifier = data.get('user_identifier')
|
|
66
|
+
keyword = data.get('filename_keyword')
|
|
67
|
+
from_date_str = data.get('from_date')
|
|
68
|
+
to_date_str = data.get('to_date')
|
|
69
|
+
collection = data.get('collection', '')
|
|
70
|
+
limit = int(data.get('limit', 100))
|
|
71
|
+
offset = int(data.get('offset', 0))
|
|
72
|
+
|
|
73
|
+
from_date = datetime.fromisoformat(from_date_str) if from_date_str else None
|
|
74
|
+
to_date = datetime.fromisoformat(to_date_str) if to_date_str else None
|
|
75
|
+
|
|
76
|
+
# 3. Call Service
|
|
77
|
+
documents = self.knowledge_base_service.list_documents(
|
|
78
|
+
company_short_name=company_short_name,
|
|
79
|
+
status=status,
|
|
80
|
+
collection=collection,
|
|
81
|
+
filename_keyword=keyword,
|
|
82
|
+
user_identifier=user_identifier,
|
|
83
|
+
from_date=from_date,
|
|
84
|
+
to_date=to_date,
|
|
85
|
+
limit=limit,
|
|
86
|
+
offset=offset
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# 4. Format Response
|
|
90
|
+
response_list = []
|
|
91
|
+
for doc in documents:
|
|
92
|
+
response_list.append({
|
|
93
|
+
'id': doc.id,
|
|
94
|
+
'filename': doc.filename,
|
|
95
|
+
'user_identifier': doc.user_identifier,
|
|
96
|
+
'status': doc.status.value if hasattr(doc.status, 'value') else str(doc.status),
|
|
97
|
+
'created_at': doc.created_at.isoformat() if doc.created_at else None,
|
|
98
|
+
'metadata': doc.meta,
|
|
99
|
+
'error_message': doc.error_message,
|
|
100
|
+
'collection': doc.collection_type.name if doc.collection_type else None,
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
return jsonify({
|
|
104
|
+
'result': 'success',
|
|
105
|
+
'count': len(response_list),
|
|
106
|
+
'documents': response_list
|
|
107
|
+
}), 200
|
|
108
|
+
|
|
109
|
+
except IAToolkitException as e:
|
|
110
|
+
return jsonify({'result': 'error', 'message': e.message}), e.http_code
|
|
111
|
+
except Exception as e:
|
|
112
|
+
return jsonify({'result': 'error', 'message': str(e)}), 500
|
|
113
|
+
|
|
114
|
+
def get_file_content(self, company_short_name, document_id):
|
|
115
|
+
"""
|
|
116
|
+
GET /api/rag/<company_short_name>/files/<document_id>/content
|
|
117
|
+
Streams the file content to the browser (inline view preferred).
|
|
118
|
+
"""
|
|
119
|
+
try:
|
|
120
|
+
# 1. Authenticate
|
|
121
|
+
auth_result = self.auth_service.verify()
|
|
122
|
+
if not auth_result.get("success"):
|
|
123
|
+
return jsonify(auth_result), auth_result.get("status_code")
|
|
124
|
+
|
|
125
|
+
# 2. Get content from service
|
|
126
|
+
file_bytes, filename = self.knowledge_base_service.get_document_content(document_id)
|
|
127
|
+
|
|
128
|
+
if not file_bytes:
|
|
129
|
+
msg = self.i18n_service.t('rag.management.not_found')
|
|
130
|
+
return jsonify({'result': 'error', 'message': msg}), 404
|
|
131
|
+
|
|
132
|
+
# 3. Determine MIME type
|
|
133
|
+
mime_type, _ = mimetypes.guess_type(filename)
|
|
134
|
+
if not mime_type:
|
|
135
|
+
mime_type = 'application/octet-stream'
|
|
136
|
+
|
|
137
|
+
# 4. Stream response
|
|
138
|
+
return send_file(
|
|
139
|
+
io.BytesIO(file_bytes),
|
|
140
|
+
mimetype=mime_type,
|
|
141
|
+
as_attachment=False, # Inline view
|
|
142
|
+
download_name=filename
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
except IAToolkitException as e:
|
|
146
|
+
return jsonify({'result': 'error', 'message': e.message}), e.http_code
|
|
147
|
+
except Exception as e:
|
|
148
|
+
return jsonify({'result': 'error', 'message': str(e)}), 500
|
|
149
|
+
|
|
150
|
+
def delete_file(self, company_short_name, document_id):
|
|
151
|
+
"""
|
|
152
|
+
DELETE /api/rag/<company_short_name>/files/<document_id>
|
|
153
|
+
Deletes a document and its vectors.
|
|
154
|
+
"""
|
|
155
|
+
try:
|
|
156
|
+
# 1. Authenticate
|
|
157
|
+
auth_result = self.auth_service.verify()
|
|
158
|
+
if not auth_result.get("success"):
|
|
159
|
+
return jsonify(auth_result), auth_result.get("status_code")
|
|
160
|
+
|
|
161
|
+
# 2. Call Service
|
|
162
|
+
success = self.knowledge_base_service.delete_document(document_id)
|
|
163
|
+
|
|
164
|
+
if success:
|
|
165
|
+
msg = self.i18n_service.t('rag.management.delete_success')
|
|
166
|
+
return jsonify({'result': 'success', 'message': msg}), 200
|
|
167
|
+
else:
|
|
168
|
+
msg = self.i18n_service.t('rag.management.not_found')
|
|
169
|
+
return jsonify({'result': 'error', 'message': msg}), 404
|
|
170
|
+
|
|
171
|
+
except IAToolkitException as e:
|
|
172
|
+
return jsonify({'result': 'error', 'message': e.message}), e.http_code
|
|
173
|
+
except Exception as e:
|
|
174
|
+
return jsonify({'result': 'error', 'message': str(e)}), 500
|
|
175
|
+
|
|
176
|
+
def search(self, company_short_name):
|
|
177
|
+
"""
|
|
178
|
+
POST /api/rag/<company_short_name>/search
|
|
179
|
+
Synchronous semantic search for the "Search Lab" UI.
|
|
180
|
+
Returns detailed chunks with text and metadata using search_raw.
|
|
181
|
+
"""
|
|
182
|
+
try:
|
|
183
|
+
# 1. Authenticate
|
|
184
|
+
auth_result = self.auth_service.verify()
|
|
185
|
+
if not auth_result.get("success"):
|
|
186
|
+
return jsonify(auth_result), auth_result.get("status_code")
|
|
187
|
+
|
|
188
|
+
# 2. Parse Input
|
|
189
|
+
data = request.get_json() or {}
|
|
190
|
+
query = data.get('query')
|
|
191
|
+
n_results = int(data.get('k', 5))
|
|
192
|
+
collection = data.get('collection')
|
|
193
|
+
metadata_filter = data.get('metadata_filter')
|
|
194
|
+
|
|
195
|
+
if not query:
|
|
196
|
+
msg = self.i18n_service.t('rag.search.query_required')
|
|
197
|
+
return jsonify({'result': 'error', 'message': msg}), 400
|
|
198
|
+
|
|
199
|
+
# 3. Call Service
|
|
200
|
+
chunks = self.knowledge_base_service.search_raw(
|
|
201
|
+
company_short_name=company_short_name,
|
|
202
|
+
query=query,
|
|
203
|
+
n_results=n_results,
|
|
204
|
+
collection=collection,
|
|
205
|
+
metadata_filter=metadata_filter,
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
return jsonify({
|
|
209
|
+
"result": "success",
|
|
210
|
+
"chunks": chunks
|
|
211
|
+
}), 200
|
|
212
|
+
|
|
213
|
+
except IAToolkitException as e:
|
|
214
|
+
return jsonify({'result': 'error', 'error_message': e.message}), 501
|
|
215
|
+
except Exception as e:
|
|
216
|
+
return jsonify({'result': 'error', 'error_message': str(e)}), 500
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from flask.views import MethodView
|
|
2
|
+
from flask import jsonify
|
|
3
|
+
from injector import inject
|
|
4
|
+
from iatoolkit.services.auth_service import AuthService
|
|
5
|
+
from iatoolkit.services.profile_service import ProfileService
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class UsersApiView(MethodView):
|
|
10
|
+
"""
|
|
11
|
+
list company users and their roles
|
|
12
|
+
"""
|
|
13
|
+
@inject
|
|
14
|
+
def __init__(self,
|
|
15
|
+
auth_service: AuthService,
|
|
16
|
+
profile_service: ProfileService):
|
|
17
|
+
self.auth_service = auth_service
|
|
18
|
+
self.profile_service = profile_service
|
|
19
|
+
|
|
20
|
+
def get(self, company_short_name: str):
|
|
21
|
+
try:
|
|
22
|
+
auth_result = self.auth_service.verify(anonymous=True)
|
|
23
|
+
if not auth_result.get("success"):
|
|
24
|
+
return jsonify(auth_result), auth_result.get("status_code", 401)
|
|
25
|
+
|
|
26
|
+
# get users of the company
|
|
27
|
+
users = self.profile_service.get_company_users(company_short_name)
|
|
28
|
+
|
|
29
|
+
return jsonify(users), 200
|
|
30
|
+
|
|
31
|
+
except Exception as e:
|
|
32
|
+
logging.exception(f"Error fetching users for {company_short_name}: {e}")
|
|
33
|
+
return jsonify({"error": "Unexpected error", "details": str(e)}), 500
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: iatoolkit
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: IAToolkit
|
|
5
5
|
Author: Fernando Libedinsky
|
|
6
6
|
License-Expression: MIT
|
|
@@ -207,9 +207,9 @@ Perfect for developers, small teams, single-business use cases, and experimentat
|
|
|
207
207
|
|
|
208
208
|
### 🟥 Enterprise Edition (Commercial License)
|
|
209
209
|
- Unlimited Companies (multi-tenant)
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
- SSO
|
|
210
|
+
- Payment services integration
|
|
211
|
+
- Enterprise Agent Workflows
|
|
212
|
+
- SSO integration
|
|
213
213
|
- Priority support & continuous updates
|
|
214
214
|
- Activation via **License Key**
|
|
215
215
|
|
|
@@ -1,67 +1,72 @@
|
|
|
1
|
-
iatoolkit/__init__.py,sha256=
|
|
2
|
-
iatoolkit/base_company.py,sha256=
|
|
3
|
-
iatoolkit/cli_commands.py,sha256=
|
|
4
|
-
iatoolkit/company_registry.py,sha256=
|
|
5
|
-
iatoolkit/core.py,sha256=
|
|
1
|
+
iatoolkit/__init__.py,sha256=lBC4IhNqHSyQzU5dQEHh49nkOgc97JfQq2E27-VVPa0,1425
|
|
2
|
+
iatoolkit/base_company.py,sha256=TzGvdseDpJMi9fl5nbR2pMARgU6pN6ISatFoMJKtNxw,648
|
|
3
|
+
iatoolkit/cli_commands.py,sha256=EDky1QpvHnatzXsd1evYW0OQt-k3JIbPGMc13vgDvy4,1814
|
|
4
|
+
iatoolkit/company_registry.py,sha256=XopFzqIpUxBtQJzdZwu2-c0v98MLT7SP_xLPxn_iENM,4176
|
|
5
|
+
iatoolkit/core.py,sha256=QKqu-QDrNWunDU9uX96a86kFNv3a_aAxonkpxJptzoE,20885
|
|
6
6
|
iatoolkit/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
iatoolkit/common/exceptions.py,sha256=
|
|
8
|
-
iatoolkit/common/
|
|
7
|
+
iatoolkit/common/exceptions.py,sha256=xmNi5Et13pCvCM1so79z36I-7Kdie8nVUAqW9acGs9k,1202
|
|
8
|
+
iatoolkit/common/model_registry.py,sha256=HiFr1FtRKGjpp3YurkiF4l6sGuirigDVL-b_3_R-vlM,5561
|
|
9
|
+
iatoolkit/common/routes.py,sha256=iVZawjKfGt6iK9tZ8t3y6dofP4KJpIQex48OVVvlRYo,7540
|
|
9
10
|
iatoolkit/common/session_manager.py,sha256=OUYMzT8hN1U-NCUidR5tUAXB1drd8nYTOpo60rUNYeY,532
|
|
10
|
-
iatoolkit/common/util.py,sha256=
|
|
11
|
+
iatoolkit/common/util.py,sha256=NfSuDbzrGVS59fIgqJETYUlD5otMLwAjyp7OVhaMoo8,16310
|
|
12
|
+
iatoolkit/common/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
iatoolkit/common/interfaces/asset_storage.py,sha256=IYXyc73gmwFT7T8RQhC4MymQDW0vGDSEzuKk43w7Ct4,989
|
|
14
|
+
iatoolkit/common/interfaces/database_provider.py,sha256=7ayYuEYRunkm4udoOGumoX9PfdgohBcrj0JDPfyfM00,1156
|
|
11
15
|
iatoolkit/infra/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
12
16
|
iatoolkit/infra/brevo_mail_app.py,sha256=xvy3KxEEgjFpHlIAogP6SU5KXmg3w7lC16nnNmOYU8Y,5323
|
|
13
17
|
iatoolkit/infra/call_service.py,sha256=iRk9VxbXaAwlLIl8fUzGDWIAdzwfsbs1MtP84YeENxg,4929
|
|
14
|
-
iatoolkit/infra/gemini_adapter.py,sha256=kXV-t5i9GmWBafUPX2kAyiqvcT7GPoxHylcCUWG_c_U,15051
|
|
15
18
|
iatoolkit/infra/google_chat_app.py,sha256=_uKWxeacHH6C5a4FVx0YZjBn1tL-x_MIQV9gqgWGAjo,1937
|
|
16
|
-
iatoolkit/infra/
|
|
17
|
-
iatoolkit/infra/
|
|
18
|
-
iatoolkit/infra/llm_response.py,sha256=YUUQPBHzmP3Ce6-t0kKMRIpowvh7de1odSoefEByIvI,904
|
|
19
|
-
iatoolkit/infra/openai_adapter.py,sha256=tbzd8aPAH5cQOJT-sD4ypqq2fWB6WiEIGuGesUDnQNk,3550
|
|
19
|
+
iatoolkit/infra/llm_proxy.py,sha256=6PngfQ4Q-5tLiqdroNCn58kBJh5uZZb_6S98HKH4pQY,10639
|
|
20
|
+
iatoolkit/infra/llm_response.py,sha256=6hSmI909m0Pdgs7UnJHrv_nokbCZLzHpdwBUED6VNck,1062
|
|
20
21
|
iatoolkit/infra/redis_session_manager.py,sha256=EPr3E_g7LHxn6U4SV5lT_L8WQsAwg8VzA_WIEZ3TwOw,3667
|
|
21
22
|
iatoolkit/infra/connectors/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
22
23
|
iatoolkit/infra/connectors/file_connector.py,sha256=HOjRTFd-WfDOcFyvHncAhnGNZuFgChIwC-P6osPo9ZM,352
|
|
23
|
-
iatoolkit/infra/connectors/file_connector_factory.py,sha256=
|
|
24
|
+
iatoolkit/infra/connectors/file_connector_factory.py,sha256=iCOhklUaYG3YxtJGBYOrLN8spF5mjKu6vyA6nj71FHI,2167
|
|
24
25
|
iatoolkit/infra/connectors/google_cloud_storage_connector.py,sha256=IXpL3HTo7Ft4EQsYiQq5wXRRQK854jzOEB7ZdWjLa4U,2050
|
|
25
26
|
iatoolkit/infra/connectors/google_drive_connector.py,sha256=WR1AlO5-Bl3W89opdja0kKgHTJzVOjTsy3H4SlIvwVg,2537
|
|
26
27
|
iatoolkit/infra/connectors/local_file_connector.py,sha256=hrzIgpMJOTuwTqzlQeTIU_50ZbZ6yl8lcWPv6hMnoqI,1739
|
|
27
|
-
iatoolkit/infra/connectors/s3_connector.py,sha256=
|
|
28
|
-
iatoolkit/
|
|
29
|
-
iatoolkit/
|
|
28
|
+
iatoolkit/infra/connectors/s3_connector.py,sha256=r8bgye8ydMzayAAg5RS22oakpKd-vNw-cSrOCvlwG9g,1209
|
|
29
|
+
iatoolkit/infra/llm_providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
iatoolkit/infra/llm_providers/deepseek_adapter.py,sha256=ui4V05xplUvLWHu7y_dUMKpP4Af-BkZi5tvdgZY16dU,10719
|
|
31
|
+
iatoolkit/infra/llm_providers/gemini_adapter.py,sha256=xjYAMgS4bh7qfpCEv6n92tzpKdjnNBVFfr8GkSrcatM,14555
|
|
32
|
+
iatoolkit/infra/llm_providers/openai_adapter.py,sha256=9SuHYtPJcadWSV_GHfx8DDj9BqkUS3RvLSyDd_ZVB2M,4848
|
|
33
|
+
iatoolkit/locales/en.yaml,sha256=NX1LMzpBNtgRl0q5RqD9wwTbF9IKzdVheTOaGzI1P7E,13571
|
|
34
|
+
iatoolkit/locales/es.yaml,sha256=ote9JSzWq8lGwbfX7wKKIp7ccdZ76-sbXIDnTp_szQQ,14443
|
|
30
35
|
iatoolkit/repositories/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
31
|
-
iatoolkit/repositories/database_manager.py,sha256=
|
|
32
|
-
iatoolkit/repositories/document_repo.py,sha256=
|
|
33
|
-
iatoolkit/repositories/
|
|
34
|
-
iatoolkit/repositories/
|
|
35
|
-
iatoolkit/repositories/
|
|
36
|
-
iatoolkit/repositories/
|
|
37
|
-
iatoolkit/repositories/vs_repo.py,sha256=
|
|
36
|
+
iatoolkit/repositories/database_manager.py,sha256=F6oYrmNp29SrYHJeoe7UIzQuXdZ6fVyRMgdWhGo6oCs,5905
|
|
37
|
+
iatoolkit/repositories/document_repo.py,sha256=5oCrq8pjcyOCBrOc4XYeUvza9nUd0VJ4eNL0g1MQb68,1441
|
|
38
|
+
iatoolkit/repositories/filesystem_asset_repository.py,sha256=ZFr_FpHQD5nszZnJSki6nc-W3PKvmhTxKmVZMd2DUbM,1825
|
|
39
|
+
iatoolkit/repositories/llm_query_repo.py,sha256=8rGSVx7WZlGbUfeVw_uGygTUuJXRK5vGfFHj1znc1ss,3981
|
|
40
|
+
iatoolkit/repositories/models.py,sha256=PH8HiMxKDzZ7khDl9dod2XbRrkWlWCThOrRF9BeChPE,13460
|
|
41
|
+
iatoolkit/repositories/profile_repo.py,sha256=zhjTTizhkTaCZvWMCZtTzTTTmx0fsjtao2fKurwP1xE,5838
|
|
42
|
+
iatoolkit/repositories/vs_repo.py,sha256=CzT77B7_kWN5p3QhXgdf5X3JkS_02CwFVhxmp0K3rrc,6140
|
|
38
43
|
iatoolkit/services/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
39
44
|
iatoolkit/services/auth_service.py,sha256=B0gTUHDf56WiTnA5viBEvbmf2A6y_6bkAoFlMvu0IWY,7756
|
|
40
45
|
iatoolkit/services/benchmark_service.py,sha256=CdbFYyS3FHFhNzWQEa9ZNjUlmON10DT1nKNbZQ1EUi8,5880
|
|
41
46
|
iatoolkit/services/branding_service.py,sha256=Fsjcos7hGLx2qhoZ9hTaFCgb7x5eYHMDGvXg4mXx8D0,8120
|
|
42
|
-
iatoolkit/services/company_context_service.py,sha256=
|
|
43
|
-
iatoolkit/services/configuration_service.py,sha256=
|
|
44
|
-
iatoolkit/services/dispatcher_service.py,sha256=
|
|
47
|
+
iatoolkit/services/company_context_service.py,sha256=Oqldfdo8MSGv_KB8-4EztUVcqycoabrVLSbfky2n5s4,10435
|
|
48
|
+
iatoolkit/services/configuration_service.py,sha256=TsrTzou2Z8rC50favIlPgAloHBcy2p1jlZjRNtg3cq8,24184
|
|
49
|
+
iatoolkit/services/dispatcher_service.py,sha256=f3aPbKU9UkNS61dNVZjT-J9hg3x-H2Nb_n-cZRnZ9aI,5247
|
|
45
50
|
iatoolkit/services/document_service.py,sha256=XrAwbNPyhmP94bGdDwHy76Mg_PCg6O2QyZwii1T6kZ8,6469
|
|
46
51
|
iatoolkit/services/embedding_service.py,sha256=ngRnFXEpko-rqpicqbJbVdr91IjSe1jXSYVWprOVlE0,6296
|
|
47
52
|
iatoolkit/services/excel_service.py,sha256=de4fj3klWFWSTdgej8yk0FBuNr1lunyy9cuOyZwl0rI,6221
|
|
48
|
-
iatoolkit/services/file_processor_service.py,sha256=
|
|
49
|
-
iatoolkit/services/history_manager_service.py,sha256=
|
|
53
|
+
iatoolkit/services/file_processor_service.py,sha256=5xS7zrdL_kpCFXQ5seqNl9tiseI7otD8NRIQENuafjE,3628
|
|
54
|
+
iatoolkit/services/history_manager_service.py,sha256=nq1hk39WDbyHG6s8irpIdCS98EBDagF0djH6JHq9WuY,8734
|
|
50
55
|
iatoolkit/services/i18n_service.py,sha256=mR4pS0z56NgZLeSnEvDXiMvVBeOCl5CkUWdYBTVEhyM,3941
|
|
51
56
|
iatoolkit/services/jwt_service.py,sha256=pVoH1rzRwWixpvT3AhFdiE1BDmdbo4KQMyOF0P7tz-Y,2939
|
|
57
|
+
iatoolkit/services/knowledge_base_service.py,sha256=UuFWdjobFqwsBuLwAqi4FRNaVuYabSIjSj4vPKxZzLk,17098
|
|
52
58
|
iatoolkit/services/language_service.py,sha256=ktNzj0hrCPm_VMIpWTxFEpEHKQ1lOHOfuhzCbZud2Dc,3428
|
|
53
59
|
iatoolkit/services/license_service.py,sha256=pdl9szSEPbIu2ISl6g-WIR1p4HQu2gSGdAjViKxY6Hg,2751
|
|
54
|
-
iatoolkit/services/
|
|
60
|
+
iatoolkit/services/llm_client_service.py,sha256=YSvoNKeBQRGL3znMDIyLH2PGZt4ImmYKD_aBlBeS91k,19024
|
|
61
|
+
iatoolkit/services/load_documents_service.py,sha256=WEaPMRxginbsxOXopofPj6FeH-iIrSTlipFFRV20t4I,7069
|
|
55
62
|
iatoolkit/services/mail_service.py,sha256=6Kx1CIbXzAr_ucoqwqTlhhwE6y2Jw64eNDjXysaZP-c,8297
|
|
56
|
-
iatoolkit/services/profile_service.py,sha256=
|
|
57
|
-
iatoolkit/services/prompt_service.py,sha256=
|
|
58
|
-
iatoolkit/services/query_service.py,sha256=
|
|
59
|
-
iatoolkit/services/
|
|
60
|
-
iatoolkit/services/
|
|
61
|
-
iatoolkit/services/tasks_service.py,sha256=itREO5rDnUIgsqtyCOBKDtH30QL5v1egs4qPTiBK8xU,6865
|
|
62
|
-
iatoolkit/services/tool_service.py,sha256=K1CesxoovZT9wGqaE6QQoVPtMU4bNno4Dc0uXpHDcIc,9458
|
|
63
|
+
iatoolkit/services/profile_service.py,sha256=mUXW5dwFF4SBH04adQuoSj-E0FmuLDt_VcPo9oxdr1M,23680
|
|
64
|
+
iatoolkit/services/prompt_service.py,sha256=mr3szmOThNi6MtqCbh4rwJJOlk-Be35bkIJXqh7_hvM,12898
|
|
65
|
+
iatoolkit/services/query_service.py,sha256=aS2-NtEMdu-QViw58d-g9iZI1j3KZIJb0xrN8N_c__U,20406
|
|
66
|
+
iatoolkit/services/sql_service.py,sha256=nafxpDdv1AbOYMeHzoiD6G8V64TPMniUlLhrJ0J_KOU,7802
|
|
67
|
+
iatoolkit/services/tool_service.py,sha256=FQuplPsgs1AdyOk2pxUBkPIvAvUqJU1ElOpOWz5wkr8,10002
|
|
63
68
|
iatoolkit/services/user_feedback_service.py,sha256=KbjMjl0CDF7WpPHioJ3sqQVwocjfq_cisrpeqYUqtas,5361
|
|
64
|
-
iatoolkit/services/user_session_context_service.py,sha256=
|
|
69
|
+
iatoolkit/services/user_session_context_service.py,sha256=RSv_NxOSTVPA6nFLiZKSIuUWa59cmZWBwiN_TWSljBo,9074
|
|
65
70
|
iatoolkit/static/images/fernando.jpeg,sha256=W68TYMuo5hZVpbP-evwH6Nu4xWFv2bc8pJzSKDoLTeQ,100612
|
|
66
71
|
iatoolkit/static/images/iatoolkit_core.png,sha256=EsmhI8ucevGtzWUPtRDUBfoU-1jqXK7ZmQtrZ-cbJO8,42358
|
|
67
72
|
iatoolkit/static/images/iatoolkit_logo.png,sha256=cGSO-06Y8hCwxsnEGbUBjqFmlSA4pm-OOnNypOEAZVs,7563
|
|
@@ -70,34 +75,37 @@ iatoolkit/static/js/chat_filepond.js,sha256=mzXafm7a506EpM37KATTK3zvAswO1E0KSUY1
|
|
|
70
75
|
iatoolkit/static/js/chat_help_content.js,sha256=VwJ4esnrQ2xCP09IhObJyg-sRIJYMGGiAIRF8fX_lE0,5201
|
|
71
76
|
iatoolkit/static/js/chat_history_button.js,sha256=i9EBAWWW2XyQnAuj1b-c8102EG_gDkQ2ElbA8_Nu0yo,3491
|
|
72
77
|
iatoolkit/static/js/chat_logout_button.js,sha256=Of9H6IbAboSBmeqRaurEVW6_dL752L0UeDcDLNBD5Z0,1335
|
|
73
|
-
iatoolkit/static/js/chat_main.js,sha256=
|
|
74
|
-
iatoolkit/static/js/
|
|
78
|
+
iatoolkit/static/js/chat_main.js,sha256=9qlBiiR1Xf1iW0kn6W4gkKtk_9mr4ZT5Ib8-Y0GkXr4,14964
|
|
79
|
+
iatoolkit/static/js/chat_model_selector.js,sha256=EJC3GAZK0AXZaYdyYL4oA0NbxAVwK-bV2EyFbtU01RA,7175
|
|
80
|
+
iatoolkit/static/js/chat_onboarding_button.js,sha256=o1lovwq38bENAzSnCi8c0bUgEszq_C49NdzeaAwXthU,3359
|
|
75
81
|
iatoolkit/static/js/chat_prompt_manager.js,sha256=QYki28CpyM2Chn82dnOP2eH6FObxH8eChGFyUxukv1M,3319
|
|
76
|
-
iatoolkit/static/js/chat_reload_button.js,sha256=
|
|
77
|
-
iatoolkit/static/styles/chat_iatoolkit.css,sha256=
|
|
82
|
+
iatoolkit/static/js/chat_reload_button.js,sha256=MFZgtBCZdNpWnx-L1V1M_dUFx0p8lWs_G0LdXFol3gY,1361
|
|
83
|
+
iatoolkit/static/styles/chat_iatoolkit.css,sha256=cGD9riX-4s978XJJKPcyO6qHq1ngKMzNEhsRpimySVs,15926
|
|
78
84
|
iatoolkit/static/styles/chat_modal.css,sha256=9rwWrzL4Vq7AsdiGb3qczyOUf2PJEgLjSLCkSns8dQA,3031
|
|
79
85
|
iatoolkit/static/styles/chat_public.css,sha256=2SDz0gGyTnTn3BUwD--QX-0qEc3eYKXeTTC6h730UCU,4486
|
|
80
86
|
iatoolkit/static/styles/documents.css,sha256=6Yoprc9JHlKdtqUBEGr4r-JCQsK3Bg1ivoxfJyGuKvg,11893
|
|
81
87
|
iatoolkit/static/styles/landing_page.css,sha256=HVYbo9ZqbqsImvMhGBq2dDFkRiRWOtVaZ0IP9QqDquA,8914
|
|
82
|
-
iatoolkit/static/styles/llm_output.css,sha256=
|
|
88
|
+
iatoolkit/static/styles/llm_output.css,sha256=EQjfETdViLjIsyUYp3NvlR1fGICUCK531OsRx43dYvk,3131
|
|
83
89
|
iatoolkit/static/styles/onboarding.css,sha256=fNiqT_MMJ6gGhNzfbSZhJwvcCZ_8gibL-MWZwxyAgAs,3749
|
|
84
90
|
iatoolkit/system_prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
91
|
iatoolkit/system_prompts/format_styles.prompt,sha256=MSMe1qvR3cF_0IbFshn8R0z6Wx6VCHQq1p37rpu5wwk,3576
|
|
86
|
-
iatoolkit/system_prompts/query_main.prompt,sha256=
|
|
92
|
+
iatoolkit/system_prompts/query_main.prompt,sha256=ZiuiRQRkfZn7Su8SilV57LwCdsIyRASrKxdAWi5h27w,2991
|
|
87
93
|
iatoolkit/system_prompts/sql_rules.prompt,sha256=U1Z5BObI-fgkMatcYfx89q2-YmuRNK6OV6q69p-wAFI,60585
|
|
88
94
|
iatoolkit/templates/_company_header.html,sha256=L1QtrMpqYXALqtinCa3WhG4CrgHKLObl_d-jfQYNjhg,1903
|
|
89
95
|
iatoolkit/templates/_login_widget.html,sha256=qziV70-n7SwC11rL4cU1LenJM83jYvuyw2xSz6OORJA,2063
|
|
90
|
-
iatoolkit/templates/base.html,sha256=
|
|
96
|
+
iatoolkit/templates/base.html,sha256=sRHUnHaKIycLRKZ_PQOTb88kSBC6kigzxlm60vpXj1I,3434
|
|
91
97
|
iatoolkit/templates/change_password.html,sha256=p0GWZ9gldluYQM8OPSz2Q4CYhU8UJmb-72iz_Sl_6Ho,3485
|
|
92
|
-
iatoolkit/templates/chat.html,sha256=
|
|
98
|
+
iatoolkit/templates/chat.html,sha256=8tLQlpCS7Nd1-07kefIZzv4S5Hcd1UIhQmC5P_Z760s,15685
|
|
93
99
|
iatoolkit/templates/chat_modals.html,sha256=x0Do7I7X9cfgZFHSAwWreIN55nYPCpZK7PTBxGXjrYY,8501
|
|
94
100
|
iatoolkit/templates/error.html,sha256=4aT6cIYQUILciekAceHEiUuZxcAqkmNPUMnB9CD4BNA,1778
|
|
95
101
|
iatoolkit/templates/forgot_password.html,sha256=XLVMmLJK5SAXmPqIH_OyTlSbu5QTAdekO6ggzfcNup0,2376
|
|
96
|
-
iatoolkit/templates/onboarding_shell.html,sha256=
|
|
102
|
+
iatoolkit/templates/onboarding_shell.html,sha256=GODHz4JrNyZyf9sPq7GNKMoRrLmKn6kZZQBU4HLgyiU,4604
|
|
97
103
|
iatoolkit/templates/signup.html,sha256=kvV9B8M99zMDj4y9up-K5ChzOznSxzZTX4jPShGRBvI,4316
|
|
98
104
|
iatoolkit/views/__init__.py,sha256=5JqK9sZ6jBuK83zDQokUhxQ0wuJJJ9DXB8pYCLkX7X4,102
|
|
99
|
-
iatoolkit/views/base_login_view.py,sha256=
|
|
105
|
+
iatoolkit/views/base_login_view.py,sha256=l45msQUrLGxxxZrSb5l7tnTLLQyIoPTu4TgbkHBvVlc,3981
|
|
100
106
|
iatoolkit/views/change_password_view.py,sha256=TXFvvtNrR37yrNAHYzcMSSIkV4-MIzmIpwbPffaJJyE,4957
|
|
107
|
+
iatoolkit/views/chat_view.py,sha256=QNlC0n1hxjWbI3wyLhV6D-U2kJZkIqClNg94iQP4PrA,3534
|
|
108
|
+
iatoolkit/views/configuration_api_view.py,sha256=K8aclK6oKkoTZoYwck-mozLchEOFCkrXFtraHh7tI00,6370
|
|
101
109
|
iatoolkit/views/embedding_api_view.py,sha256=9n5utihq8zHiG0V2sVCOYQ72wOKa4denqE951gqaJWo,2371
|
|
102
110
|
iatoolkit/views/forgot_password_view.py,sha256=C4eJe9GmGrl6M3bTt_anwuPQib9ouXZtKYp6kB2xBeU,3380
|
|
103
111
|
iatoolkit/views/help_content_api_view.py,sha256=8EUw2iSE6X-Lm2dGlYZxSp-29HzaAGwD3CpL4Otqp5k,2011
|
|
@@ -105,21 +113,21 @@ iatoolkit/views/history_api_view.py,sha256=oNYfo-fZbz4sY6VpE_goaCFQyH2k9IX85VhPo
|
|
|
105
113
|
iatoolkit/views/home_view.py,sha256=GaU2-qyTnE8jE1ejdNjHW3azo72X_Awhp1y1Zx9BXRg,2662
|
|
106
114
|
iatoolkit/views/init_context_api_view.py,sha256=axfNno8E1v4dCNuXNkdV1XpDZtypICj48hW3cRyl_eA,2961
|
|
107
115
|
iatoolkit/views/llmquery_api_view.py,sha256=ohlYmFcvhvZL2BTMeCzd7ZPeTBzIPcIZbC9CRWqQM70,2290
|
|
108
|
-
iatoolkit/views/load_document_api_view.py,sha256=
|
|
109
|
-
iatoolkit/views/login_view.py,sha256=
|
|
116
|
+
iatoolkit/views/load_document_api_view.py,sha256=RaO4KRz19uSOv3LL7Fn8FJSLzHtRkPAIYRPU-yT1nxQ,2485
|
|
117
|
+
iatoolkit/views/login_view.py,sha256=NKPjR9cCOsw7FhOfXCM32m6veKxRdLhsc0H7DLc5_ug,7517
|
|
110
118
|
iatoolkit/views/logout_api_view.py,sha256=7c0rL5sLTuoRPqQs73wlH_7eb3--S6GLcr7Yu4hNOYU,2035
|
|
111
119
|
iatoolkit/views/profile_api_view.py,sha256=qhlmhyygIs5h-OyNDwq1uGUS8S-GxB2zOYY51Hs5prY,1645
|
|
112
120
|
iatoolkit/views/prompt_api_view.py,sha256=WAv4I6WmGfT1TTZ-lml9LaR2wDsSx9mshYcxFAV_wtk,1255
|
|
121
|
+
iatoolkit/views/rag_api_view.py,sha256=zsEdsSMoxBrX3jGFoKWB7oUm_Sp1x6lh2tAy-g_CUiI,8389
|
|
113
122
|
iatoolkit/views/root_redirect_view.py,sha256=t7tqiyJAPffzIuQVwnfgIw3Bo51qkegyMmBTfChsrJk,833
|
|
114
123
|
iatoolkit/views/signup_view.py,sha256=83jgbAuOAETID88TC8h-wCszkkEaFygCH6tTj7XyZYI,4261
|
|
115
124
|
iatoolkit/views/static_page_view.py,sha256=V0oTybQ5lFo3hp5xOKau-yMO8vK8NCM6zWiwVI8lpBQ,881
|
|
116
|
-
iatoolkit/views/tasks_api_view.py,sha256=wGnuwuuL83ByQ1Yre6ytRVztA0OGQjGrwMjB1_G830U,2630
|
|
117
|
-
iatoolkit/views/tasks_review_api_view.py,sha256=wsCpzqyRyUdCXWAhyGlBe3eNZZ6A1DQG7TblN_GZNfM,1894
|
|
118
125
|
iatoolkit/views/user_feedback_api_view.py,sha256=QOTBtpNqYAmewXDgVAoaIprnVjvf1xM0ExWxSFp3ICI,2098
|
|
126
|
+
iatoolkit/views/users_api_view.py,sha256=hVR6rxLNyhGiXhCIHvttUeSinH071Pyk-2_Fcm-v2TM,1139
|
|
119
127
|
iatoolkit/views/verify_user_view.py,sha256=Uc9P2wiRjZ7pMRTjWUn8Y-p0DFqw_AwNYQsdbAwhbg8,2659
|
|
120
|
-
iatoolkit-
|
|
121
|
-
iatoolkit-
|
|
122
|
-
iatoolkit-
|
|
123
|
-
iatoolkit-
|
|
124
|
-
iatoolkit-
|
|
125
|
-
iatoolkit-
|
|
128
|
+
iatoolkit-1.7.0.dist-info/licenses/LICENSE,sha256=5tOLQdjoCvSXEx_7Lr4bSab3ha4NSwzamvua0fwCXi8,1075
|
|
129
|
+
iatoolkit-1.7.0.dist-info/licenses/LICENSE_COMMUNITY.md,sha256=9lVNcggPNUnleMF3_h3zu9PbNTeaRqB1tHAbiBLQJZU,566
|
|
130
|
+
iatoolkit-1.7.0.dist-info/METADATA,sha256=V0ZDSh08B6jbggfwSY10wfIt7oDiFVWHuPTg-Dbkg30,8395
|
|
131
|
+
iatoolkit-1.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
132
|
+
iatoolkit-1.7.0.dist-info/top_level.txt,sha256=V_w4QvDx0b1RXiy8zTCrD1Bp7AZkFe3_O0-9fMiwogg,10
|
|
133
|
+
iatoolkit-1.7.0.dist-info/RECORD,,
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Fernando Libedinsky
|
|
2
|
-
# Product: IAToolkit
|
|
3
|
-
#
|
|
4
|
-
# IAToolkit is open source software.
|
|
5
|
-
|
|
6
|
-
from injector import inject
|
|
7
|
-
from datetime import datetime
|
|
8
|
-
from iatoolkit.repositories.models import Task, TaskStatus, TaskType
|
|
9
|
-
from iatoolkit.repositories.database_manager import DatabaseManager
|
|
10
|
-
from sqlalchemy import or_
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class TaskRepo:
|
|
14
|
-
@inject
|
|
15
|
-
def __init__(self, db_manager: DatabaseManager):
|
|
16
|
-
self.session = db_manager.get_session()
|
|
17
|
-
|
|
18
|
-
def create_task(self, new_task: Task) -> Task:
|
|
19
|
-
self.session.add(new_task)
|
|
20
|
-
self.session.commit()
|
|
21
|
-
return new_task
|
|
22
|
-
|
|
23
|
-
def update_task(self, task: Task) -> Task:
|
|
24
|
-
self.session.commit()
|
|
25
|
-
return task
|
|
26
|
-
|
|
27
|
-
def get_task_by_id(self, task_id: int):
|
|
28
|
-
return self.session.query(Task).filter_by(id=task_id).first()
|
|
29
|
-
|
|
30
|
-
def create_or_update_task_type(self, new_task_type: TaskType):
|
|
31
|
-
task_type = self.session.query(TaskType).filter_by(name=new_task_type.name).first()
|
|
32
|
-
if task_type:
|
|
33
|
-
task_type.prompt_template = new_task_type.prompt_template
|
|
34
|
-
task_type.template_args = new_task_type.template_args
|
|
35
|
-
else:
|
|
36
|
-
self.session.add(new_task_type)
|
|
37
|
-
task_type = new_task_type
|
|
38
|
-
self.session.commit()
|
|
39
|
-
return task_type
|
|
40
|
-
|
|
41
|
-
def get_task_type(self, name: str):
|
|
42
|
-
task_type = self.session.query(TaskType).filter_by(name=name).first()
|
|
43
|
-
return task_type
|
|
44
|
-
|
|
45
|
-
def get_pending_tasks(self, company_id: int):
|
|
46
|
-
now = datetime.now()
|
|
47
|
-
tasks = self.session.query(Task).filter(
|
|
48
|
-
Task.company_id == company_id,
|
|
49
|
-
Task.status == TaskStatus.pendiente,
|
|
50
|
-
or_(Task.execute_at == None, Task.execute_at <= now)
|
|
51
|
-
).all()
|
|
52
|
-
return tasks
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Fernando Libedinsky
|
|
2
|
-
# Product: IAToolkit
|
|
3
|
-
#
|
|
4
|
-
# IAToolkit is open source software.
|
|
5
|
-
|
|
6
|
-
from iatoolkit.repositories.vs_repo import VSRepo
|
|
7
|
-
from iatoolkit.repositories.document_repo import DocumentRepo
|
|
8
|
-
from iatoolkit.repositories.profile_repo import ProfileRepo
|
|
9
|
-
from iatoolkit.repositories.models import Company
|
|
10
|
-
from injector import inject
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class SearchService:
|
|
14
|
-
@inject
|
|
15
|
-
def __init__(self,
|
|
16
|
-
profile_repo: ProfileRepo,
|
|
17
|
-
doc_repo: DocumentRepo,
|
|
18
|
-
vs_repo: VSRepo):
|
|
19
|
-
self.profile_repo = profile_repo
|
|
20
|
-
self.vs_repo = vs_repo
|
|
21
|
-
self.doc_repo = doc_repo
|
|
22
|
-
|
|
23
|
-
def search(self, company_short_name: str, query: str, metadata_filter: dict = None) -> str:
|
|
24
|
-
"""
|
|
25
|
-
Performs a semantic search for a given query within a company's documents.
|
|
26
|
-
|
|
27
|
-
This method queries the vector store for relevant documents based on the
|
|
28
|
-
provided query text. It then constructs a formatted string containing the
|
|
29
|
-
content of the retrieved documents, which can be used as context for an LLM.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
company_short_name: The company to search within.
|
|
33
|
-
query: The text query to search for.
|
|
34
|
-
metadata_filter: An optional dictionary to filter documents by their metadata.
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
A string containing the concatenated content of the found documents,
|
|
38
|
-
formatted to be used as a context.
|
|
39
|
-
"""
|
|
40
|
-
company = self.profile_repo.get_company_by_short_name(company_short_name)
|
|
41
|
-
if not company:
|
|
42
|
-
return f"error: company {company_short_name} not found"
|
|
43
|
-
|
|
44
|
-
document_list = self.vs_repo.query(company_short_name=company_short_name,
|
|
45
|
-
query_text=query,
|
|
46
|
-
metadata_filter=metadata_filter)
|
|
47
|
-
|
|
48
|
-
search_context = ''
|
|
49
|
-
for doc in document_list:
|
|
50
|
-
search_context += f'documento "{doc.filename}"'
|
|
51
|
-
if doc.meta and 'document_type' in doc.meta:
|
|
52
|
-
search_context += f' tipo: {doc.meta.get('document_type', '')}'
|
|
53
|
-
search_context += f': {doc.content}\n'
|
|
54
|
-
|
|
55
|
-
return search_context
|