From f73e858c65a7d864ffe3e8eaecb1d8cbef954e9a Mon Sep 17 00:00:00 2001 From: Jenn Mueng <30991498+jennmueng@users.noreply.github.com> Date: Tue, 17 Dec 2024 02:54:02 -0800 Subject: [PATCH] Refactor and Cleanup of Root Cause Models --- .../autofix/components/root_cause/models.py | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/src/seer/automation/autofix/components/root_cause/models.py b/src/seer/automation/autofix/components/root_cause/models.py index 2bc5251c5..e191bdf2a 100644 --- a/src/seer/automation/autofix/components/root_cause/models.py +++ b/src/seer/automation/autofix/components/root_cause/models.py @@ -38,34 +38,13 @@ class RootCauseRelevantContext(BaseModel): description: str snippet: Optional[RootCauseRelevantCodeSnippet] - class RootCauseAnalysisRelevantContext(BaseModel): snippets: list[RootCauseRelevantContext] - -class UnitTestSnippetPrompt(BaseModel): - file_path: str - code_snippet: str - description: str - - @field_validator("code_snippet") - @classmethod - def clean_code_snippet(cls, v: str) -> str: - return remove_code_backticks(v) - - -class UnitTestSnippet(BaseModel): - file_path: str - snippet: str - description: str - - class RootCauseAnalysisItem(BaseModel): id: int = -1 title: str description: str - # unit_test: UnitTestSnippet | None = None - # reproduction: str | None = None code_context: Optional[list[RootCauseRelevantContext]] = None def to_markdown_string(self) -> str: @@ -91,8 +70,6 @@ def to_markdown_string(self) -> str: class RootCauseAnalysisItemPrompt(BaseModel): title: str description: str - # reproduction_instructions: str | None = None - # unit_test: UnitTestSnippetPrompt | None = None relevant_code: Optional[RootCauseAnalysisRelevantContext] @classmethod @@ -100,16 +77,6 @@ def from_model(cls, model: RootCauseAnalysisItem): return cls( title=model.title, description=model.description, - # reproduction_instructions=model.reproduction, - # unit_test=( - # UnitTestSnippetPrompt( - # file_path=model.unit_test.file_path, - # code_snippet=model.unit_test.snippet, - # description=model.unit_test.description, - # ) - # if model.unit_test - # else None - # ), relevant_code=( RootCauseAnalysisRelevantContext( snippets=[ @@ -131,16 +98,6 @@ def to_model(self): return RootCauseAnalysisItem.model_validate( { **self.model_dump(), - # "reproduction": self.reproduction_instructions, - # "unit_test": ( - # { - # "file_path": self.unit_test.file_path, - # "snippet": self.unit_test.code_snippet, - # "description": self.unit_test.description, - # } - # if self.unit_test - # else None - # ), "code_context": ( self.relevant_code.model_dump()["snippets"] if self.relevant_code else None ),