holmesgpt 0.14.4a0__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.

Files changed (37) hide show
  1. holmes/__init__.py +1 -1
  2. holmes/clients/robusta_client.py +12 -10
  3. holmes/common/env_vars.py +22 -0
  4. holmes/config.py +51 -4
  5. holmes/core/conversations.py +3 -2
  6. holmes/core/llm.py +226 -72
  7. holmes/core/openai_formatting.py +13 -0
  8. holmes/core/supabase_dal.py +33 -42
  9. holmes/core/tool_calling_llm.py +185 -282
  10. holmes/core/tools.py +21 -1
  11. holmes/core/tools_utils/token_counting.py +2 -1
  12. holmes/core/tools_utils/tool_context_window_limiter.py +32 -30
  13. holmes/core/truncation/compaction.py +59 -0
  14. holmes/core/truncation/input_context_window_limiter.py +218 -0
  15. holmes/interactive.py +17 -7
  16. holmes/plugins/prompts/_general_instructions.jinja2 +1 -2
  17. holmes/plugins/prompts/conversation_history_compaction.jinja2 +88 -0
  18. holmes/plugins/toolsets/__init__.py +4 -0
  19. holmes/plugins/toolsets/atlas_mongodb/mongodb_atlas.py +0 -1
  20. holmes/plugins/toolsets/azure_sql/azure_sql_toolset.py +0 -1
  21. holmes/plugins/toolsets/grafana/grafana_api.py +1 -1
  22. holmes/plugins/toolsets/investigator/core_investigation.py +34 -24
  23. holmes/plugins/toolsets/opensearch/opensearch_ppl_query_docs.jinja2 +1616 -0
  24. holmes/plugins/toolsets/opensearch/opensearch_query_assist.py +78 -0
  25. holmes/plugins/toolsets/opensearch/opensearch_query_assist_instructions.jinja2 +223 -0
  26. holmes/plugins/toolsets/prometheus/prometheus.py +1 -1
  27. holmes/plugins/toolsets/robusta/robusta.py +35 -8
  28. holmes/plugins/toolsets/robusta/robusta_instructions.jinja2 +4 -3
  29. holmes/plugins/toolsets/service_discovery.py +1 -1
  30. holmes/plugins/toolsets/servicenow/servicenow.py +0 -1
  31. holmes/utils/stream.py +31 -1
  32. {holmesgpt-0.14.4a0.dist-info → holmesgpt-0.16.0.dist-info}/METADATA +6 -2
  33. {holmesgpt-0.14.4a0.dist-info → holmesgpt-0.16.0.dist-info}/RECORD +36 -31
  34. holmes/core/performance_timing.py +0 -72
  35. {holmesgpt-0.14.4a0.dist-info → holmesgpt-0.16.0.dist-info}/LICENSE.txt +0 -0
  36. {holmesgpt-0.14.4a0.dist-info → holmesgpt-0.16.0.dist-info}/WHEEL +0 -0
  37. {holmesgpt-0.14.4a0.dist-info → holmesgpt-0.16.0.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
  import os
3
3
  from typing import Any, Dict
4
+
4
5
  from uuid import uuid4
5
6
 
6
7
  from holmes.core.todo_tasks_formatter import format_tasks
@@ -15,9 +16,26 @@ from holmes.core.tools import (
15
16
  )
16
17
  from holmes.plugins.toolsets.investigator.model import Task, TaskStatus
17
18
 
19
+ TODO_WRITE_TOOL_NAME = "TodoWrite"
20
+
21
+
22
+ def parse_tasks(todos_data: Any) -> list[Task]:
23
+ tasks = []
24
+
25
+ for todo_item in todos_data:
26
+ if isinstance(todo_item, dict):
27
+ task = Task(
28
+ id=todo_item.get("id", str(uuid4())),
29
+ content=todo_item.get("content", ""),
30
+ status=TaskStatus(todo_item.get("status", "pending")),
31
+ )
32
+ tasks.append(task)
33
+
34
+ return tasks
35
+
18
36
 
19
37
  class TodoWriteTool(Tool):
20
- name: str = "TodoWrite"
38
+ name: str = TODO_WRITE_TOOL_NAME
21
39
  description: str = "Save investigation tasks to break down complex problems into manageable sub-tasks. ALWAYS provide the COMPLETE list of all tasks, not just the ones being updated."
22
40
  parameters: Dict[str, ToolParameter] = {
23
41
  "todos": ToolParameter(
@@ -29,7 +47,11 @@ class TodoWriteTool(Tool):
29
47
  properties={
30
48
  "id": ToolParameter(type="string", required=True),
31
49
  "content": ToolParameter(type="string", required=True),
32
- "status": ToolParameter(type="string", required=True),
50
+ "status": ToolParameter(
51
+ type="string",
52
+ required=True,
53
+ enum=["pending", "in_progress", "completed"],
54
+ ),
33
55
  },
34
56
  ),
35
57
  ),
@@ -58,39 +80,28 @@ class TodoWriteTool(Tool):
58
80
  content_width = max(max_content_width, len("Content"))
59
81
  status_width = max(max_status_display_width, len("Status"))
60
82
 
61
- # Build table
62
83
  separator = f"+{'-' * (id_width + 2)}+{'-' * (content_width + 2)}+{'-' * (status_width + 2)}+"
63
84
  header = f"| {'ID':<{id_width}} | {'Content':<{content_width}} | {'Status':<{status_width}} |"
64
-
65
- # Log the table
66
- logging.info("Updated Investigation Tasks:")
67
- logging.info(separator)
68
- logging.info(header)
69
- logging.info(separator)
85
+ tasks_to_display = []
70
86
 
71
87
  for task in tasks:
72
88
  status_display = f"{status_icons[task.status.value]} {task.status.value}"
73
89
  row = f"| {task.id:<{id_width}} | {task.content:<{content_width}} | {status_display:<{status_width}} |"
74
- logging.info(row)
90
+ tasks_to_display.append(row)
75
91
 
76
- logging.info(separator)
92
+ logging.info(
93
+ f"Task List:\n{separator}\n{header}\n{separator}\n"
94
+ + "\n".join(tasks_to_display)
95
+ + f"\n{separator}"
96
+ )
77
97
 
78
98
  def _invoke(self, params: dict, context: ToolInvokeContext) -> StructuredToolResult:
79
99
  try:
80
100
  todos_data = params.get("todos", [])
81
101
 
82
- tasks = []
83
-
84
- for todo_item in todos_data:
85
- if isinstance(todo_item, dict):
86
- task = Task(
87
- id=todo_item.get("id", str(uuid4())),
88
- content=todo_item.get("content", ""),
89
- status=TaskStatus(todo_item.get("status", "pending")),
90
- )
91
- tasks.append(task)
102
+ tasks = parse_tasks(todos_data=todos_data)
92
103
 
93
- logging.info(f"Tasks: {len(tasks)}")
104
+ logging.debug(f"Tasks: {len(tasks)}")
94
105
 
95
106
  self.print_tasks_table(tasks)
96
107
  formatted_tasks = format_tasks(tasks)
@@ -116,8 +127,7 @@ class TodoWriteTool(Tool):
116
127
  )
117
128
 
118
129
  def get_parameterized_one_liner(self, params: Dict) -> str:
119
- todos = params.get("todos", [])
120
- return f"Write {todos} investigation tasks"
130
+ return "Update investigation tasks"
121
131
 
122
132
 
123
133
  class CoreInvestigationToolset(Toolset):