alita-sdk 0.3.206__py3-none-any.whl → 0.3.207__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.
@@ -0,0 +1,147 @@
1
+ """
2
+ Toolkit runtime utilities for event dispatching and execution context.
3
+ This module provides tools with the ability to dispatch custom events during execution.
4
+ """
5
+
6
+ import sys
7
+ import logging
8
+ from typing import Dict, Any, Optional
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+
13
+ def dispatch_custom_event(event_type: str, data: Dict[str, Any]) -> Optional[Dict[str, Any]]:
14
+ """
15
+ Dispatch a custom event from within a toolkit tool execution.
16
+
17
+ This function can be called by toolkit tools to send events back to the runtime
18
+ for monitoring, logging, or other purposes.
19
+
20
+ Args:
21
+ event_type: Type of the event (e.g., "progress", "warning", "info")
22
+ data: Event data dictionary
23
+
24
+ Returns:
25
+ Event dictionary if successful, None if no executor context available
26
+
27
+ Example:
28
+ ```python
29
+ from alita_sdk.runtime.utils.toolkit_runtime import dispatch_custom_event
30
+
31
+ def my_tool_function(param1, param2):
32
+ # Dispatch a progress event
33
+ dispatch_custom_event("progress", {
34
+ "message": "Processing started",
35
+ "step": 1,
36
+ "total_steps": 3
37
+ })
38
+
39
+ # Do some work
40
+ result = process_data(param1, param2)
41
+
42
+ # Dispatch completion event
43
+ dispatch_custom_event("completion", {
44
+ "message": "Processing completed",
45
+ "result_size": len(result)
46
+ })
47
+
48
+ return result
49
+ ```
50
+ """
51
+ try:
52
+ # Try to get the current executor context
53
+ if hasattr(sys.modules[__name__], 'toolkit_dispatch_context'):
54
+ context = sys.modules[__name__].toolkit_dispatch_context
55
+ return context.dispatch_custom_event(event_type, data)
56
+ else:
57
+ # No executor context available - this is normal when not in test mode
58
+ logger.debug(f"No toolkit executor context available for event: {event_type}")
59
+ return None
60
+ except Exception as e:
61
+ logger.warning(f"Error dispatching custom event {event_type}: {e}")
62
+ return None
63
+
64
+
65
+ def get_executor_context():
66
+ """
67
+ Get the current toolkit executor context if available.
68
+
69
+ Returns:
70
+ ToolkitExecutor context or None if not in execution context
71
+ """
72
+ try:
73
+ if hasattr(sys.modules[__name__], 'toolkit_dispatch_context'):
74
+ return sys.modules[__name__].toolkit_dispatch_context.executor
75
+ return None
76
+ except Exception:
77
+ return None
78
+
79
+
80
+ def is_in_test_mode() -> bool:
81
+ """
82
+ Check if the toolkit is currently running in test mode.
83
+
84
+ Returns:
85
+ True if running in test mode with executor context, False otherwise
86
+ """
87
+ return get_executor_context() is not None
88
+
89
+
90
+ class ToolkitRuntimeContext:
91
+ """
92
+ Context manager for toolkit runtime execution.
93
+
94
+ This can be used by tools that need to perform setup/cleanup operations
95
+ when running in test mode vs normal execution.
96
+ """
97
+
98
+ def __init__(self, tool_name: str):
99
+ self.tool_name = tool_name
100
+ self.executor = get_executor_context()
101
+
102
+ def __enter__(self):
103
+ if self.executor:
104
+ dispatch_custom_event("tool_start", {
105
+ "tool_name": self.tool_name,
106
+ "message": f"Starting execution of {self.tool_name}"
107
+ })
108
+ return self
109
+
110
+ def __exit__(self, exc_type, exc_val, exc_tb):
111
+ if self.executor:
112
+ if exc_type is None:
113
+ dispatch_custom_event("tool_end", {
114
+ "tool_name": self.tool_name,
115
+ "message": f"Completed execution of {self.tool_name}",
116
+ "success": True
117
+ })
118
+ else:
119
+ dispatch_custom_event("tool_error", {
120
+ "tool_name": self.tool_name,
121
+ "message": f"Error in {self.tool_name}: {exc_val}",
122
+ "success": False,
123
+ "error_type": exc_type.__name__ if exc_type else "Unknown"
124
+ })
125
+ return False # Don't suppress exceptions
126
+
127
+ def dispatch_progress(self, message: str, step: int = None, total_steps: int = None, **kwargs):
128
+ """Convenience method for dispatching progress events."""
129
+ data = {"message": message, "tool_name": self.tool_name}
130
+ if step is not None:
131
+ data["step"] = step
132
+ if total_steps is not None:
133
+ data["total_steps"] = total_steps
134
+ data.update(kwargs)
135
+ dispatch_custom_event("progress", data)
136
+
137
+ def dispatch_info(self, message: str, **kwargs):
138
+ """Convenience method for dispatching info events."""
139
+ data = {"message": message, "tool_name": self.tool_name}
140
+ data.update(kwargs)
141
+ dispatch_custom_event("info", data)
142
+
143
+ def dispatch_warning(self, message: str, **kwargs):
144
+ """Convenience method for dispatching warning events."""
145
+ data = {"message": message, "tool_name": self.tool_name}
146
+ data.update(kwargs)
147
+ dispatch_custom_event("warning", data)
@@ -0,0 +1,157 @@
1
+ """
2
+ Toolkit utilities for instantiating and managing toolkits.
3
+ This module provides toolkit management functions that are not tied to any specific interface.
4
+ """
5
+
6
+ import logging
7
+ import random
8
+ from typing import Dict, Any, Optional, List
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+
13
+ def instantiate_toolkit_with_client(toolkit_config: Dict[str, Any],
14
+ llm_client: Any,
15
+ alita_client: Optional[Any] = None) -> List[Any]:
16
+ """
17
+ Instantiate a toolkit with LLM client support.
18
+
19
+ This is a variant of instantiate_toolkit that includes LLM client support
20
+ for toolkits that require LLM capabilities.
21
+
22
+ Args:
23
+ toolkit_config: Configuration dictionary for the toolkit
24
+ llm_client: LLM client instance for tools that need LLM capabilities
25
+ client: Optional additional client instance
26
+
27
+ Returns:
28
+ List of instantiated tools from the toolkit
29
+
30
+ Raises:
31
+ ValueError: If required configuration or client is missing
32
+ Exception: If toolkit instantiation fails
33
+ """
34
+ try:
35
+ from ..toolkits.tools import get_tools
36
+
37
+ toolkit_name = toolkit_config.get('toolkit_name')
38
+ if not toolkit_name:
39
+ raise ValueError("toolkit_name is required in configuration")
40
+
41
+ if not llm_client:
42
+ raise ValueError("LLM client is required but not provided")
43
+
44
+ settings = toolkit_config.get('settings', {})
45
+
46
+ # Log the configuration being used
47
+ logger.info(f"Instantiating toolkit {toolkit_name} with LLM client")
48
+ logger.debug(f"Toolkit {toolkit_name} configuration: {toolkit_config}")
49
+
50
+ # Create a tool configuration dict with required fields
51
+ tool_config = {
52
+ 'id': toolkit_config.get('id', random.randint(1, 1000000)),
53
+ 'type': toolkit_config.get('type', toolkit_name.lower()),
54
+ 'settings': settings,
55
+ 'toolkit_name': toolkit_name
56
+ }
57
+
58
+ # Get tools using the toolkit configuration with clients
59
+ # Parameter order: get_tools(tools_list, alita_client, llm, memory_store)
60
+ tools = get_tools([tool_config], alita_client, llm_client)
61
+
62
+ if not tools:
63
+ logger.warning(f"No tools returned for toolkit {toolkit_name}")
64
+ return []
65
+
66
+ logger.info(f"Successfully instantiated toolkit {toolkit_name} with {len(tools)} tools")
67
+ return tools
68
+
69
+ except Exception as e:
70
+ logger.error(f"Error instantiating toolkit {toolkit_name} with client: {str(e)}")
71
+ raise
72
+
73
+
74
+ def get_toolkit_tools(toolkit_instance: Any) -> List[Any]:
75
+ """
76
+ Extract tools from an instantiated toolkit instance.
77
+
78
+ This function provides a standardized way to get tools from various
79
+ toolkit implementations that might have different interfaces.
80
+
81
+ Args:
82
+ toolkit_instance: An instantiated toolkit object
83
+
84
+ Returns:
85
+ List of tools from the toolkit
86
+
87
+ Raises:
88
+ ValueError: If no tools can be extracted from the toolkit
89
+ """
90
+ try:
91
+ # Try different methods to get tools from the toolkit
92
+ if hasattr(toolkit_instance, 'get_tools'):
93
+ tools = toolkit_instance.get_tools()
94
+ elif hasattr(toolkit_instance, 'tools'):
95
+ tools = toolkit_instance.tools
96
+ elif hasattr(toolkit_instance, '_tools'):
97
+ tools = toolkit_instance._tools
98
+ else:
99
+ raise ValueError("Could not find tools in the toolkit instance")
100
+
101
+ if not tools:
102
+ logger.warning("Toolkit instance returned empty tools list")
103
+ return []
104
+
105
+ logger.info(f"Extracted {len(tools)} tools from toolkit instance")
106
+ return tools
107
+
108
+ except Exception as e:
109
+ logger.error(f"Error extracting tools from toolkit: {str(e)}")
110
+ raise
111
+
112
+
113
+ def find_tool_by_name(tools: List[Any], tool_name: str) -> Optional[Any]:
114
+ """
115
+ Find a specific tool by name from a list of tools.
116
+
117
+ Args:
118
+ tools: List of tool instances
119
+ tool_name: Name of the tool to find
120
+
121
+ Returns:
122
+ The tool instance if found, None otherwise
123
+ """
124
+ for tool in tools:
125
+ # Check various attributes that might contain the tool name
126
+ if hasattr(tool, 'name') and tool.name == tool_name:
127
+ return tool
128
+ elif hasattr(tool, 'func') and hasattr(tool.func, '__name__') and tool.func.__name__ == tool_name:
129
+ return tool
130
+ elif hasattr(tool, '__name__') and tool.__name__ == tool_name:
131
+ return tool
132
+
133
+ return None
134
+
135
+
136
+ def get_tool_names(tools: List[Any]) -> List[str]:
137
+ """
138
+ Extract tool names from a list of tools.
139
+
140
+ Args:
141
+ tools: List of tool instances
142
+
143
+ Returns:
144
+ List of tool names
145
+ """
146
+ tool_names = []
147
+ for tool in tools:
148
+ if hasattr(tool, 'name'):
149
+ tool_names.append(tool.name)
150
+ elif hasattr(tool, 'func') and hasattr(tool.func, '__name__'):
151
+ tool_names.append(tool.func.__name__)
152
+ elif hasattr(tool, '__name__'):
153
+ tool_names.append(tool.__name__)
154
+ else:
155
+ tool_names.append(str(tool))
156
+
157
+ return tool_names
@@ -1,7 +1,7 @@
1
1
  from typing import Optional, List
2
2
 
3
3
  from langchain_core.tools import BaseToolkit, BaseTool
4
- from langgraph.store.postgres import PostgresStore
4
+
5
5
  try:
6
6
  from langmem import create_manage_memory_tool, create_search_memory_tool
7
7
  except ImportError:
@@ -15,13 +15,37 @@ from pydantic import create_model, BaseModel, ConfigDict, Field, SecretStr
15
15
 
16
16
  name = "memory"
17
17
 
18
- def get_tools(tool):
19
- return MemoryToolkit().get_toolkit(
20
- namespace=tool['settings'].get('namespace', str(tool['id'])),
21
- username=tool['settings'].get('username', ''),
22
- store=tool['settings'].get('store', None),
23
- toolkit_name=tool.get('toolkit_name', '')
24
- ).get_tools()
18
+ def get_tools(tools_list: list, alita_client, llm, memory_store=None):
19
+ """
20
+ Get memory tools for the provided tool configurations.
21
+
22
+ Args:
23
+ tools_list: List of tool configurations
24
+ alita_client: Alita client instance
25
+ llm: LLM client instance
26
+ memory_store: Optional memory store instance
27
+
28
+ Returns:
29
+ List of memory tools
30
+ """
31
+ all_tools = []
32
+
33
+ for tool in tools_list:
34
+ if tool.get('type') == 'memory' or tool.get('toolkit_name') == 'memory':
35
+ try:
36
+ toolkit_instance = MemoryToolkit().get_toolkit(
37
+ namespace=tool['settings'].get('namespace', str(tool['id'])),
38
+ username=tool['settings'].get('username', ''),
39
+ store=tool['settings'].get('store', memory_store),
40
+ toolkit_name=tool.get('toolkit_name', '')
41
+ )
42
+ all_tools.extend(toolkit_instance.get_tools())
43
+ except Exception as e:
44
+ print(f"DEBUG: Error in memory toolkit get_tools: {e}")
45
+ print(f"DEBUG: Tool config: {tool}")
46
+ raise
47
+
48
+ return all_tools
25
49
 
26
50
  class MemoryToolkit(BaseToolkit):
27
51
  tools: List[BaseTool] = []
@@ -30,7 +54,7 @@ class MemoryToolkit(BaseToolkit):
30
54
  @staticmethod
31
55
  def toolkit_config_schema() -> BaseModel:
32
56
  return create_model(
33
- name,
57
+ 'MemoryConfig',
34
58
  namespace=(str, Field(description="Memory namespace", json_schema_extra={'toolkit_name': True})),
35
59
  username=(Optional[str], Field(description="Username", default='Tester', json_schema_extra={'hidden': True})),
36
60
  connection_string=(Optional[SecretStr], Field(description="Connection string for vectorstore",
@@ -48,7 +72,27 @@ class MemoryToolkit(BaseToolkit):
48
72
  )
49
73
 
50
74
  @classmethod
51
- def get_toolkit(cls, namespace: str, store: PostgresStore, **kwargs):
75
+ def get_toolkit(cls, namespace: str, store=None, **kwargs):
76
+ """
77
+ Get toolkit with memory tools.
78
+
79
+ Args:
80
+ namespace: Memory namespace
81
+ store: PostgresStore instance (imported dynamically)
82
+ **kwargs: Additional arguments
83
+ """
84
+ try:
85
+ from langgraph.store.postgres import PostgresStore
86
+ except ImportError:
87
+ raise ImportError(
88
+ "PostgreSQL dependencies (psycopg) are required for MemoryToolkit. "
89
+ "Install with: pip install psycopg[binary]"
90
+ )
91
+
92
+ # Validate store type
93
+ if store is not None and not isinstance(store, PostgresStore):
94
+ raise TypeError(f"Expected PostgresStore, got {type(store)}")
95
+
52
96
  return cls(tools=[
53
97
  create_manage_memory_tool(namespace=namespace, store=store),
54
98
  create_search_memory_tool(namespace=namespace, store=store)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.206
3
+ Version: 0.3.207
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
@@ -1,19 +1,10 @@
1
1
  alita_sdk/__init__.py,sha256=fxeNiqiVpIFAJls31Oomifyrtd5gT9iPUTdkWjDOB2Y,656
2
2
  alita_sdk/community/__init__.py,sha256=8N7wWwPhoyOq3p8wlV3-pb3l3nJCR8TUrtV9iIPLU88,2523
3
3
  alita_sdk/community/utils.py,sha256=lvuCJaNqVPHOORJV6kIPcXJcdprVW_TJvERtYAEgpjM,249
4
- alita_sdk/community/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- alita_sdk/community/analysis/ado_analyse/__init__.py,sha256=ADjjyV2z7XmQhOv873Mrz_-W9jWxhWpiDJ0nujm0eZs,4232
6
- alita_sdk/community/analysis/ado_analyse/api_wrapper.py,sha256=evWq2GS4SxfOc4bryhhG21QTVHII65_4CmqAJN2iGd0,8721
7
- alita_sdk/community/analysis/github_analyse/__init__.py,sha256=QmHgXYaUSBmyFNUVV89OMuhoTe0E6Q-7ftG5s8N3j_w,3682
8
- alita_sdk/community/analysis/github_analyse/api_wrapper.py,sha256=w_umxdeSDRuZvckQIAmihty4YL7Be3K28S1wV5hhgRY,6872
9
- alita_sdk/community/analysis/gitlab_analyse/__init__.py,sha256=6PgqvD0cX5evpT_vgGv48sXMHCJYn_MPqaOAUxhxS2g,4243
10
- alita_sdk/community/analysis/gitlab_analyse/api_wrapper.py,sha256=xGX3io2rT_DJl1PMiP9d6lsw6xhr9L2h910raGk1s4w,6373
11
- alita_sdk/community/analysis/jira_analyse/__init__.py,sha256=oyAVkjq4KZmSA1RiAijeo4oh9hNDgFmOCkDilUJ8DWs,6023
12
- alita_sdk/community/analysis/jira_analyse/api_wrapper.py,sha256=Ui1GBWizIFGFOi98BtkPWxVITQbrv7xFZxxYjAFq66Q,9701
13
4
  alita_sdk/runtime/__init__.py,sha256=4W0UF-nl3QF2bvET5lnah4o24CoTwSoKXhuN0YnwvEE,828
14
5
  alita_sdk/runtime/clients/__init__.py,sha256=BdehU5GBztN1Qi1Wul0cqlU46FxUfMnI6Vq2Zd_oq1M,296
15
6
  alita_sdk/runtime/clients/artifact.py,sha256=4N2t5x3GibyXLq3Fvrv2o_VA7Z000yNfc-UN4eGsHZg,2679
16
- alita_sdk/runtime/clients/client.py,sha256=XITXME6UGi-VKEMd8eYJ-PPFIkSyWVigmLH61UMvD_M,23326
7
+ alita_sdk/runtime/clients/client.py,sha256=R2ISXLCi7ODQaw6juPlknCtWkcSeZw-lmq3VOc6V-yM,35783
17
8
  alita_sdk/runtime/clients/datasource.py,sha256=HAZovoQN9jBg0_-lIlGBQzb4FJdczPhkHehAiVG3Wx0,1020
18
9
  alita_sdk/runtime/clients/prompt.py,sha256=li1RG9eBwgNK_Qf0qUaZ8QNTmsncFrAL2pv3kbxZRZg,1447
19
10
  alita_sdk/runtime/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -21,10 +12,10 @@ alita_sdk/runtime/langchain/assistant.py,sha256=Bn9vUyZlFAP-D9Bh3zc2G1ZQkh5rr2c2
21
12
  alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
22
13
  alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
23
14
  alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
24
- alita_sdk/runtime/langchain/langraph_agent.py,sha256=ssPJOf_REAx8lx2tQdnZ0ccbdiZX8WwSRcX5ASgLyxs,43327
15
+ alita_sdk/runtime/langchain/langraph_agent.py,sha256=QwD9NZ74Hp4rZvP7nirzOmjFJhfJ7eiuAvsq7aAW4Uw,43563
25
16
  alita_sdk/runtime/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
26
17
  alita_sdk/runtime/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
27
- alita_sdk/runtime/langchain/store_manager.py,sha256=w5-0GbPGJAw14g0CCD9BKFMznzk1I-iJ5OGj_HZJZgA,2211
18
+ alita_sdk/runtime/langchain/store_manager.py,sha256=i8Fl11IXJhrBXq1F1ukEVln57B1IBe-tqSUvfUmBV4A,2218
28
19
  alita_sdk/runtime/langchain/utils.py,sha256=Npferkn10dvdksnKzLJLBI5bNGQyVWTBwqp3vQtUqmY,6631
29
20
  alita_sdk/runtime/langchain/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
21
  alita_sdk/runtime/langchain/agents/xml_chat.py,sha256=Mx7PK5T97_GrFCwHHZ3JZP42S7MwtUzV0W-_8j6Amt8,6212
@@ -70,7 +61,7 @@ alita_sdk/runtime/toolkits/artifact.py,sha256=7fTr9VpGd2zwCB3EwW4aqWa5jVKRTunqV3
70
61
  alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
71
62
  alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
72
63
  alita_sdk/runtime/toolkits/subgraph.py,sha256=ZYqI4yVLbEPAjCR8dpXbjbL2ipX598Hk3fL6AgaqFD4,1758
73
- alita_sdk/runtime/toolkits/tools.py,sha256=Cpde3upReUwQIOM4RAMMdbEem1EBLIPI2GXC2MsX6V0,7951
64
+ alita_sdk/runtime/toolkits/tools.py,sha256=eYAOzxiCcHzwssPTvgS_qDLNbhBu9BHsyqQWjO41_LA,7587
74
65
  alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
75
66
  alita_sdk/runtime/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
67
  alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
@@ -95,7 +86,9 @@ alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQw
95
86
  alita_sdk/runtime/utils/evaluate.py,sha256=iM1P8gzBLHTuSCe85_Ng_h30m52hFuGuhNXJ7kB1tgI,1872
96
87
  alita_sdk/runtime/utils/logging.py,sha256=svPyiW8ztDfhqHFITv5FBCj8UhLxz6hWcqGIY6wpJJE,3331
97
88
  alita_sdk/runtime/utils/save_dataframe.py,sha256=i-E1wp-t4wb17Zq3nA3xYwgSILjoXNizaQAA9opWvxY,1576
98
- alita_sdk/runtime/utils/streamlit.py,sha256=iuArm_XchIPOSrO60gLpvRKDVLv3-LJDpoI6NP5k6EM,85835
89
+ alita_sdk/runtime/utils/streamlit.py,sha256=ZgHpibL2ARHt6qrWj5JhK6HNZv2UjxQ04qTk6gmz1Eo,104928
90
+ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7rUxp2MRR4tmYR8,5136
91
+ alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
99
92
  alita_sdk/runtime/utils/utils.py,sha256=FoHtcQZ6JFFU8a1FG_V-W22v-bis0XsIc_XQmjH6Mzg,461
100
93
  alita_sdk/tools/__init__.py,sha256=kTw83lzfWf4HWlvGzfwwHhQlRhpPAbfCAhKkMWCzLFo,10324
101
94
  alita_sdk/tools/elitea_base.py,sha256=WjZYjBb1K5HySsbmkbSXUa9_7HYR3xvTHaMC6XCb_Z4,23391
@@ -232,7 +225,7 @@ alita_sdk/tools/llm/llm_utils.py,sha256=6P2j-42JGbyqpO8lNRuEP8GEhja-LC9E-98jTelK
232
225
  alita_sdk/tools/localgit/__init__.py,sha256=NScO0Eu-wl-rc63jjD5Qv1RXXB1qukSIJXx-yS_JQLI,2529
233
226
  alita_sdk/tools/localgit/local_git.py,sha256=gsAftNcK7nMCd8VsIkwDLs2SoG0MgpYdkQG5tmoynkA,18074
234
227
  alita_sdk/tools/localgit/tool.py,sha256=It_B24rMvFPurB355Oy5IShg2BsZTASsEoSS8hu2SXw,998
235
- alita_sdk/tools/memory/__init__.py,sha256=8Q02h-PUvIw3bNbWbfklSJZe3qj0zAjfahq9C5XjyzE,2359
228
+ alita_sdk/tools/memory/__init__.py,sha256=Z3txBO3BMEk539_uBhGQaT57JWBVImbmZ8oPcLMj9ik,3900
236
229
  alita_sdk/tools/ocr/__init__.py,sha256=pvslKVXyJmK0q23FFDNieuc7RBIuzNXTjTNj-GqhGb0,3335
237
230
  alita_sdk/tools/ocr/api_wrapper.py,sha256=08UF8wj1sR8DcW0z16pw19bgLatLkBF8dySW-Ds8iRk,29649
238
231
  alita_sdk/tools/ocr/text_detection.py,sha256=1DBxt54r3_HdEi93QynSIVta3rH3UpIvy799TPtDTtk,23825
@@ -306,8 +299,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=VDsSFUTnBne1mFNssX2eLFxThXAhX
306
299
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
307
300
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
308
301
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
309
- alita_sdk-0.3.206.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
310
- alita_sdk-0.3.206.dist-info/METADATA,sha256=XAKlNdJggXGDhxy1Nw6k9pKDJYvPTWv1LAxUhNvnpys,18917
311
- alita_sdk-0.3.206.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
312
- alita_sdk-0.3.206.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
313
- alita_sdk-0.3.206.dist-info/RECORD,,
302
+ alita_sdk-0.3.207.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
303
+ alita_sdk-0.3.207.dist-info/METADATA,sha256=5lVazejNDrCxd8_C-cvo3UuvhtgU7mVpW6WZAUqR_6Q,18917
304
+ alita_sdk-0.3.207.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
305
+ alita_sdk-0.3.207.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
306
+ alita_sdk-0.3.207.dist-info/RECORD,,
File without changes
@@ -1,103 +0,0 @@
1
- from typing import List, Optional, Literal
2
- from elitea_analyse.ado.azure_search import AzureSearch
3
- from pydantic import SecretStr, create_model, BaseModel, ConfigDict, Field
4
-
5
- from langchain_core.tools import BaseTool, BaseToolkit
6
-
7
- from alita_sdk.tools.utils import get_max_toolkit_length
8
- from alita_sdk.tools.base.tool import BaseAction
9
- from alita_sdk.runtime.clients.client import AlitaClient # Add this import at the top of the file
10
- from alita_sdk.runtime.tools.artifact import ArtifactWrapper
11
- from .api_wrapper import AdoAnalyseWrapper
12
-
13
- from ...utils import check_schema
14
-
15
-
16
- name = "Analyse_Ado"
17
-
18
-
19
- class AnalyseAdo(BaseToolkit):
20
- tools: List[BaseTool] = []
21
- toolkit_max_length: int = 0
22
-
23
- @staticmethod
24
- def toolkit_config_schema() -> type[BaseModel]:
25
- selected_tools = {
26
- x["name"]: x["args_schema"].schema()
27
- for x in AdoAnalyseWrapper.model_construct().get_available_tools()
28
- }
29
- AnalyseAdo.toolkit_max_length = get_max_toolkit_length(selected_tools)
30
-
31
- return create_model(
32
- "analyse_ado",
33
- organization=(str, Field(description="Azure DevOps organization name",
34
- json_schema_extra={"toolkit_name": True, "max_toolkit_length": AnalyseAdo.toolkit_max_length})),
35
- username=(str, Field(description="Azure DevOps username (e.g., 'john.doe@domain.com')")),
36
- token=(SecretStr, Field(description="Azure DevOps Access Token", json_schema_extra={"secret": True})),
37
- project_keys=(Optional[str], Field(description="Azure DevOps project keys separated by comma", default=None)),
38
- default_branch_name=(Optional[str], Field(description="Default branch name", default="main")),
39
- area=(Optional[str], Field(description="Area path filter", default="")),
40
- artifact_bucket_path=(Optional[str], Field(description="Artifact Bucket Path", default="analyse-ado")),
41
- selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={"args_schemas": selected_tools})),
42
- __config__=ConfigDict(json_schema_extra={"metadata": {
43
- "label": "Analyse_Ado",
44
- "icon_url": "ado-icon.svg", # ???
45
- "hidden": True,
46
- "sections": {
47
- "auth": {
48
- "required": True,
49
- "subsections": [{"name": "Token", "fields": ["token"]}],
50
- }
51
- },
52
- }
53
- })
54
- )
55
-
56
- @classmethod
57
- def get_toolkit(cls, client: "AlitaClient", selected_tools: list[str], **kwargs):
58
-
59
- bucket_path = kwargs.get("artifact_bucket_path") or "analyse-ado"
60
- artifact_wrapper = ArtifactWrapper(client=client, bucket=bucket_path)
61
- check_schema(artifact_wrapper)
62
-
63
- project_keys = kwargs.get("project_keys") or ""
64
- area = kwargs.get("area", "")
65
-
66
- organization = kwargs.get("organization")
67
- username = kwargs.get("username")
68
- token = kwargs.get("token")
69
-
70
- if not organization or not username or not token:
71
- raise ValueError("Organization, username, and token must be provided.")
72
-
73
- ado_search = AzureSearch(organization=organization, user=username, token=token)
74
-
75
- ado_analyse_wrapper = AdoAnalyseWrapper(
76
- artifacts_wrapper=artifact_wrapper,
77
- project_keys=project_keys,
78
- default_branch_name=kwargs.get("default_branch_name", "main"),
79
- area=area,
80
- ado_search=ado_search,
81
- )
82
-
83
- selected_tools = selected_tools or []
84
- available_tools = ado_analyse_wrapper.get_available_tools()
85
-
86
- tools = []
87
- for tool in available_tools:
88
- if selected_tools:
89
- if tool["name"] not in selected_tools:
90
- continue
91
- tools.append(
92
- BaseAction(
93
- api_wrapper=ado_analyse_wrapper,
94
- name=tool["name"],
95
- description=tool["description"],
96
- args_schema=tool["args_schema"],
97
- )
98
- )
99
-
100
- return cls(tools=tools)
101
-
102
- def get_tools(self):
103
- return self.tools