iatoolkit 0.71.2__py3-none-any.whl → 0.71.4__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/iatoolkit.py +1 -1
- iatoolkit/services/embedding_service.py +36 -37
- {iatoolkit-0.71.2.dist-info → iatoolkit-0.71.4.dist-info}/METADATA +1 -1
- {iatoolkit-0.71.2.dist-info → iatoolkit-0.71.4.dist-info}/RECORD +7 -7
- {iatoolkit-0.71.2.dist-info → iatoolkit-0.71.4.dist-info}/WHEEL +0 -0
- {iatoolkit-0.71.2.dist-info → iatoolkit-0.71.4.dist-info}/licenses/LICENSE +0 -0
- {iatoolkit-0.71.2.dist-info → iatoolkit-0.71.4.dist-info}/top_level.txt +0 -0
iatoolkit/iatoolkit.py
CHANGED
|
@@ -19,7 +19,7 @@ from werkzeug.middleware.proxy_fix import ProxyFix
|
|
|
19
19
|
from injector import Binder, Injector, singleton
|
|
20
20
|
from importlib.metadata import version as _pkg_version, PackageNotFoundError
|
|
21
21
|
|
|
22
|
-
IATOOLKIT_VERSION = "0.71.
|
|
22
|
+
IATOOLKIT_VERSION = "0.71.4"
|
|
23
23
|
|
|
24
24
|
# global variable for the unique instance of IAToolkit
|
|
25
25
|
_iatoolkit_instance: Optional['IAToolkit'] = None
|
|
@@ -50,7 +50,6 @@ class EmbeddingClientFactory:
|
|
|
50
50
|
def __init__(self, config_service: ConfigurationService):
|
|
51
51
|
self.config_service = config_service
|
|
52
52
|
self._clients = {} # Cache for storing initialized client wrappers
|
|
53
|
-
self._lock = Lock()
|
|
54
53
|
|
|
55
54
|
def get_client(self, company_short_name: str) -> EmbeddingClientWrapper:
|
|
56
55
|
"""
|
|
@@ -60,42 +59,42 @@ class EmbeddingClientFactory:
|
|
|
60
59
|
if company_short_name in self._clients:
|
|
61
60
|
return self._clients[company_short_name]
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
62
|
+
# Get the embedding provider and model from the company.yaml
|
|
63
|
+
embedding_config = self.config_service.get_configuration(company_short_name, 'embedding_provider')
|
|
64
|
+
if not embedding_config:
|
|
65
|
+
raise ValueError(f"Embedding provider not configured for company '{company_short_name}'.")
|
|
66
|
+
|
|
67
|
+
provider = embedding_config.get('provider')
|
|
68
|
+
if not provider:
|
|
69
|
+
raise ValueError(f"Embedding provider not configured for company '{company_short_name}'.")
|
|
70
|
+
model = embedding_config.get('model')
|
|
71
|
+
|
|
72
|
+
api_key_name = embedding_config.get('api_key_name')
|
|
73
|
+
if not api_key_name:
|
|
74
|
+
raise ValueError(f"Missiong configuration for embedding_provider:api_key_name en config.yaml.")
|
|
75
|
+
|
|
76
|
+
api_key = os.getenv(api_key_name)
|
|
77
|
+
if not api_key:
|
|
78
|
+
raise ValueError(f"Environment variable '{api_key_name}' is not set.")
|
|
79
|
+
|
|
80
|
+
# Logic to handle multiple providers
|
|
81
|
+
wrapper = None
|
|
82
|
+
if provider == 'huggingface':
|
|
83
|
+
if not model:
|
|
84
|
+
model='sentence-transformers/all-MiniLM-L6-v2'
|
|
85
|
+
client = InferenceClient(model=model, token=api_key)
|
|
86
|
+
wrapper = HuggingFaceClientWrapper(client, model)
|
|
87
|
+
elif provider == 'openai':
|
|
88
|
+
client = OpenAI(api_key=api_key)
|
|
89
|
+
if not model:
|
|
90
|
+
model='text-embedding-ada-002'
|
|
91
|
+
wrapper = OpenAIClientWrapper(client, model)
|
|
92
|
+
else:
|
|
93
|
+
raise NotImplementedError(f"Embedding provider '{provider}' is not implemented.")
|
|
94
|
+
|
|
95
|
+
logging.debug(f"Embedding client for '{company_short_name}' created with model: {model} via {provider}")
|
|
96
|
+
self._clients[company_short_name] = wrapper
|
|
97
|
+
return wrapper
|
|
99
98
|
|
|
100
99
|
class EmbeddingService:
|
|
101
100
|
"""
|
|
@@ -2,7 +2,7 @@ iatoolkit/__init__.py,sha256=lWMmZiXzVqOAD2cnLZTjoX5_EMoDljjU7oAZTQbKu5c,951
|
|
|
2
2
|
iatoolkit/base_company.py,sha256=U0KWZf7zLrJCw87NrEt2MCCHfd78HS22D7ht_BLeoL0,3522
|
|
3
3
|
iatoolkit/cli_commands.py,sha256=bTn4iXiDM4P2Nyn6oPT2wCL4pUQy34hVTL6c4fyEQdY,2303
|
|
4
4
|
iatoolkit/company_registry.py,sha256=NAsrCJyvgkdG8yGfqA7EdPUTHDzzcPzKu0PKXniub50,2490
|
|
5
|
-
iatoolkit/iatoolkit.py,sha256=
|
|
5
|
+
iatoolkit/iatoolkit.py,sha256=Svj5NGzx5JpI_KXC-Z6DY5y8aBKweoDfj7vYJIN4K6A,19439
|
|
6
6
|
iatoolkit/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
iatoolkit/common/exceptions.py,sha256=EXx40n5htp7UiOM6P1xfJ9U6NMcADqm62dlFaKz7ICU,1154
|
|
8
8
|
iatoolkit/common/routes.py,sha256=oFL8ivzenGpNgiDjV0pda_NRZ5XrlEHSIHPWW53zj8k,6529
|
|
@@ -43,7 +43,7 @@ iatoolkit/services/company_context_service.py,sha256=ME9dshCY1J1L6Kz_anrvoSfWy2Z
|
|
|
43
43
|
iatoolkit/services/configuration_service.py,sha256=TmWRqne9M9vf06c9_Hlfc8VMB--s99iK39hf8JSyO3k,5746
|
|
44
44
|
iatoolkit/services/dispatcher_service.py,sha256=wHZV4AU4okYKuFwH5afB3ktYDE2Ej4XVvxmUlL-IsmM,12635
|
|
45
45
|
iatoolkit/services/document_service.py,sha256=whW3B9g7lCaNOqezYmoHkSAov0K7EH90u-KVANO0mPg,6057
|
|
46
|
-
iatoolkit/services/embedding_service.py,sha256=
|
|
46
|
+
iatoolkit/services/embedding_service.py,sha256=wVW2OXT26KPwiAzFmBAi2gHuq-vY0UFhX_SBuq8RLks,6043
|
|
47
47
|
iatoolkit/services/excel_service.py,sha256=MGVFjSo1NOL8PL7_hVgEEFzvXfA4NmF-JFEr8FBSjOA,4090
|
|
48
48
|
iatoolkit/services/file_processor_service.py,sha256=h8Tg2Xwvjv_HOIUo51Rnu5H4tUmkJ8W9tKvmFfgKPms,3792
|
|
49
49
|
iatoolkit/services/history_service.py,sha256=HoJs5CRpXturrdycznlalL6TOPbzC2npziTs86mOIkg,1375
|
|
@@ -115,8 +115,8 @@ iatoolkit/views/tasks_api_view.py,sha256=wGnuwuuL83ByQ1Yre6ytRVztA0OGQjGrwMjB1_G
|
|
|
115
115
|
iatoolkit/views/tasks_review_api_view.py,sha256=wsCpzqyRyUdCXWAhyGlBe3eNZZ6A1DQG7TblN_GZNfM,1894
|
|
116
116
|
iatoolkit/views/user_feedback_api_view.py,sha256=QOTBtpNqYAmewXDgVAoaIprnVjvf1xM0ExWxSFp3ICI,2098
|
|
117
117
|
iatoolkit/views/verify_user_view.py,sha256=TTC9BNjyjT8ZT5KnQ2f5-8UF1Y_sJII2wJ501xWSFvY,2653
|
|
118
|
-
iatoolkit-0.71.
|
|
119
|
-
iatoolkit-0.71.
|
|
120
|
-
iatoolkit-0.71.
|
|
121
|
-
iatoolkit-0.71.
|
|
122
|
-
iatoolkit-0.71.
|
|
118
|
+
iatoolkit-0.71.4.dist-info/licenses/LICENSE,sha256=5tOLQdjoCvSXEx_7Lr4bSab3ha4NSwzamvua0fwCXi8,1075
|
|
119
|
+
iatoolkit-0.71.4.dist-info/METADATA,sha256=7leXcUn7QdAkVAk-d3XTd18X-jNcisMR7-PtZw1JXZg,9963
|
|
120
|
+
iatoolkit-0.71.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
121
|
+
iatoolkit-0.71.4.dist-info/top_level.txt,sha256=V_w4QvDx0b1RXiy8zTCrD1Bp7AZkFe3_O0-9fMiwogg,10
|
|
122
|
+
iatoolkit-0.71.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|