alita-sdk 0.3.398__py3-none-any.whl → 0.3.400__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/clients/client.py +3 -2
- alita_sdk/runtime/langchain/assistant.py +3 -2
- alita_sdk/runtime/toolkits/tools.py +72 -63
- alita_sdk/tools/code_indexer_toolkit.py +3 -3
- {alita_sdk-0.3.398.dist-info → alita_sdk-0.3.400.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.398.dist-info → alita_sdk-0.3.400.dist-info}/RECORD +9 -9
- {alita_sdk-0.3.398.dist-info → alita_sdk-0.3.400.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.398.dist-info → alita_sdk-0.3.400.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.398.dist-info → alita_sdk-0.3.400.dist-info}/top_level.txt +0 -0
|
@@ -568,7 +568,7 @@ class AlitaClient:
|
|
|
568
568
|
def predict_agent(self, llm: ChatOpenAI, instructions: str = "You are a helpful assistant.",
|
|
569
569
|
tools: Optional[list] = None, chat_history: Optional[List[Any]] = None,
|
|
570
570
|
memory=None, runtime='langchain', variables: Optional[list] = None,
|
|
571
|
-
store: Optional[BaseStore] = None):
|
|
571
|
+
store: Optional[BaseStore] = None, debug_mode: Optional[bool] = False):
|
|
572
572
|
"""
|
|
573
573
|
Create a predict-type agent with minimal configuration.
|
|
574
574
|
|
|
@@ -581,6 +581,7 @@ class AlitaClient:
|
|
|
581
581
|
runtime: Runtime type (default: 'langchain')
|
|
582
582
|
variables: Optional list of variables for the agent
|
|
583
583
|
store: Optional store for memory
|
|
584
|
+
debug_mode: Enable debug mode for cases when assistant can be initialized without tools
|
|
584
585
|
|
|
585
586
|
Returns:
|
|
586
587
|
Runnable agent ready for execution
|
|
@@ -600,7 +601,7 @@ class AlitaClient:
|
|
|
600
601
|
'variables': variables
|
|
601
602
|
}
|
|
602
603
|
return LangChainAssistant(self, agent_data, llm,
|
|
603
|
-
chat_history, "predict", memory=memory, store=store).runnable()
|
|
604
|
+
chat_history, "predict", memory=memory, store=store, debug_mode=debug_mode).runnable()
|
|
604
605
|
|
|
605
606
|
def test_toolkit_tool(self, toolkit_config: dict, tool_name: str, tool_params: dict = None,
|
|
606
607
|
runtime_config: dict = None, llm_model: str = None,
|
|
@@ -29,7 +29,8 @@ class Assistant:
|
|
|
29
29
|
app_type: str = "openai",
|
|
30
30
|
tools: Optional[list] = [],
|
|
31
31
|
memory: Optional[Any] = None,
|
|
32
|
-
store: Optional[BaseStore] = None
|
|
32
|
+
store: Optional[BaseStore] = None,
|
|
33
|
+
debug_mode: Optional[bool] = False):
|
|
33
34
|
|
|
34
35
|
self.app_type = app_type
|
|
35
36
|
self.memory = memory
|
|
@@ -87,7 +88,7 @@ class Assistant:
|
|
|
87
88
|
for internal_tool_name in meta.get("internal_tools"):
|
|
88
89
|
version_tools.append({"type": "internal_tool", "name": internal_tool_name})
|
|
89
90
|
|
|
90
|
-
self.tools = get_tools(version_tools, alita_client=alita, llm=self.client, memory_store=self.store)
|
|
91
|
+
self.tools = get_tools(version_tools, alita_client=alita, llm=self.client, memory_store=self.store, debug_mode=debug_mode)
|
|
91
92
|
if tools:
|
|
92
93
|
self.tools += tools
|
|
93
94
|
# Handle prompt setup
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from typing import Optional
|
|
2
3
|
|
|
3
4
|
from langchain_core.tools import ToolException
|
|
4
5
|
from langgraph.store.base import BaseStore
|
|
@@ -34,75 +35,83 @@ def get_toolkits():
|
|
|
34
35
|
return core_toolkits + community_toolkits() + alita_toolkits()
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
def get_tools(tools_list: list, alita_client, llm, memory_store: BaseStore = None) -> list:
|
|
38
|
+
def get_tools(tools_list: list, alita_client, llm, memory_store: BaseStore = None, debug_mode: Optional[bool] = False) -> list:
|
|
38
39
|
prompts = []
|
|
39
40
|
tools = []
|
|
40
41
|
|
|
41
42
|
for tool in tools_list:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
# TODO: update configuration of internal tools
|
|
73
|
-
elif tool['type'] == 'internal_tool':
|
|
74
|
-
if tool['name'] == 'pyodide':
|
|
75
|
-
tools += SandboxToolkit.get_toolkit(
|
|
76
|
-
stateful=False,
|
|
77
|
-
allow_net=True,
|
|
78
|
-
alita_client=alita_client,
|
|
43
|
+
try:
|
|
44
|
+
if tool['type'] == 'datasource':
|
|
45
|
+
tools.extend(DatasourcesToolkit.get_toolkit(
|
|
46
|
+
alita_client,
|
|
47
|
+
datasource_ids=[int(tool['settings']['datasource_id'])],
|
|
48
|
+
selected_tools=tool['settings']['selected_tools'],
|
|
49
|
+
toolkit_name=tool.get('toolkit_name', '') or tool.get('name', '')
|
|
50
|
+
).get_tools())
|
|
51
|
+
elif tool['type'] == 'application' and tool.get('agent_type', '') != 'pipeline' :
|
|
52
|
+
tools.extend(ApplicationToolkit.get_toolkit(
|
|
53
|
+
alita_client,
|
|
54
|
+
application_id=int(tool['settings']['application_id']),
|
|
55
|
+
application_version_id=int(tool['settings']['application_version_id']),
|
|
56
|
+
selected_tools=[]
|
|
57
|
+
).get_tools())
|
|
58
|
+
elif tool['type'] == 'application' and tool.get('agent_type', '') == 'pipeline':
|
|
59
|
+
# static get_toolkit returns a list of CompiledStateGraph stubs
|
|
60
|
+
tools.extend(SubgraphToolkit.get_toolkit(
|
|
61
|
+
alita_client,
|
|
62
|
+
application_id=int(tool['settings']['application_id']),
|
|
63
|
+
application_version_id=int(tool['settings']['application_version_id']),
|
|
64
|
+
app_api_key=alita_client.auth_token,
|
|
65
|
+
selected_tools=[],
|
|
66
|
+
llm=llm
|
|
67
|
+
))
|
|
68
|
+
elif tool['type'] == 'memory':
|
|
69
|
+
tools += MemoryToolkit.get_toolkit(
|
|
70
|
+
namespace=tool['settings'].get('namespace', str(tool['id'])),
|
|
71
|
+
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
|
72
|
+
store=memory_store,
|
|
79
73
|
).get_tools()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
# TODO: update configuration of internal tools
|
|
75
|
+
elif tool['type'] == 'internal_tool':
|
|
76
|
+
if tool['name'] == 'pyodide':
|
|
77
|
+
tools += SandboxToolkit.get_toolkit(
|
|
78
|
+
stateful=False,
|
|
79
|
+
allow_net=True,
|
|
80
|
+
alita_client=alita_client,
|
|
84
81
|
).get_tools()
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
82
|
+
elif tool['name'] == 'image_generation':
|
|
83
|
+
if alita_client and alita_client.model_image_generation:
|
|
84
|
+
tools += ImageGenerationToolkit.get_toolkit(
|
|
85
|
+
client=alita_client,
|
|
86
|
+
).get_tools()
|
|
87
|
+
else:
|
|
88
|
+
logger.warning("Image generation internal tool requested "
|
|
89
|
+
"but no image generation model configured")
|
|
90
|
+
elif tool['type'] == 'artifact':
|
|
91
|
+
tools.extend(ArtifactToolkit.get_toolkit(
|
|
92
|
+
client=alita_client,
|
|
93
|
+
bucket=tool['settings']['bucket'],
|
|
94
|
+
toolkit_name=tool.get('toolkit_name', ''),
|
|
95
|
+
selected_tools=tool['settings'].get('selected_tools', []),
|
|
96
|
+
llm=llm,
|
|
97
|
+
# indexer settings
|
|
98
|
+
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
|
99
|
+
embedding_model=tool['settings'].get('embedding_model'),
|
|
100
|
+
collection_name=f"{tool.get('toolkit_name')}",
|
|
101
|
+
collection_schema = str(tool['id'])
|
|
102
|
+
).get_tools())
|
|
103
|
+
elif tool['type'] == 'vectorstore':
|
|
104
|
+
tools.extend(VectorStoreToolkit.get_toolkit(
|
|
105
|
+
llm=llm,
|
|
106
|
+
toolkit_name=tool.get('toolkit_name', ''),
|
|
107
|
+
**tool['settings']).get_tools())
|
|
108
|
+
except Exception as e:
|
|
109
|
+
logger.error(f"Error initializing toolkit for tool '{tool.get('name', 'unknown')}': {e}", exc_info=True)
|
|
110
|
+
if debug_mode:
|
|
111
|
+
logger.info("Skipping tool initialization error due to debug mode.")
|
|
112
|
+
continue
|
|
113
|
+
else:
|
|
114
|
+
raise ToolException(f"Error initializing toolkit for tool '{tool.get('name', 'unknown')}': {e}")
|
|
106
115
|
|
|
107
116
|
if len(prompts) > 0:
|
|
108
117
|
tools += PromptToolkit.get_toolkit(alita_client, prompts).get_tools()
|
|
@@ -21,7 +21,7 @@ class CodeIndexerToolkit(BaseIndexerToolkit):
|
|
|
21
21
|
return self.vector_adapter.get_code_indexed_data(self, index_name)
|
|
22
22
|
|
|
23
23
|
def key_fn(self, document: Document):
|
|
24
|
-
return document.metadata.get(
|
|
24
|
+
return document.metadata.get("filename")
|
|
25
25
|
|
|
26
26
|
def compare_fn(self, document: Document, idx_data):
|
|
27
27
|
return (document.metadata.get('commit_hash') and
|
|
@@ -46,7 +46,7 @@ class CodeIndexerToolkit(BaseIndexerToolkit):
|
|
|
46
46
|
)
|
|
47
47
|
|
|
48
48
|
def _extend_data(self, documents: Generator[Document, None, None]):
|
|
49
|
-
yield from
|
|
49
|
+
yield from documents
|
|
50
50
|
|
|
51
51
|
def _index_tool_params(self):
|
|
52
52
|
"""Return the parameters for indexing data."""
|
|
@@ -127,7 +127,7 @@ class CodeIndexerToolkit(BaseIndexerToolkit):
|
|
|
127
127
|
self._log_tool_event(message=f"{idx} out of {total_files} files have been read", tool_name="loader")
|
|
128
128
|
self._log_tool_event(message=f"{len(_files)} have been read", tool_name="loader")
|
|
129
129
|
|
|
130
|
-
return file_content_generator()
|
|
130
|
+
return parse_code_files_for_db(file_content_generator())
|
|
131
131
|
|
|
132
132
|
def __handle_get_files(self, path: str, branch: str):
|
|
133
133
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.400
|
|
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
|
|
@@ -36,12 +36,12 @@ alita_sdk/configurations/zephyr_essential.py,sha256=tUIrh-PRNvdrLBj6rJXqlF-h6oaM
|
|
|
36
36
|
alita_sdk/runtime/__init__.py,sha256=4W0UF-nl3QF2bvET5lnah4o24CoTwSoKXhuN0YnwvEE,828
|
|
37
37
|
alita_sdk/runtime/clients/__init__.py,sha256=BdehU5GBztN1Qi1Wul0cqlU46FxUfMnI6Vq2Zd_oq1M,296
|
|
38
38
|
alita_sdk/runtime/clients/artifact.py,sha256=b7hVuGRROt6qUcT11uAZqzJqslzmlgW-Y6oGsiwNmjI,4029
|
|
39
|
-
alita_sdk/runtime/clients/client.py,sha256=
|
|
39
|
+
alita_sdk/runtime/clients/client.py,sha256=ElJdZHYLpuXLQadoHMcuhiHzs8HVUiiv5rZE7UU-iNg,45896
|
|
40
40
|
alita_sdk/runtime/clients/datasource.py,sha256=HAZovoQN9jBg0_-lIlGBQzb4FJdczPhkHehAiVG3Wx0,1020
|
|
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=
|
|
44
|
+
alita_sdk/runtime/langchain/assistant.py,sha256=gppvk4qvPcjgysLHifSm6akBErzgjCswLRVHzlbGKmM,15681
|
|
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
|
|
@@ -102,7 +102,7 @@ alita_sdk/runtime/toolkits/configurations.py,sha256=kIDAlnryPQfbZyFxV-9SzN2-Vefz
|
|
|
102
102
|
alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
|
|
103
103
|
alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
|
|
104
104
|
alita_sdk/runtime/toolkits/subgraph.py,sha256=wwUK8JjPXkGzyVZ3tAukmvST6eGbqx_U11rpnmbrvtg,2105
|
|
105
|
-
alita_sdk/runtime/toolkits/tools.py,sha256=
|
|
105
|
+
alita_sdk/runtime/toolkits/tools.py,sha256=XBbbEZOTbzt1cogu7b9mg-nluZgD5EEUuaZp5QvE9b8,10122
|
|
106
106
|
alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
|
|
107
107
|
alita_sdk/runtime/tools/__init__.py,sha256=Fx7iHqkzA90-KfjdcUUzMUI_7kDarjuTsSpSzOW2pN0,568
|
|
108
108
|
alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
|
|
@@ -137,7 +137,7 @@ alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHU
|
|
|
137
137
|
alita_sdk/runtime/utils/utils.py,sha256=PJK8A-JVIzY1IowOjGG8DIqsIiEFe65qDKvFcjJCKWA,1041
|
|
138
138
|
alita_sdk/tools/__init__.py,sha256=6g3Y2zI88IEgVu3BhmsBJfqrV0DFuFehkpID_ip0Eus,11038
|
|
139
139
|
alita_sdk/tools/base_indexer_toolkit.py,sha256=7UTcrmvGvmIBF3WGKrsEp7zJL-XB1JIgaRkbE1ZSS9A,26439
|
|
140
|
-
alita_sdk/tools/code_indexer_toolkit.py,sha256=
|
|
140
|
+
alita_sdk/tools/code_indexer_toolkit.py,sha256=0vFsNti6lLwXM1Tbv45eAFhv7DAvVFUjWEHFJjCdIrU,7298
|
|
141
141
|
alita_sdk/tools/elitea_base.py,sha256=34fmVdYgd2YXifU5LFNjMQysr4OOIZ6AOZjq4GxLgSw,34417
|
|
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
|
|
@@ -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.
|
|
357
|
-
alita_sdk-0.3.
|
|
358
|
-
alita_sdk-0.3.
|
|
359
|
-
alita_sdk-0.3.
|
|
360
|
-
alita_sdk-0.3.
|
|
356
|
+
alita_sdk-0.3.400.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
357
|
+
alita_sdk-0.3.400.dist-info/METADATA,sha256=XUEvHwBtYJOrg_f2eacT98FvqzmgYMAzpFmXTSI68RA,19071
|
|
358
|
+
alita_sdk-0.3.400.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
359
|
+
alita_sdk-0.3.400.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
|
360
|
+
alita_sdk-0.3.400.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|