pyrit.models.construct_response_from_request#
- construct_response_from_request(request: MessagePiece, response_text_pieces: list[str], response_type: Literal['text', 'image_path', 'audio_path', 'video_path', 'binary_path', 'url', 'reasoning', 'error', 'function_call', 'tool_call', 'function_call_output'] = 'text', prompt_metadata: dict[str, str | int] | None = None, error: Literal['blocked', 'none', 'processing', 'empty', 'unknown'] = 'none') Message[source]#
Construct a response message from a request message piece.
- Parameters:
request (MessagePiece) – Source request message piece.
response_text_pieces (list[str]) – Response values to include.
response_type (PromptDataType) – Data type for original and converted response values.
prompt_metadata (Optional[Dict[str, Union[str, int]]]) – Additional metadata to merge.
error (PromptResponseError) – Error classification for the response.
- Returns:
Constructed response message.
- Return type: