alita-sdk 0.3.375__py3-none-any.whl → 0.3.377__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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.375
3
+ Version: 0.3.377
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
@@ -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.377.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
357
+ alita_sdk-0.3.377.dist-info/METADATA,sha256=rUHtuRzi9cHmWrlCZLzi2LfWfbJ-23kMyK7nP2Y3KRs,19071
358
+ alita_sdk-0.3.377.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
359
+ alita_sdk-0.3.377.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
360
+ alita_sdk-0.3.377.dist-info/RECORD,,