Skip to content

Commit dbaa7ce

Browse files
authored
FIX Add missing function and tool serializer (microsoft#1153)
1 parent ac714b1 commit dbaa7ce

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

pyrit/models/data_type_serializer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def data_serializer_factory(
5454
f"The 'category' argument is mandatory and must be one of the following: {get_args(AllowedCategories)}."
5555
)
5656
if value is not None:
57-
if data_type in ["text", "reasoning"]:
58-
return TextDataTypeSerializer(prompt_text=value)
57+
if data_type in ["text", "reasoning", "function_call", "tool_call", "function_call_output"]:
58+
return TextDataTypeSerializer(prompt_text=value, data_type=data_type)
5959
elif data_type == "image_path":
6060
return ImagePathDataTypeSerializer(category=category, prompt_text=value, extension=extension)
6161
elif data_type == "audio_path":
@@ -297,9 +297,8 @@ def _is_azure_storage_url(self, path: str) -> bool:
297297

298298

299299
class TextDataTypeSerializer(DataTypeSerializer):
300-
301-
def __init__(self, *, prompt_text: str):
302-
self.data_type = "text"
300+
def __init__(self, *, prompt_text: str, data_type: PromptDataType = "text"):
301+
self.data_type = data_type
303302
self.value = prompt_text
304303

305304
def data_on_disk(self) -> bool:

0 commit comments

Comments
 (0)