alita-sdk 0.3.258__py3-none-any.whl → 0.3.260__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.
@@ -72,7 +72,7 @@ def get_tools(tools_list: list, alita_client, llm, memory_store: BaseStore = Non
72
72
  bucket=tool['settings']['bucket'],
73
73
  toolkit_name=tool.get('toolkit_name', ''),
74
74
  selected_tools=tool['settings'].get('selected_tools', []),
75
- llm=tool['settings'].get('llm'),
75
+ llm=llm,
76
76
  # indexer settings
77
77
  connection_string=tool['settings'].get('connection_string', None),
78
78
  collection_name=tool.get('toolkit_name'),
@@ -9,11 +9,6 @@ from pydantic import create_model, Field, model_validator
9
9
 
10
10
  from alita_sdk.tools.elitea_base import BaseVectorStoreToolApiWrapper, extend_with_vector_tools
11
11
 
12
- try:
13
- from alita_sdk.runtime.langchain.interfaces.llm_processor import get_embeddings
14
- except ImportError:
15
- from alita_sdk.langchain.interfaces.llm_processor import get_embeddings
16
-
17
12
  class ArtifactWrapper(BaseVectorStoreToolApiWrapper):
18
13
  bucket: str
19
14
  artifact: Optional[Any] = None
@@ -133,7 +133,6 @@ How did you come up with the answer?
133
133
  class VectorStoreWrapperBase(BaseToolApiWrapper):
134
134
  llm: Any
135
135
  embedding_model: str
136
- embedding_model_params: dict
137
136
  vectorstore_type: str
138
137
  vectorstore_params: dict
139
138
  max_docs_per_add: int = 100
@@ -158,13 +157,11 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
158
157
  raise ValueError("Embedding model is required.")
159
158
  if not values.get('vectorstore_params'):
160
159
  raise ValueError("Vectorstore parameters are required.")
161
- if not values.get('embedding_model_params'):
162
- raise ValueError("Embedding model parameters are required.")
163
160
  values["dataset"] = values.get('vectorstore_params').get('collection_name')
164
161
  if not values["dataset"]:
165
162
  raise ValueError("Collection name is required.")
166
163
  if not values.get('embeddings'):
167
- values['embeddings'] = get_embeddings(values['embedding_model'], values['embedding_model_params'])
164
+ values['embeddings'] = values['alita'].get_embeddings(values['embedding_model'])
168
165
  values['vectorstore'] = get_vectorstore(values['vectorstore_type'], values['vectorstore_params'], embedding_func=values['embeddings'])
169
166
  values['vectoradapter'] = VectorAdapter(
170
167
  vectorstore=values['vectorstore'],
@@ -16,7 +16,6 @@ logger = logging.getLogger(__name__)
16
16
  BaseIndexParams = create_model(
17
17
  "BaseIndexParams",
18
18
  collection_suffix=(str, Field(description="Suffix for collection name (max 7 characters) used to separate datasets", min_length=1, max_length=7)),
19
- vectorstore_type=(Optional[str], Field(description="Vectorstore type (Chroma, PGVector, Elastic, etc.)", default="PGVector")),
20
19
  )
21
20
 
22
21
  RemoveIndexParams = create_model(
@@ -30,7 +29,6 @@ BaseSearchParams = create_model(
30
29
  collection_suffix=(Optional[str], Field(
31
30
  description="Optional suffix for collection name (max 7 characters). Leave empty to search across all datasets",
32
31
  default="", max_length=7)),
33
- vectorstore_type=(Optional[str], Field(description="Vectorstore type (Chroma, PGVector, Elastic, etc.)", default="PGVector")),
34
32
  filter=(Optional[dict | str], Field(
35
33
  description="Filter to apply to the search results. Can be a dictionary or a JSON string.",
36
34
  default={},
@@ -60,7 +58,6 @@ BaseStepbackSearchParams = create_model(
60
58
  "BaseStepbackSearchParams",
61
59
  query=(str, Field(description="Query text to search in the index")),
62
60
  collection_suffix=(Optional[str], Field(description="Optional suffix for collection name (max 7 characters)", default="", max_length=7)),
63
- vectorstore_type=(Optional[str], Field(description="Vectorstore type (Chroma, PGVector, Elastic, etc.)", default="PGVector")),
64
61
  messages=(Optional[List], Field(description="Chat messages for stepback search context", default=[])),
65
62
  filter=(Optional[dict | str], Field(
66
63
  description="Filter to apply to the search results. Can be a dictionary or a JSON string.",
@@ -107,7 +104,6 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
107
104
  connection_string: Optional[SecretStr] = None
108
105
  collection_name: Optional[str] = None
109
106
  embedding_model: Optional[str] = "HuggingFaceEmbeddings"
110
- embedding_model_params: Optional[Dict[str, Any]] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
111
107
  vectorstore_type: Optional[str] = "PGVector"
112
108
  _embedding: Optional[Any] = None
113
109
  alita: Any = None # Elitea client, if available
@@ -117,10 +113,8 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
117
113
  connection_string = conn.get_secret_value() if isinstance(conn, SecretStr) else conn
118
114
  collection_name = kwargs.get('collection_name')
119
115
 
120
- # if 'embedding_model' not in kwargs:
121
- kwargs['embedding_model'] = 'HuggingFaceEmbeddings'
122
- if 'embedding_model_params' not in kwargs:
123
- kwargs['embedding_model_params'] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
116
+ if 'embedding_model' not in kwargs:
117
+ kwargs['embedding_model'] = 'HuggingFaceEmbeddings'
124
118
  if 'vectorstore_type' not in kwargs:
125
119
  kwargs['vectorstore_type'] = 'PGVector'
126
120
  vectorstore_type = kwargs.get('vectorstore_type')
@@ -257,6 +251,16 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
257
251
  return (f"Collection '{collection_suffix}' has been removed from the vector store.\n"
258
252
  f"Available collections: {self.list_collections()}")
259
253
 
254
+ def _build_collection_filter(self, filter: dict | str, collection_suffix: str = "") -> dict:
255
+ """Builds a filter for the collection based on the provided suffix."""
256
+
257
+ filter = filter if isinstance(filter, dict) else json.loads(filter)
258
+ if collection_suffix:
259
+ filter.update({"collection": {
260
+ "$eq": collection_suffix.strip()
261
+ }})
262
+ return filter
263
+
260
264
  def search_index(self,
261
265
  query: str,
262
266
  collection_suffix: str = "",
@@ -268,12 +272,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
268
272
  **kwargs):
269
273
  """ Searches indexed documents in the vector store."""
270
274
  # build filter on top of collection_suffix
271
- filter = filter if isinstance(filter, dict) else json.loads(filter)
272
- if collection_suffix:
273
- filter.update({"collection": {
274
- "$eq": collection_suffix.strip()
275
- }})
276
-
275
+ filter = self._build_collection_filter(filter, collection_suffix)
277
276
  found_docs = super().search_documents(
278
277
  query,
279
278
  doctype=self.doctype,
@@ -298,6 +297,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
298
297
  extended_search: Optional[List[str]] = None,
299
298
  **kwargs):
300
299
  """ Searches indexed documents in the vector store."""
300
+ filter = self._build_collection_filter(filter, collection_suffix)
301
301
  found_docs = super().stepback_search(
302
302
  query,
303
303
  messages,
@@ -322,6 +322,8 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
322
322
  extended_search: Optional[List[str]] = None,
323
323
  **kwargs):
324
324
  """ Generates a summary of indexed documents using stepback technique."""
325
+
326
+ filter = self._build_collection_filter(filter, collection_suffix)
325
327
  return super().stepback_summary(
326
328
  query,
327
329
  messages,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.258
3
+ Version: 0.3.260
4
4
  Summary: SDK for building langchain agents using resources from Alita
5
5
  Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -88,12 +88,12 @@ alita_sdk/runtime/toolkits/configurations.py,sha256=kIDAlnryPQfbZyFxV-9SzN2-Vefz
88
88
  alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
89
89
  alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
90
90
  alita_sdk/runtime/toolkits/subgraph.py,sha256=ZYqI4yVLbEPAjCR8dpXbjbL2ipX598Hk3fL6AgaqFD4,1758
91
- alita_sdk/runtime/toolkits/tools.py,sha256=o_l2Md1Z0dRoBdt5jN4GTQkwcbCPTAOr0_J7hhTyo2s,8023
91
+ alita_sdk/runtime/toolkits/tools.py,sha256=kOoWkG3MQtphc7WHqtbf7WTTZ1e-kjmlrdjcAEeoHnw,7999
92
92
  alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
93
93
  alita_sdk/runtime/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
94
  alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
95
95
  alita_sdk/runtime/tools/application.py,sha256=mC2_ZFx4WLHc98Gzll88Vw6cqyx2cmbig2IeJBtHRdg,2836
96
- alita_sdk/runtime/tools/artifact.py,sha256=WpSGvGzypa5MShOv0qRC6ncEyhIzxTlR8jab5HkPDyA,8803
96
+ alita_sdk/runtime/tools/artifact.py,sha256=zm7Yo7uItxxZ8kX19xki0FA5TwP4f764rN32AXC3kiU,8617
97
97
  alita_sdk/runtime/tools/datasource.py,sha256=pvbaSfI-ThQQnjHG-QhYNSTYRnZB0rYtZFpjCfpzxYI,2443
98
98
  alita_sdk/runtime/tools/echo.py,sha256=spw9eCweXzixJqHnZofHE1yWiSUa04L4VKycf3KCEaM,486
99
99
  alita_sdk/runtime/tools/function.py,sha256=ZFpd7TGwIawze2e7BHlKwP0NHwNw42wwrmmnXyJQJhk,2600
@@ -107,7 +107,7 @@ alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9
107
107
  alita_sdk/runtime/tools/router.py,sha256=wCvZjVkdXK9dMMeEerrgKf5M790RudH68pDortnHSz0,1517
108
108
  alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
109
109
  alita_sdk/runtime/tools/vectorstore.py,sha256=yl6FKJGVQDevftSkxWTkMbqjIskIFz69vXELdEGp9u4,34780
110
- alita_sdk/runtime/tools/vectorstore_base.py,sha256=HFaNk_oBoeZWrQWBrvEsozajHqwjWxsV6RigkQyq-eQ,27586
110
+ alita_sdk/runtime/tools/vectorstore_base.py,sha256=Ko-82amS4mBoJqX-v6h-iUrQ5LNzMvM978q2i8TcfVw,27409
111
111
  alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
112
112
  alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
@@ -119,7 +119,7 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
119
119
  alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
120
120
  alita_sdk/runtime/utils/utils.py,sha256=CpEl3LCeLbhzQySz08lkKPm7Auac6IiLF7WB8wmArMI,589
121
121
  alita_sdk/tools/__init__.py,sha256=ko5TToGYZFmBrho26DRAVvrkHWxQ2sfs8gVAASinYp8,10611
122
- alita_sdk/tools/base_indexer_toolkit.py,sha256=mfPo2iWhfHg-ihMC59nCf9XTomCPqPmKAudGkbpgBSE,18193
122
+ alita_sdk/tools/base_indexer_toolkit.py,sha256=UVaTzYkWEvH9LLTaxOEOUtU98CAhcXko9uvFZjhRYd0,17957
123
123
  alita_sdk/tools/elitea_base.py,sha256=PfelIUb5YFTjDN_1jNYT9tJbjfYr11PAUrPQHyW2d5I,32830
124
124
  alita_sdk/tools/non_code_indexer_toolkit.py,sha256=v9uq1POE1fQKCd152mbqDtF-HSe0qoDj83k4E5LAkMI,1080
125
125
  alita_sdk/tools/ado/__init__.py,sha256=u2tdDgufGuDb-7lIgKKQlqgStL9Wd1gzNmRNYems2c0,1267
@@ -336,8 +336,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=HOt9ShtJI_1tVPcwd3Rwk-VS0SMLq
336
336
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
337
337
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
338
338
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
339
- alita_sdk-0.3.258.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
340
- alita_sdk-0.3.258.dist-info/METADATA,sha256=2j5Uqki3lIbS41bXwlA4RiIVvtsBROzSHIoisJhN1gc,18897
341
- alita_sdk-0.3.258.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
342
- alita_sdk-0.3.258.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
343
- alita_sdk-0.3.258.dist-info/RECORD,,
339
+ alita_sdk-0.3.260.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
340
+ alita_sdk-0.3.260.dist-info/METADATA,sha256=dRh-jEpVK5p3pK7KvE4h_JEX6qfMkaHe8F4NkOdHs8c,18897
341
+ alita_sdk-0.3.260.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
342
+ alita_sdk-0.3.260.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
343
+ alita_sdk-0.3.260.dist-info/RECORD,,