Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/robusta/core/reporting/holmes.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class HolmesChatResult(BaseModel):
analysis: Optional[str] = None
tool_calls: Optional[List[ToolCallResult]] = None
conversation_history: Optional[List[dict]] = None
follow_up_actions: Optional[List[Any]] = None


class HolmesChatResultsBlock(BaseBlock):
Expand Down
15 changes: 12 additions & 3 deletions src/robusta/core/sinks/robusta/dal/model_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_file_type(filename: str):
return filename[last_dot_idx + 1 :]

@staticmethod
def get_file_object(block: FileBlock):
def get_file_object(block: FileBlock) -> Dict[str, Any]:
return {
"type": ModelConversion.get_file_type(block.filename),
"data": str(base64.b64encode(block.contents)),
Expand All @@ -98,14 +98,16 @@ def append_to_structured_data_tool_calls(tool_calls: List[ToolCallResult], struc

@staticmethod
def add_ai_chat_data(structured_data: List[Dict], block: HolmesChatResultsBlock):
if not block.holmes_result:
return
structured_data.append(
{
"type": "markdown",
"metadata": {"type": "ai_investigation_result", "createdAt": datetime_to_db_str(datetime.now())},
"data": Transformer.to_github_markdown(block.holmes_result.analysis),
"data": Transformer.to_github_markdown(block.holmes_result.analysis or ""),
}
)
ModelConversion.append_to_structured_data_tool_calls(block.holmes_result.tool_calls, structured_data)
ModelConversion.append_to_structured_data_tool_calls(block.holmes_result.tool_calls or [], structured_data)

conversation_history_block = FileBlock(
f"conversation_history-{datetime.now()}.txt",
Expand All @@ -116,6 +118,13 @@ def add_ai_chat_data(structured_data: List[Dict], block: HolmesChatResultsBlock)
conversation_history_obj["metadata"] = {"type": "conversation_history"}
structured_data.append(conversation_history_obj)

if block.holmes_result and block.holmes_result.follow_up_actions and len(block.holmes_result.follow_up_actions) > 0:
structured_data.append({
"type": "structured_data",
"metadata": {"type": "follow_up_actions"},
"data": block.holmes_result.follow_up_actions,
})

@staticmethod
def add_ai_analysis_data(structured_data: List[Dict], block: HolmesResultsBlock):
if not block.holmes_result:
Expand Down