holmesgpt 0.15.0__py3-none-any.whl → 0.16.0__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 holmesgpt might be problematic. Click here for more details.
- holmes/__init__.py +1 -1
- holmes/common/env_vars.py +8 -0
- holmes/core/llm.py +28 -0
- holmes/core/supabase_dal.py +33 -42
- holmes/core/tool_calling_llm.py +92 -223
- holmes/core/tools_utils/tool_context_window_limiter.py +32 -39
- holmes/core/truncation/compaction.py +59 -0
- holmes/core/truncation/input_context_window_limiter.py +218 -0
- holmes/plugins/prompts/conversation_history_compaction.jinja2 +88 -0
- holmes/plugins/toolsets/investigator/core_investigation.py +20 -11
- holmes/plugins/toolsets/robusta/robusta.py +35 -8
- holmes/plugins/toolsets/robusta/robusta_instructions.jinja2 +4 -3
- holmes/utils/stream.py +1 -0
- {holmesgpt-0.15.0.dist-info → holmesgpt-0.16.0.dist-info}/METADATA +4 -2
- {holmesgpt-0.15.0.dist-info → holmesgpt-0.16.0.dist-info}/RECORD +18 -16
- holmes/core/performance_timing.py +0 -72
- {holmesgpt-0.15.0.dist-info → holmesgpt-0.16.0.dist-info}/LICENSE.txt +0 -0
- {holmesgpt-0.15.0.dist-info → holmesgpt-0.16.0.dist-info}/WHEEL +0 -0
- {holmesgpt-0.15.0.dist-info → holmesgpt-0.16.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import logging
|
|
3
|
-
|
|
4
|
-
from functools import wraps
|
|
5
|
-
|
|
6
|
-
from holmes.common.env_vars import (
|
|
7
|
-
LOG_PERFORMANCE,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class PerformanceTiming:
|
|
12
|
-
def __init__(self, name):
|
|
13
|
-
self.ended = False
|
|
14
|
-
|
|
15
|
-
self.name = name
|
|
16
|
-
self.start_time = time.time()
|
|
17
|
-
self.last_measure_time = self.start_time
|
|
18
|
-
self.last_measure_label = "Start"
|
|
19
|
-
self.timings = []
|
|
20
|
-
|
|
21
|
-
def measure(self, label):
|
|
22
|
-
if not LOG_PERFORMANCE:
|
|
23
|
-
return
|
|
24
|
-
if self.ended:
|
|
25
|
-
raise Exception("cannot measure a perf timing that is already ended")
|
|
26
|
-
current_time = time.time()
|
|
27
|
-
|
|
28
|
-
time_since_start = int((current_time - self.start_time) * 1000)
|
|
29
|
-
time_since_last = int((current_time - self.last_measure_time) * 1000)
|
|
30
|
-
|
|
31
|
-
self.timings.append((label, time_since_last, time_since_start))
|
|
32
|
-
|
|
33
|
-
self.last_measure_time = current_time
|
|
34
|
-
self.last_measure_label = label
|
|
35
|
-
|
|
36
|
-
def end(self, custom_message: str = ""):
|
|
37
|
-
if not LOG_PERFORMANCE:
|
|
38
|
-
return
|
|
39
|
-
self.ended = True
|
|
40
|
-
current_time = time.time()
|
|
41
|
-
time_since_start = int((current_time - self.start_time) * 1000)
|
|
42
|
-
message = f"{self.name} {custom_message} {time_since_start}ms"
|
|
43
|
-
logging.info(message)
|
|
44
|
-
if LOG_PERFORMANCE:
|
|
45
|
-
for label, time_since_last, time_since_start in self.timings:
|
|
46
|
-
logging.info(
|
|
47
|
-
f"\t{self.name}({label}) +{time_since_last}ms {time_since_start}ms"
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def log_function_timing(label=None):
|
|
52
|
-
def decorator(func):
|
|
53
|
-
@wraps(func)
|
|
54
|
-
def function_timing_wrapper(*args, **kwargs):
|
|
55
|
-
start_time = time.perf_counter()
|
|
56
|
-
result = func(*args, **kwargs)
|
|
57
|
-
end_time = time.perf_counter()
|
|
58
|
-
total_time = int((end_time - start_time) * 1000)
|
|
59
|
-
|
|
60
|
-
function_identifier = (
|
|
61
|
-
f'"{label}: {func.__name__}()"' if label else f'"{func.__name__}()"'
|
|
62
|
-
)
|
|
63
|
-
logging.info(f"Function {function_identifier} took {total_time}ms")
|
|
64
|
-
return result
|
|
65
|
-
|
|
66
|
-
return function_timing_wrapper
|
|
67
|
-
|
|
68
|
-
if callable(label):
|
|
69
|
-
func = label
|
|
70
|
-
label = None
|
|
71
|
-
return decorator(func)
|
|
72
|
-
return decorator
|
|
File without changes
|
|
File without changes
|
|
File without changes
|