alita-sdk 0.3.322__py3-none-any.whl → 0.3.323__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.
- alita_sdk/runtime/langchain/langraph_agent.py +14 -6
- alita_sdk/runtime/tools/application.py +2 -1
- alita_sdk/runtime/tools/llm.py +19 -19
- alita_sdk/tools/figma/api_wrapper.py +24 -1
- {alita_sdk-0.3.322.dist-info → alita_sdk-0.3.323.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.322.dist-info → alita_sdk-0.3.323.dist-info}/RECORD +9 -9
- {alita_sdk-0.3.322.dist-info → alita_sdk-0.3.323.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.322.dist-info → alita_sdk-0.3.323.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.322.dist-info → alita_sdk-0.3.323.dist-info}/top_level.txt +0 -0
|
@@ -584,11 +584,19 @@ def create_graph(
|
|
|
584
584
|
entry_point = clean_string(schema['entry_point'])
|
|
585
585
|
except KeyError:
|
|
586
586
|
raise ToolException("Entry point is not defined in the schema. Please define 'entry_point' in the schema.")
|
|
587
|
-
if state.items():
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
587
|
+
# if state.items():
|
|
588
|
+
# state_default_node = StateDefaultNode(default_vars=set_defaults(state))
|
|
589
|
+
# lg_builder.add_node(state_default_node.name, state_default_node)
|
|
590
|
+
# lg_builder.set_entry_point(state_default_node.name)
|
|
591
|
+
# lg_builder.add_conditional_edges(state_default_node.name, TransitionalEdge(entry_point))
|
|
592
|
+
for key, value in state.items():
|
|
593
|
+
if 'type' in value and 'value' in value:
|
|
594
|
+
# set default value for state variable if it is defined in the schema
|
|
595
|
+
state_default_node = StateDefaultNode(default_vars=state)
|
|
596
|
+
lg_builder.add_node(state_default_node.name, state_default_node)
|
|
597
|
+
lg_builder.set_entry_point(state_default_node.name)
|
|
598
|
+
lg_builder.add_conditional_edges(state_default_node.name, TransitionalEdge(entry_point))
|
|
599
|
+
break
|
|
592
600
|
else:
|
|
593
601
|
# if no state variables are defined, set the entry point directly
|
|
594
602
|
lg_builder.set_entry_point(entry_point)
|
|
@@ -694,7 +702,7 @@ class LangGraphAgentRunnable(CompiledStateGraph):
|
|
|
694
702
|
|
|
695
703
|
# Append current input to existing messages instead of overwriting
|
|
696
704
|
if input.get('input'):
|
|
697
|
-
current_message =
|
|
705
|
+
current_message = input.get('input')[-1]
|
|
698
706
|
if input.get('messages'):
|
|
699
707
|
# Ensure existing messages are LangChain objects
|
|
700
708
|
input['messages'] = [convert_dict_to_message(msg) for msg in input['messages']]
|
|
@@ -31,7 +31,8 @@ def formulate_query(kwargs):
|
|
|
31
31
|
chat_history = []
|
|
32
32
|
for each in kwargs.get('chat_history')[:]:
|
|
33
33
|
chat_history.append(AIMessage(each))
|
|
34
|
-
|
|
34
|
+
input_message = AIMessage(content=kwargs.get('task'))
|
|
35
|
+
result = {"input": [input_message], "chat_history": chat_history}
|
|
35
36
|
for key, value in kwargs.items():
|
|
36
37
|
if key not in ("task", "chat_history"):
|
|
37
38
|
result[key] = value
|
alita_sdk/runtime/tools/llm.py
CHANGED
|
@@ -14,8 +14,7 @@ logger = logging.getLogger(__name__)
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def create_llm_input_with_messages(
|
|
17
|
-
prompt: Dict[str, str],
|
|
18
|
-
messages: List[BaseMessage],
|
|
17
|
+
prompt: Dict[str, str],
|
|
19
18
|
params: Dict[str, Any]
|
|
20
19
|
) -> List[BaseMessage]:
|
|
21
20
|
"""
|
|
@@ -23,13 +22,12 @@ def create_llm_input_with_messages(
|
|
|
23
22
|
|
|
24
23
|
Args:
|
|
25
24
|
prompt: The prompt configuration with template
|
|
26
|
-
messages: List of chat history messages
|
|
27
25
|
params: Additional parameters for prompt formatting
|
|
28
26
|
|
|
29
27
|
Returns:
|
|
30
28
|
List of messages to send to LLM
|
|
31
29
|
"""
|
|
32
|
-
logger.info(f"Creating LLM input with
|
|
30
|
+
logger.info(f"Creating LLM input with params: {params}")
|
|
33
31
|
|
|
34
32
|
# Build the input messages
|
|
35
33
|
input_messages = []
|
|
@@ -47,9 +45,13 @@ def create_llm_input_with_messages(
|
|
|
47
45
|
raise ToolException(error_msg)
|
|
48
46
|
|
|
49
47
|
# Add the chat history messages
|
|
48
|
+
messages = params.get('messages', [])
|
|
50
49
|
if messages:
|
|
51
50
|
input_messages.extend(messages)
|
|
52
|
-
|
|
51
|
+
else:
|
|
52
|
+
# conditionally add a default human message if no chat history
|
|
53
|
+
input_messages.extend([HumanMessage(content="Reply to this message.")])
|
|
54
|
+
|
|
53
55
|
return input_messages
|
|
54
56
|
|
|
55
57
|
|
|
@@ -124,12 +126,13 @@ class LLMNode(BaseTool):
|
|
|
124
126
|
# Create parameters for prompt formatting from state
|
|
125
127
|
params = {}
|
|
126
128
|
if isinstance(state, dict):
|
|
127
|
-
for var in self.input_variables or []
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
params = {var: state[var] for var in (self.input_variables or []) if var != "messages" and var in state}
|
|
130
|
+
# message as a part of chat history added ONLY if "messages" is in input_variables
|
|
131
|
+
if "messages" in (self.input_variables or []):
|
|
132
|
+
params["messages"] = messages
|
|
130
133
|
|
|
131
134
|
# Create LLM input with proper message handling
|
|
132
|
-
llm_input = create_llm_input_with_messages(self.prompt,
|
|
135
|
+
llm_input = create_llm_input_with_messages(self.prompt, params)
|
|
133
136
|
|
|
134
137
|
# Get the LLM client, potentially with tools bound
|
|
135
138
|
llm_client = self.client
|
|
@@ -268,17 +271,14 @@ class LLMNode(BaseTool):
|
|
|
268
271
|
if json_output_vars:
|
|
269
272
|
try:
|
|
270
273
|
response = _extract_json(content) or {}
|
|
271
|
-
response_data = {key: response.get(key) for key in json_output_vars
|
|
272
|
-
|
|
273
|
-
# Always add the messages to the response
|
|
274
|
-
new_messages = messages + [AIMessage(content=content)]
|
|
275
|
-
response_data['messages'] = new_messages
|
|
276
|
-
|
|
277
|
-
return response_data
|
|
274
|
+
response_data = {key: response.get(key, content) for key in json_output_vars}
|
|
278
275
|
except (ValueError, json.JSONDecodeError) as e:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
logger.warning(
|
|
277
|
+
f"Expected JSON output but got plain text. Output variables specified: {json_output_vars}. Error: {e}")
|
|
278
|
+
response_data = {var: content for var in json_output_vars}
|
|
279
|
+
new_messages = messages + [AIMessage(content=content)]
|
|
280
|
+
response_data['messages'] = new_messages
|
|
281
|
+
return response_data
|
|
282
282
|
|
|
283
283
|
# Simple text response (either no output variables or JSON parsing failed)
|
|
284
284
|
new_messages = messages + [AIMessage(content=content)]
|
|
@@ -4,6 +4,7 @@ import logging
|
|
|
4
4
|
import re
|
|
5
5
|
from enum import Enum
|
|
6
6
|
from typing import Dict, List, Generator, Optional, Union
|
|
7
|
+
from urllib.parse import urlparse, parse_qs
|
|
7
8
|
|
|
8
9
|
import requests
|
|
9
10
|
from FigmaPy import FigmaPy
|
|
@@ -238,6 +239,7 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
|
238
239
|
|
|
239
240
|
def _base_loader(
|
|
240
241
|
self,
|
|
242
|
+
file_or_page_url: Optional[str] = None,
|
|
241
243
|
project_id: Optional[str] = None,
|
|
242
244
|
file_keys_include: Optional[List[str]] = None,
|
|
243
245
|
file_keys_exclude: Optional[List[str]] = None,
|
|
@@ -247,6 +249,24 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
|
247
249
|
node_types_exclude: Optional[List[str]] = None,
|
|
248
250
|
**kwargs
|
|
249
251
|
) -> Generator[Document, None, None]:
|
|
252
|
+
if file_or_page_url:
|
|
253
|
+
# If URL is provided and valid, extract and override file_keys_include and node_ids_include
|
|
254
|
+
try:
|
|
255
|
+
parsed = urlparse(file_or_page_url)
|
|
256
|
+
path_parts = parsed.path.strip('/').split('/')
|
|
257
|
+
|
|
258
|
+
# Check if the path matches the expected format
|
|
259
|
+
if len(path_parts) >= 2 and path_parts[0] == 'design':
|
|
260
|
+
file_keys_include = [path_parts[1]]
|
|
261
|
+
if len(path_parts) == 3:
|
|
262
|
+
# To ensure url structure matches Figma's format with 3 path segments
|
|
263
|
+
query_params = parse_qs(parsed.query)
|
|
264
|
+
if "node-id" in query_params:
|
|
265
|
+
node_ids_include = query_params.get('node-id', [])
|
|
266
|
+
except Exception as e:
|
|
267
|
+
raise ToolException(
|
|
268
|
+
f"Unexpected error while processing Figma url {file_or_page_url}: {e}")
|
|
269
|
+
|
|
250
270
|
# If both include and exclude are provided, use only include
|
|
251
271
|
if file_keys_include:
|
|
252
272
|
self._log_tool_event(f"Loading files: {file_keys_include}")
|
|
@@ -364,8 +384,11 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
|
364
384
|
def _index_tool_params(self):
|
|
365
385
|
"""Return the parameters for indexing data."""
|
|
366
386
|
return {
|
|
387
|
+
"file_or_page_url": (Optional[str], Field(
|
|
388
|
+
description="Url to file or page to index: i.e. https://www.figma.com/design/[YOUR_FILE_KEY]/Login-page-designs?node-id=[YOUR_PAGE_ID]",
|
|
389
|
+
default=None)),
|
|
367
390
|
"project_id": (Optional[str], Field(
|
|
368
|
-
description="ID of the project to list files from: i.e. 55391681
|
|
391
|
+
description="ID of the project to list files from: i.e. 55391681",
|
|
369
392
|
default=None)),
|
|
370
393
|
'file_keys_include': (Optional[List[str]], Field(
|
|
371
394
|
description="List of file keys to include in index if project_id is not provided: i.e. ['Fp24FuzPwH0L74ODSrCnQo', 'jmhAr6q78dJoMRqt48zisY']",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.323
|
|
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
|
|
@@ -44,7 +44,7 @@ alita_sdk/runtime/langchain/assistant.py,sha256=1Eq8BIefp8suhbC9CssoOXtC-plkemoU
|
|
|
44
44
|
alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
|
|
45
45
|
alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
|
|
46
46
|
alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
|
|
47
|
-
alita_sdk/runtime/langchain/langraph_agent.py,sha256=
|
|
47
|
+
alita_sdk/runtime/langchain/langraph_agent.py,sha256=jbUlqWFly055uSu0pe0qfUvi5L4CoSUCyMHUFVyNMck,44818
|
|
48
48
|
alita_sdk/runtime/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
|
|
49
49
|
alita_sdk/runtime/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
|
|
50
50
|
alita_sdk/runtime/langchain/store_manager.py,sha256=i8Fl11IXJhrBXq1F1ukEVln57B1IBe-tqSUvfUmBV4A,2218
|
|
@@ -105,14 +105,14 @@ alita_sdk/runtime/toolkits/tools.py,sha256=Ea3LO6voPNysdzVB7jYMZIqSMtda7LCq_6fkV
|
|
|
105
105
|
alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
|
|
106
106
|
alita_sdk/runtime/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
107
107
|
alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
|
|
108
|
-
alita_sdk/runtime/tools/application.py,sha256=
|
|
108
|
+
alita_sdk/runtime/tools/application.py,sha256=j6H2OFteb7h2Yhxk1ipA-i5g3BvfmTfPuMxbfLPEa0E,2891
|
|
109
109
|
alita_sdk/runtime/tools/artifact.py,sha256=yIn-kfI9OWoaxbBeqdqF0M1HPeMtNnvZ_pCPoUIwnCk,8708
|
|
110
110
|
alita_sdk/runtime/tools/datasource.py,sha256=pvbaSfI-ThQQnjHG-QhYNSTYRnZB0rYtZFpjCfpzxYI,2443
|
|
111
111
|
alita_sdk/runtime/tools/echo.py,sha256=spw9eCweXzixJqHnZofHE1yWiSUa04L4VKycf3KCEaM,486
|
|
112
112
|
alita_sdk/runtime/tools/function.py,sha256=ZFpd7TGwIawze2e7BHlKwP0NHwNw42wwrmmnXyJQJhk,2600
|
|
113
113
|
alita_sdk/runtime/tools/graph.py,sha256=MbnZYqdmvZY7SGDp43lOVVIjUt5ARHSgj43mdtBjSjQ,3092
|
|
114
114
|
alita_sdk/runtime/tools/indexer_tool.py,sha256=whSLPevB4WD6dhh2JDXEivDmTvbjiMV1MrPl9cz5eLA,4375
|
|
115
|
-
alita_sdk/runtime/tools/llm.py,sha256=
|
|
115
|
+
alita_sdk/runtime/tools/llm.py,sha256=lVg8t785JLrB2kwIQjpigfhZZP9-BRu-SEUQw6DQyh8,15128
|
|
116
116
|
alita_sdk/runtime/tools/loop.py,sha256=uds0WhZvwMxDVFI6MZHrcmMle637cQfBNg682iLxoJA,8335
|
|
117
117
|
alita_sdk/runtime/tools/loop_output.py,sha256=U4hO9PCQgWlXwOq6jdmCGbegtAxGAPXObSxZQ3z38uk,8069
|
|
118
118
|
alita_sdk/runtime/tools/mcp_server_tool.py,sha256=trGraI8-AwdbNmTKMjfmlBxgTDMTE4-21heCVtd_lz0,4156
|
|
@@ -235,7 +235,7 @@ alita_sdk/tools/custom_open_api/api_wrapper.py,sha256=sDSFpvEqpSvXHGiBISdQQcUecf
|
|
|
235
235
|
alita_sdk/tools/elastic/__init__.py,sha256=iwnSRppRpzvJ1da2K3Glu8Uu41MhBDCYbguboLkEbW0,2818
|
|
236
236
|
alita_sdk/tools/elastic/api_wrapper.py,sha256=pl8CqQxteJAGwyOhMcld-ZgtOTFwwbv42OITQVe8rM0,1948
|
|
237
237
|
alita_sdk/tools/figma/__init__.py,sha256=W6vIMMkZI2Lmpg6_CRRV3oadaIbVI-qTLmKUh6enqWs,4509
|
|
238
|
-
alita_sdk/tools/figma/api_wrapper.py,sha256=
|
|
238
|
+
alita_sdk/tools/figma/api_wrapper.py,sha256=SFuvjhxYgey1qGsO9sakFpY1bK1RSzgAH-uJsAp7FnE,27477
|
|
239
239
|
alita_sdk/tools/github/__init__.py,sha256=2rHu0zZyZGnLC5CkHgDIhe14N9yCyaEfrrt7ydH8478,5191
|
|
240
240
|
alita_sdk/tools/github/api_wrapper.py,sha256=uDwYckdnpYRJtb0uZnDkaz2udvdDLVxuCh1tSwspsiU,8411
|
|
241
241
|
alita_sdk/tools/github/github_client.py,sha256=nxnSXsDul2PPbWvYZS8TmAFFmR-5ALyakNoV5LN2D4U,86617
|
|
@@ -349,8 +349,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
|
|
|
349
349
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
|
|
350
350
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
|
351
351
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
|
352
|
-
alita_sdk-0.3.
|
|
353
|
-
alita_sdk-0.3.
|
|
354
|
-
alita_sdk-0.3.
|
|
355
|
-
alita_sdk-0.3.
|
|
356
|
-
alita_sdk-0.3.
|
|
352
|
+
alita_sdk-0.3.323.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
353
|
+
alita_sdk-0.3.323.dist-info/METADATA,sha256=H6Stzos-D6Mw5ie9tVXbVrUWFhIZOHkJbE8Jz-dGHao,18897
|
|
354
|
+
alita_sdk-0.3.323.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
355
|
+
alita_sdk-0.3.323.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
|
356
|
+
alita_sdk-0.3.323.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|