-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR has mostly 3 changes: - Improvement of the prompt to prevent the LLM mentioning separately `kubectl logs` and `kubectl logs --previous` - Introduction of a test suite for investigations, including the ability to mock the DB access - Integration with brantrust,dev although that code is currently commented out as I need to talk to them as I hit the freemium limits. It's a big PR and most of it is the refactor of the existing mock mechanism to work well with the DAL.
- Loading branch information
Showing
153 changed files
with
3,622 additions
and
1,901 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,3 +161,5 @@ cython_debug/ | |
playwright.png | ||
.deepeval* | ||
pyrightconfig.json | ||
|
||
*.AUTOGENERATED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
from rich.console import Console | ||
from holmes.common.env_vars import ALLOWED_TOOLSETS, HOLMES_POST_PROCESSING_PROMPT | ||
from holmes.config import Config | ||
from holmes.core.issue import Issue | ||
from holmes.core.models import InvestigateRequest, InvestigationResult | ||
from holmes.core.supabase_dal import SupabaseDal | ||
from holmes.utils.robusta import load_robusta_api_key | ||
|
||
|
||
def investigate_issues(investigate_request: InvestigateRequest, dal: SupabaseDal, config: Config, console:Console): | ||
load_robusta_api_key(dal=dal, config=config) | ||
context = dal.get_issue_data( | ||
investigate_request.context.get("robusta_issue_id") | ||
) | ||
|
||
resource_instructions = dal.get_resource_instructions( | ||
"alert", investigate_request.context.get("issue_type") | ||
) | ||
raw_data = investigate_request.model_dump() | ||
if context: | ||
raw_data["extra_context"] = context | ||
|
||
ai = config.create_issue_investigator( | ||
console, allowed_toolsets=ALLOWED_TOOLSETS, dal=dal | ||
) | ||
issue = Issue( | ||
id=context["id"] if context else "", | ||
name=investigate_request.title, | ||
source_type=investigate_request.source, | ||
source_instance_id=investigate_request.source_instance_id, | ||
raw=raw_data, | ||
) | ||
|
||
investigation = ai.investigate( | ||
issue, | ||
prompt=investigate_request.prompt_template, | ||
console=console, | ||
post_processing_prompt=HOLMES_POST_PROCESSING_PROMPT, | ||
instructions=resource_instructions, | ||
) | ||
|
||
return InvestigationResult( | ||
analysis=investigation.result, | ||
tool_calls=investigation.tool_calls or [], | ||
instructions=investigation.instructions, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.