alita-sdk 0.3.375__py3-none-any.whl → 0.3.376__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.

Potentially problematic release.


This version of alita-sdk might be problematic. Click here for more details.

@@ -137,11 +137,9 @@ class Assistant:
137
137
  def runnable(self):
138
138
  if self.app_type == 'pipeline':
139
139
  return self.pipeline()
140
- elif self.app_type == 'openai':
141
- return self.getOpenAIToolsAgentExecutor()
142
140
  elif self.app_type == 'xml':
143
141
  return self.getXMLAgentExecutor()
144
- elif self.app_type in ['predict', 'react']:
142
+ elif self.app_type in ['predict', 'react', 'openai']:
145
143
  return self.getLangGraphReactAgent()
146
144
  else:
147
145
  self.tools = [EchoTool()] + self.tools
@@ -241,6 +239,10 @@ class Assistant:
241
239
  # Only use prompt_instructions if explicitly specified (for predict app_type)
242
240
  if self.app_type == "predict" and isinstance(self.prompt, str):
243
241
  prompt_instructions = self.prompt
242
+
243
+ # take the system message from the openai prompt as a prompt instructions
244
+ if self.app_type == "openai" and hasattr(self.prompt, 'messages'):
245
+ prompt_instructions = self.__take_prompt_from_openai_messages()
244
246
 
245
247
  # Create a unified YAML schema with conditional tool binding
246
248
  # Build the base node configuration
@@ -341,3 +343,14 @@ class Assistant:
341
343
 
342
344
  def predict(self, messages: list[BaseMessage]):
343
345
  return self.client.invoke(messages)
346
+
347
+ def __take_prompt_from_openai_messages(self):
348
+ if self.prompt and self.prompt.messages:
349
+ for message in self.prompt.messages:
350
+ # we don't need any message placeholder from the openai agent prompt
351
+ if hasattr(message, 'variable_name'):
352
+ continue
353
+ # take only the content of the system message from the openai prompt
354
+ if isinstance(message, SystemMessage):
355
+ return message.content
356
+ return None
@@ -780,7 +780,10 @@ class LangGraphAgentRunnable(CompiledStateGraph):
780
780
 
781
781
  # Append current input to existing messages instead of overwriting
782
782
  if input.get('input'):
783
- current_message = input.get('input')[-1]
783
+ if isinstance(input['input'], str):
784
+ current_message = input['input']
785
+ else:
786
+ current_message = input.get('input')[-1]
784
787
  # TODO: add handler after we add 2+ inputs (filterByType, etc.)
785
788
  input['input'] = current_message if isinstance(current_message, str) else str(current_message)
786
789
  if input.get('messages'):
@@ -41,14 +41,21 @@ class FunctionTool(BaseTool):
41
41
  # add classes related to sandbox client
42
42
  # read the content of alita_sdk/runtime/cliens/sandbox_client.py
43
43
  try:
44
- with open('alita_sdk/runtime/clients/sandbox_client.py', 'r') as f:
44
+ import os
45
+ from pathlib import Path
46
+
47
+ # Get the directory of the current file and construct the path to sandbox_client.py
48
+ current_dir = Path(__file__).parent
49
+ sandbox_client_path = current_dir.parent / 'clients' / 'sandbox_client.py'
50
+
51
+ with open(sandbox_client_path, 'r') as f:
45
52
  sandbox_client_code = f.read()
46
53
  pyodide_predata += f"\n{sandbox_client_code}\n"
47
54
  pyodide_predata += (f"alita_client = SandboxClient(base_url='{self.alita_client.base_url}',"
48
55
  f"project_id={self.alita_client.project_id},"
49
56
  f"auth_token='{self.alita_client.auth_token}')")
50
57
  except FileNotFoundError:
51
- logger.error("sandbox_client.py not found. Ensure 'alita_sdk/runtime/clients/sandbox_client.py' exists.")
58
+ logger.error(f"sandbox_client.py not found at {sandbox_client_path}. Ensure the file exists.")
52
59
  return pyodide_predata
53
60
 
54
61
  def _handle_pyodide_output(self, tool_result: Any) -> dict:
@@ -71,8 +78,14 @@ class FunctionTool(BaseTool):
71
78
  # execute code tool and update state variables
72
79
  try:
73
80
  result_value = tool_result.get('result', {})
74
- tool_result_converted.update(result_value if isinstance(result_value, dict)
75
- else json.loads(result_value))
81
+ if isinstance(result_value, dict):
82
+ tool_result_converted.update(result_value)
83
+ elif isinstance(result_value, list):
84
+ # Handle list case - could wrap in a key or handle differently based on requirements
85
+ tool_result_converted.update({"result": result_value})
86
+ else:
87
+ # Handle JSON string case
88
+ tool_result_converted.update(json.loads(result_value))
76
89
  except json.JSONDecodeError:
77
90
  logger.error(f"JSONDecodeError: {tool_result}")
78
91
 
@@ -215,7 +215,7 @@ class VectorStoreWrapper(BaseToolApiWrapper):
215
215
  """List all collections in the vectorstore.
216
216
  Returns a list of collection names, or if no collections exist,
217
217
  returns a dict with an empty list and a message."""
218
- raw = self.vector_adapter.list_collections(self)
218
+ raw = self.vector_adapter.list_indexes(self)
219
219
  # Normalize raw result to a list of names
220
220
  if not raw:
221
221
  # No collections found
@@ -208,10 +208,10 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
208
208
  logger.error(f"Error during similarity search: {str(e)}")
209
209
  raise ToolException(f"Search failed: {str(e)}")
210
210
 
211
- def list_collections(self) -> List[str]:
211
+ def list_indexes(self) -> List[str]:
212
212
  """List all collections in the vectorstore."""
213
213
 
214
- collections = self.vector_adapter.list_collections(self)
214
+ collections = self.vector_adapter.list_indexes(self)
215
215
  if not collections:
216
216
  return "No indexed collections"
217
217
  return collections
@@ -343,7 +343,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
343
343
  """Cleans the indexed data in the collection."""
344
344
  super()._clean_collection(index_name=index_name)
345
345
  return (f"Collection '{index_name}' has been removed from the vector store.\n"
346
- f"Available collections: {self.list_collections()}") if index_name \
346
+ f"Available collections: {self.list_indexes()}") if index_name \
347
347
  else "All collections have been removed from the vector store."
348
348
 
349
349
  def _build_collection_filter(self, filter: dict | str, index_name: str = "") -> dict:
@@ -385,7 +385,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
385
385
  """ Searches indexed documents in the vector store."""
386
386
  # build filter on top of index_name
387
387
 
388
- available_collections = super().list_collections()
388
+ available_collections = super().list_indexes()
389
389
  if index_name and index_name not in available_collections:
390
390
  return f"Collection '{index_name}' not found. Available collections: {available_collections}"
391
391
 
@@ -547,10 +547,10 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
547
547
  "args_schema": RemoveIndexParams
548
548
  },
549
549
  {
550
- "name": "list_collections",
551
- "mode": "list_collections",
552
- "ref": self.list_collections,
553
- "description": self.list_collections.__doc__,
550
+ "name": "list_indexes",
551
+ "mode": "list_indexes",
552
+ "ref": self.list_indexes,
553
+ "description": self.list_indexes.__doc__,
554
554
  "args_schema": create_model("ListCollectionsParams") # No parameters
555
555
  },
556
556
  ]
@@ -17,7 +17,7 @@ from ..runtime.utils.utils import IndexerKeywords
17
17
 
18
18
  logger = logging.getLogger(__name__)
19
19
 
20
- INDEX_TOOL_NAMES = ['index_data', 'remove_index', 'list_collections', 'search_index', 'stepback_search_index',
20
+ INDEX_TOOL_NAMES = ['index_data', 'remove_index', 'list_indexes', 'search_index', 'stepback_search_index',
21
21
  'stepback_summary_index']
22
22
 
23
23
  LoaderSchema = create_model(
@@ -403,9 +403,9 @@ class BaseVectorStoreToolApiWrapper(BaseToolApiWrapper):
403
403
  """Cleans the indexed data in the collection."""
404
404
  self._init_vector_store()._clean_collection(index_name=index_name)
405
405
  return (f"Collection '{index_name}' has been removed from the vector store.\n"
406
- f"Available collections: {self.list_collections()}")
406
+ f"Available collections: {self.list_indexes()}")
407
407
 
408
- def list_collections(self):
408
+ def list_indexes(self):
409
409
  """Lists all collections in the vector store."""
410
410
  vectorstore_wrapper = self._init_vector_store()
411
411
  return vectorstore_wrapper.list_collections()
@@ -538,9 +538,9 @@ class BaseVectorStoreToolApiWrapper(BaseToolApiWrapper):
538
538
  },
539
539
  {
540
540
  "name": "list_indexes",
541
- "mode": "list_collections",
542
- "ref": self.list_collections,
543
- "description": self.list_collections.__doc__,
541
+ "mode": "list_indexes",
542
+ "ref": self.list_indexes,
543
+ "description": self.list_indexes.__doc__,
544
544
  "args_schema": create_model("ListCollectionsParams") # No parameters
545
545
  },
546
546
 
@@ -307,7 +307,7 @@ class ChromaAdapter(VectorStoreAdapter):
307
307
 
308
308
  def list_collections(self, vectorstore_wrapper) -> str:
309
309
  vector_client = vectorstore_wrapper.vectorstore._client
310
- return ','.join([collection.name for collection in vector_client.list_collections()])
310
+ return ','.join([collection.name for collection in vector_client.list_indexes()])
311
311
 
312
312
  def remove_collection(self, vectorstore_wrapper, collection_name: str):
313
313
  vectorstore_wrapper.vectorstore.delete_collection()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.375
3
+ Version: 0.3.376
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 <lifedj27@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -41,11 +41,11 @@ alita_sdk/runtime/clients/datasource.py,sha256=HAZovoQN9jBg0_-lIlGBQzb4FJdczPhkH
41
41
  alita_sdk/runtime/clients/prompt.py,sha256=li1RG9eBwgNK_Qf0qUaZ8QNTmsncFrAL2pv3kbxZRZg,1447
42
42
  alita_sdk/runtime/clients/sandbox_client.py,sha256=OhEasE0MxBBDw4o76xkxVCpNpr3xJ8spQsrsVxMrjUA,16192
43
43
  alita_sdk/runtime/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
- alita_sdk/runtime/langchain/assistant.py,sha256=YsxYNoaEidV02VlPwccdHP7PKeRRPp9M3tvUiYIDQ-I,15514
44
+ alita_sdk/runtime/langchain/assistant.py,sha256=rCtlB4Yuf9Sl-SSurUpALB4ETdADpGrdTngtbM7Aj3A,16184
45
45
  alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
46
46
  alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
47
47
  alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
48
- alita_sdk/runtime/langchain/langraph_agent.py,sha256=R4h_m_7NUgays7lt-F9WvKEOnGr1Yz7OgrmLMiGxurQ,48530
48
+ alita_sdk/runtime/langchain/langraph_agent.py,sha256=dUnyIAKe6i96cYeqHKPCiv40OFnKzwrxKgBQHyNPyLI,48649
49
49
  alita_sdk/runtime/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
50
50
  alita_sdk/runtime/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
51
51
  alita_sdk/runtime/langchain/store_manager.py,sha256=i8Fl11IXJhrBXq1F1ukEVln57B1IBe-tqSUvfUmBV4A,2218
@@ -110,7 +110,7 @@ alita_sdk/runtime/tools/application.py,sha256=z3vLZODs-_xEEnZFmGF0fKz1j3VtNJxqsA
110
110
  alita_sdk/runtime/tools/artifact.py,sha256=u3szFwZqguHrPZ3tZJ7S_TiZl7cxlT3oHYd6zbdpRDE,13842
111
111
  alita_sdk/runtime/tools/datasource.py,sha256=pvbaSfI-ThQQnjHG-QhYNSTYRnZB0rYtZFpjCfpzxYI,2443
112
112
  alita_sdk/runtime/tools/echo.py,sha256=spw9eCweXzixJqHnZofHE1yWiSUa04L4VKycf3KCEaM,486
113
- alita_sdk/runtime/tools/function.py,sha256=0JL9D9NP31uzZ1G5br4Dhfop77l1wiqjx-7L8PHK4PA,6349
113
+ alita_sdk/runtime/tools/function.py,sha256=eTq4em9N1-6CrZ4CZQ4eLZt1kMdY4o7Q3LOUaxzz760,6928
114
114
  alita_sdk/runtime/tools/graph.py,sha256=MbnZYqdmvZY7SGDp43lOVVIjUt5ARHSgj43mdtBjSjQ,3092
115
115
  alita_sdk/runtime/tools/image_generation.py,sha256=8ZH4SoRrbS4EzmtF6cpNMRvuFephCYD2S8uqNC9KGE4,4274
116
116
  alita_sdk/runtime/tools/indexer_tool.py,sha256=whSLPevB4WD6dhh2JDXEivDmTvbjiMV1MrPl9cz5eLA,4375
@@ -123,8 +123,8 @@ alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9
123
123
  alita_sdk/runtime/tools/router.py,sha256=p7e0tX6YAWw2M2Nq0A_xqw1E2P-Xz1DaJvhUstfoZn4,1584
124
124
  alita_sdk/runtime/tools/sandbox.py,sha256=0OjCNsDVO1N0cFNEFVr6GVICSaqGWesUzF6LcYg-Hn0,11349
125
125
  alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
126
- alita_sdk/runtime/tools/vectorstore.py,sha256=FsnxdnvMK5bUEFxz0eeSHeNpVOk2gxOeXjoSlvCo8rs,34327
127
- alita_sdk/runtime/tools/vectorstore_base.py,sha256=lNz6bOMpHOY8JiHT7BkoDbyj3kLykcKlCx4zOu_IgPE,28252
126
+ alita_sdk/runtime/tools/vectorstore.py,sha256=iRiB1VDDrgEJ4JmgsPtbkY6qldDfRci7spcikLFdY_U,34323
127
+ alita_sdk/runtime/tools/vectorstore_base.py,sha256=7F_kpDkuVvkurCS2Z5oMKWnVjbzmli-D-gz3jXVCrVI,28244
128
128
  alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
129
129
  alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
130
130
  alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
@@ -136,9 +136,9 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
136
136
  alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
137
137
  alita_sdk/runtime/utils/utils.py,sha256=BVEVLkYiiotcUD0XsHyx-wACpHfALsQg7PLZpObqvK8,1008
138
138
  alita_sdk/tools/__init__.py,sha256=jUj1ztC2FbkIUB-YYmiqaz_rqW7Il5kWzDPn1mJmj5w,10545
139
- alita_sdk/tools/base_indexer_toolkit.py,sha256=_Q8K5fVg5gBFlZ94wYvBrPWJ56VobnNrfr15Knyobu4,26632
139
+ alita_sdk/tools/base_indexer_toolkit.py,sha256=ZYQONHUjrpK_UBd2HU14WpE0QYECKSnzDD32ey_Xc4A,26608
140
140
  alita_sdk/tools/code_indexer_toolkit.py,sha256=p3zVnCnQTUf7JUGra9Rl6GEK2W1-hvvz0Xsgz0v0muM,7292
141
- alita_sdk/tools/elitea_base.py,sha256=nV4sNVctJGgLqWTrqkI2iMc07k69GQ6uF5hXrLmsshg,34413
141
+ alita_sdk/tools/elitea_base.py,sha256=jbgWUXHif0CS2dTZj87cPX_17dGk_WvYkjDwn1x4AwA,34389
142
142
  alita_sdk/tools/non_code_indexer_toolkit.py,sha256=6Lrqor1VeSLbPLDHAfg_7UAUqKFy1r_n6bdsc4-ak98,1315
143
143
  alita_sdk/tools/ado/__init__.py,sha256=NnNYpNFW0_N_v1td_iekYOoQRRB7PIunbpT2f9ZFJM4,1201
144
144
  alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
@@ -332,7 +332,7 @@ alita_sdk/tools/testrail/api_wrapper.py,sha256=tQcGlFJmftvs5ZiO4tsP19fCo4CrJeq_U
332
332
  alita_sdk/tools/utils/__init__.py,sha256=xB9OQgW65DftadrSpoAAitnEIbIXZKBOCji0NDe7FRM,3923
333
333
  alita_sdk/tools/utils/available_tools_decorator.py,sha256=IbrdfeQkswxUFgvvN7-dyLMZMyXLiwvX7kgi3phciCk,273
334
334
  alita_sdk/tools/utils/content_parser.py,sha256=7ohj8HeL_-rmc-Fv0TS8IpxIQC8tOpfuhyT3XlWx-gQ,15368
335
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py,sha256=eDezsk41b5ql3CISQ6Xk-qE3foO-PjY0VSWeZnVxHPE,19019
335
+ alita_sdk/tools/vector_adapters/VectorStoreAdapter.py,sha256=TmMgrvmUUP7pWAH0iEaHkMH6fwNsU_X44AFmotqXaHY,19015
336
336
  alita_sdk/tools/vector_adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
337
  alita_sdk/tools/xray/__init__.py,sha256=eOMWP8VamFbbJgt1xrGpGPqB9ByOTA0Cd3LCaETzGk4,4376
338
338
  alita_sdk/tools/xray/api_wrapper.py,sha256=uj5kzUgPdo_Oct9WCNMOpkb6o_3L7J4LZrEGtrwYMmc,30157
@@ -353,8 +353,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
353
353
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
354
354
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
355
355
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
356
- alita_sdk-0.3.375.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
357
- alita_sdk-0.3.375.dist-info/METADATA,sha256=h4sLfds9uE3O5UTOZL6pzbssZ3EDLx9szzmV_y60L-Q,19071
358
- alita_sdk-0.3.375.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
359
- alita_sdk-0.3.375.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
360
- alita_sdk-0.3.375.dist-info/RECORD,,
356
+ alita_sdk-0.3.376.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
357
+ alita_sdk-0.3.376.dist-info/METADATA,sha256=zOktQPOXmbGzvlxCp6JnqppE-1adGSuHWO8GuBSA0mk,19071
358
+ alita_sdk-0.3.376.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
359
+ alita_sdk-0.3.376.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
360
+ alita_sdk-0.3.376.dist-info/RECORD,,