File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class HolmesIssueChatRequest(HolmesChatRequest):
4747class ToolCallResult (BaseModel ):
4848 tool_name : str
4949 description : str
50- result : str
50+ result : Union [ str , dict ] # dict is for new structured output results and string to support old versions of holmes
5151
5252
5353class HolmesResult (BaseModel ):
Original file line number Diff line number Diff line change @@ -89,7 +89,12 @@ def get_empty_file_object(block: EmptyFileBlock):
8989 @staticmethod
9090 def append_to_structured_data_tool_calls (tool_calls : List [ToolCallResult ], structured_data ) -> None :
9191 for tool_call in tool_calls :
92- file_block = FileBlock (f"{ tool_call .description } .txt" , tool_call .result .encode ())
92+ if isinstance (tool_call .result , str ):
93+ result = tool_call .result .encode ()
94+ elif isinstance (tool_call .result , dict ):
95+ result = json .dumps (tool_call .result ).encode ()
96+
97+ file_block = FileBlock (f"{ tool_call .description } .txt" , result )
9398 file_block .zip ()
9499 data_obj = ModelConversion .get_file_object (file_block )
95100 data_obj ["metadata" ] = {"description" : tool_call .description , "tool_name" : tool_call .tool_name }
You can’t perform that action at this time.
0 commit comments