alita-sdk 0.3.116__py3-none-any.whl → 0.3.118__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.
- alita_sdk/community/analysis/jira_analyse/api_wrapper.py +18 -14
- alita_sdk/langchain/langraph_agent.py +1 -1
- alita_sdk/utils/logging.py +93 -0
- {alita_sdk-0.3.116.dist-info → alita_sdk-0.3.118.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.116.dist-info → alita_sdk-0.3.118.dist-info}/RECORD +8 -7
- {alita_sdk-0.3.116.dist-info → alita_sdk-0.3.118.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.116.dist-info → alita_sdk-0.3.118.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.116.dist-info → alita_sdk-0.3.118.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,7 @@ from elitea_analyse.jira.jira_issues import JiraIssues
|
|
15
15
|
|
16
16
|
from alita_tools.elitea_base import BaseToolApiWrapper
|
17
17
|
from ....tools.artifact import ArtifactWrapper
|
18
|
-
|
18
|
+
from ....utils.logging import with_streamlit_logs
|
19
19
|
|
20
20
|
logger = logging.getLogger(__name__)
|
21
21
|
|
@@ -59,9 +59,21 @@ class JiraAnalyseWrapper(BaseToolApiWrapper):
|
|
59
59
|
Get projects a user has access to and merge them with issues count.
|
60
60
|
after_date: str
|
61
61
|
date after which issues are considered
|
62
|
+
project_keys: str
|
63
|
+
one or more projects keys separated with comma
|
62
64
|
"""
|
63
65
|
project_keys = project_keys or self.project_keys
|
64
66
|
|
67
|
+
dispatch_custom_event(
|
68
|
+
name="thinking_step",
|
69
|
+
data={
|
70
|
+
"message": f"I am extracting number of all issues with initial parameters:\
|
71
|
+
project keys: {project_keys}, after date: {after_date}",
|
72
|
+
"tool_name": "get_number_off_all_issues",
|
73
|
+
"toolkit": "analyse_jira",
|
74
|
+
},
|
75
|
+
)
|
76
|
+
|
65
77
|
project_df = jira_projects_overview(
|
66
78
|
after_date, project_keys=project_keys, jira=self.jira
|
67
79
|
)
|
@@ -72,22 +84,12 @@ class JiraAnalyseWrapper(BaseToolApiWrapper):
|
|
72
84
|
f"projects_overview_{project_keys}.csv",
|
73
85
|
csv_options={"index": False},
|
74
86
|
)
|
75
|
-
dispatch_custom_event(
|
76
|
-
name="jira_projects_overview",
|
77
|
-
data={
|
78
|
-
"project_keys": project_keys,
|
79
|
-
"after_date": after_date,
|
80
|
-
"files": [f"projects_overview_{project_keys}.csv"],
|
81
|
-
"project_count": len(project_df),
|
82
|
-
"columns": project_df.columns.tolist(),
|
83
|
-
},
|
84
|
-
)
|
85
|
-
|
86
87
|
return {
|
87
88
|
"projects": project_df["key"].tolist(),
|
88
89
|
"projects_summary": project_df.to_string(),
|
89
90
|
}
|
90
91
|
|
92
|
+
@with_streamlit_logs(tool_name="get_jira_issues")
|
91
93
|
def get_jira_issues(
|
92
94
|
self,
|
93
95
|
closed_issues_based_on: int,
|
@@ -100,7 +102,8 @@ class JiraAnalyseWrapper(BaseToolApiWrapper):
|
|
100
102
|
"""
|
101
103
|
Extract Jira issues for the specified projects.
|
102
104
|
closed_issues_based_on: int
|
103
|
-
define whether issues can be thought as
|
105
|
+
define whether issues can be thought as
|
106
|
+
closed based on their status (1) or not empty resolved date (2)
|
104
107
|
resolved_after: str
|
105
108
|
resolved after date (i.e. 2023-01-01)
|
106
109
|
updated_after: str
|
@@ -112,6 +115,7 @@ class JiraAnalyseWrapper(BaseToolApiWrapper):
|
|
112
115
|
project_keys: str
|
113
116
|
one or more projects keys separated with comma
|
114
117
|
"""
|
118
|
+
|
115
119
|
if not (
|
116
120
|
(
|
117
121
|
closed_issues_based_on == 1
|
@@ -122,7 +126,7 @@ class JiraAnalyseWrapper(BaseToolApiWrapper):
|
|
122
126
|
return (
|
123
127
|
"ERROR: Check input parameters closed_issues_based_on and closed_status"
|
124
128
|
)
|
125
|
-
|
129
|
+
|
126
130
|
project_keys = project_keys or self.project_keys
|
127
131
|
|
128
132
|
dispatch_custom_event(
|
@@ -373,7 +373,7 @@ def create_graph(
|
|
373
373
|
node['decision'].get('description', ""),
|
374
374
|
decisional_inputs=node['decision'].get('decisional_inputs', ['messages']),
|
375
375
|
default_output=node['decision'].get('default_output', 'END')))
|
376
|
-
elif node.get('condition'):
|
376
|
+
elif node.get('condition') and node_type != 'router':
|
377
377
|
logger.info(f'Adding condition: {node["condition"]}')
|
378
378
|
condition_input = node['condition'].get('condition_input', ['messages'])
|
379
379
|
condition_definition = node['condition'].get('condition_definition', '')
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import logging
|
2
|
+
from functools import wraps
|
3
|
+
|
4
|
+
from langchain_core.callbacks import dispatch_custom_event
|
5
|
+
|
6
|
+
|
7
|
+
class StreamlitCallbackHandler(logging.Handler):
|
8
|
+
"""Custom logging handler to send logs to Streamlit."""
|
9
|
+
|
10
|
+
def __init__(self, tool_name: str = "logging"):
|
11
|
+
super().__init__()
|
12
|
+
self.tool_name = tool_name
|
13
|
+
|
14
|
+
def emit(self, record):
|
15
|
+
"""Emit a log record."""
|
16
|
+
if record.levelno < logging.INFO:
|
17
|
+
return # Ignore debug logs
|
18
|
+
|
19
|
+
log_entry = self.format(record)
|
20
|
+
dispatch_custom_event(
|
21
|
+
name="thinking_step",
|
22
|
+
data={
|
23
|
+
"message": log_entry,
|
24
|
+
"tool_name": self.tool_name,
|
25
|
+
"toolkit": "logging", # ? or pass the toolkit name
|
26
|
+
},
|
27
|
+
)
|
28
|
+
|
29
|
+
|
30
|
+
def setup_streamlit_logging(
|
31
|
+
logger_name: str = "", tool_name="logging"
|
32
|
+
) -> StreamlitCallbackHandler:
|
33
|
+
"""
|
34
|
+
Attach a StreamlitCallbackHandler to the given logger (default: root).
|
35
|
+
Returns the handler so you can remove it later if needed.
|
36
|
+
"""
|
37
|
+
logger = logging.getLogger(logger_name)
|
38
|
+
handler = StreamlitCallbackHandler(tool_name)
|
39
|
+
|
40
|
+
# Avoid duplicate handlers
|
41
|
+
if not any(isinstance(h, StreamlitCallbackHandler) for h in logger.handlers):
|
42
|
+
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
|
43
|
+
handler.setFormatter(formatter)
|
44
|
+
logger.addHandler(handler)
|
45
|
+
|
46
|
+
return handler
|
47
|
+
|
48
|
+
|
49
|
+
# Decorator version
|
50
|
+
def with_streamlit_logs(logger_name: str = "", tool_name="logging"):
|
51
|
+
"""
|
52
|
+
Decorator to temporarily attach a StreamlitCallbackHandler to a function's logger.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
logger_name (str): Name of the logger to attach the handler to.
|
56
|
+
Use an empty string "" for the root logger.
|
57
|
+
tool_name (str): Name of the tool to display in Streamlit logs.
|
58
|
+
|
59
|
+
Behavior:
|
60
|
+
- Attaches a StreamlitCallbackHandler before the function runs.
|
61
|
+
- Forwards all INFO and higher log messages—including those
|
62
|
+
from 3rd-party libraries using the specified logger—to Streamlit
|
63
|
+
via dispatch_custom_event.
|
64
|
+
- Automatically removes the handler after the function completes,
|
65
|
+
even if an exception occurs.
|
66
|
+
|
67
|
+
Example:
|
68
|
+
@with_streamlit_logs(logger_name="my_logger", tool_name="my_tool")
|
69
|
+
def my_function():
|
70
|
+
logging.info("This is a log message.")
|
71
|
+
# Logs from 3rd-party libraries using "my_logger" will also be sent to Streamlit.
|
72
|
+
|
73
|
+
Returns:
|
74
|
+
The decorated function with Streamlit logging enabled during its execution.
|
75
|
+
"""
|
76
|
+
|
77
|
+
def decorator(func):
|
78
|
+
@wraps(func)
|
79
|
+
def wrapper(*args, **kwargs):
|
80
|
+
logger = logging.getLogger(logger_name)
|
81
|
+
handler = StreamlitCallbackHandler(tool_name=tool_name)
|
82
|
+
handler.setFormatter(
|
83
|
+
logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
|
84
|
+
)
|
85
|
+
logger.addHandler(handler)
|
86
|
+
try:
|
87
|
+
return func(*args, **kwargs)
|
88
|
+
finally:
|
89
|
+
logger.removeHandler(handler)
|
90
|
+
|
91
|
+
return wrapper
|
92
|
+
|
93
|
+
return decorator
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.118
|
4
4
|
Summary: SDK for building langchain agents using resouces 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>
|
6
6
|
Project-URL: Homepage, https://projectalita.ai
|
@@ -11,7 +11,7 @@ alita_sdk/community/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
11
11
|
alita_sdk/community/utils.py,sha256=lvuCJaNqVPHOORJV6kIPcXJcdprVW_TJvERtYAEgpjM,249
|
12
12
|
alita_sdk/community/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
alita_sdk/community/analysis/jira_analyse/__init__.py,sha256=Rm-HKEi_HIxrgHdq9mZ-XzxMKLXm8-81eJwJT2lar-c,5945
|
14
|
-
alita_sdk/community/analysis/jira_analyse/api_wrapper.py,sha256=
|
14
|
+
alita_sdk/community/analysis/jira_analyse/api_wrapper.py,sha256=JqGSxg_3x0ErzII31UZkY3V7jo9i8Gb5d_pW7lPIOSA,9522
|
15
15
|
alita_sdk/community/browseruse/__init__.py,sha256=uAxPZEX7ihpt8HtcGDFrzTNv9WcklT1wG1ItTwUO8y4,3601
|
16
16
|
alita_sdk/community/browseruse/api_wrapper.py,sha256=Y05NKWfTROPmBxe8ZFIELSGBX5v3RTNP30OTO2Tj8uI,10838
|
17
17
|
alita_sdk/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -19,7 +19,7 @@ alita_sdk/langchain/assistant.py,sha256=V0MpZG9IQRlKMr1SfAabVbUsIp-gNPO9A1SWxuFi
|
|
19
19
|
alita_sdk/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
|
20
20
|
alita_sdk/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
|
21
21
|
alita_sdk/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
|
22
|
-
alita_sdk/langchain/langraph_agent.py,sha256=
|
22
|
+
alita_sdk/langchain/langraph_agent.py,sha256=vxsbjOE0UWZIuyXNGEMR1QJ8t5yHS7Kzjt8a8nLb-jw,20626
|
23
23
|
alita_sdk/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
|
24
24
|
alita_sdk/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
|
25
25
|
alita_sdk/langchain/utils.py,sha256=Npferkn10dvdksnKzLJLBI5bNGQyVWTBwqp3vQtUqmY,6631
|
@@ -88,12 +88,13 @@ alita_sdk/tools/vectorstore.py,sha256=F-DoHxPa4UVsKB-FEd-wWa59QGQifKMwcSNcZ5WZOK
|
|
88
88
|
alita_sdk/utils/AlitaCallback.py,sha256=cvpDhR4QLVCNQci6CO6TEUrUVDZU9_CRSwzcHGm3SGw,7356
|
89
89
|
alita_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
90
90
|
alita_sdk/utils/evaluate.py,sha256=iM1P8gzBLHTuSCe85_Ng_h30m52hFuGuhNXJ7kB1tgI,1872
|
91
|
+
alita_sdk/utils/logging.py,sha256=hBE3qAzmcLMdamMp2YRXwOOK9P4lmNaNhM76kntVljs,3124
|
91
92
|
alita_sdk/utils/streamlit.py,sha256=zp8owZwHI3HZplhcExJf6R3-APtWx-z6s5jznT2hY_k,29124
|
92
93
|
alita_sdk/utils/utils.py,sha256=dM8whOJAuFJFe19qJ69-FLzrUp6d2G-G6L7d4ss2XqM,346
|
93
|
-
alita_sdk-0.3.
|
94
|
+
alita_sdk-0.3.118.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
94
95
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
95
96
|
tests/test_jira_analysis.py,sha256=I0cErH5R_dHVyutpXrM1QEo7jfBuKWTmDQvJBPjx18I,3281
|
96
|
-
alita_sdk-0.3.
|
97
|
-
alita_sdk-0.3.
|
98
|
-
alita_sdk-0.3.
|
99
|
-
alita_sdk-0.3.
|
97
|
+
alita_sdk-0.3.118.dist-info/METADATA,sha256=EpmbeqXcaaS8ftTkjf1BBPjWBb3AEmjv5sYE20G5uYw,7075
|
98
|
+
alita_sdk-0.3.118.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
99
|
+
alita_sdk-0.3.118.dist-info/top_level.txt,sha256=SWRhxB7Et3cOy3RkE5hR7OIRnHoo3K8EXzoiNlkfOmc,25
|
100
|
+
alita_sdk-0.3.118.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|