langtest.modelhandler.lmstudio_modelhandler.PretrainedModelForSecurity#
- class PretrainedModelForSecurity(model: Any, output_parser: Callable | None = None, **kwargs)#
Bases:
PretrainedModel
,ModelAPI
A class representing a pretrained model for security detection.
- Inherits:
PretrainedModel: The base class for pretrained models.
- __init__(model: Any, output_parser: Callable | None = None, **kwargs) None #
Initialize the PretrainedModel.
- Parameters:
model (Any) – The pretrained model to be used.
**kwargs – Additional keyword arguments.
Methods
__init__
(model[, output_parser])Initialize the PretrainedModel.
load_model
(path, *args, **kwargs)Load the pretrained model.
predict
(text, prompt, server_prompt, *args, ...)Predicts the output for the given input text.
predict_raw
(text, prompt, server_prompt, ...)Predicts the output for the given input text without caching.
Attributes
model_registry
- classmethod load_model(path: str, *args, **kwargs) Any #
Load the pretrained model.
- Parameters:
path (str) – The path to the pretrained model.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
The loaded pretrained model.
- Return type:
Any
- predict(text: str | dict, prompt: dict, server_prompt, *args, **kwargs)#
Predicts the output for the given input text.
- Parameters:
text (Union[str, dict]) – The input text or dictionary.
prompt (dict) – The prompt for the prediction.
server_prompt (str) – The server prompt for the chat.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
The predicted output.
- Return type:
str
- predict_raw(text: str | dict, prompt: dict, server_prompt: str, *args, **kwargs)#
Predicts the output for the given input text without caching.
- Parameters:
text (Union[str, dict]) – The input text or dictionary.
prompt (dict) – The prompt for the prediction.
server_prompt (str) – The server prompt for the chat.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments.
- Returns:
The predicted output.
- Return type:
str