plexus.scores.AWSComprehendEntityExtractor module

class plexus.scores.AWSComprehendEntityExtractor.AWSComprehendEntityExtractor(**parameters)

Bases: Score

This score uses AWS Comprehend to extract the first named entity from the transcript.

Initialize the Score instance with the given parameters.

Parameters

**parametersdict

Arbitrary keyword arguments that are used to initialize the Parameters instance.

Raises

ValidationError

If the provided parameters do not pass validation.

class Result(*, parameters: Parameters, value: str | bool, metadata: dict = {}, error: str | None = None, explanation: str)

Bases: Result

Model output data structure.

Attributes

scorestr

The predicted score label.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

explanation: str
model_config: ClassVar[ConfigDict] = {'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

__init__(**parameters)

Initialize the Score instance with the given parameters.

Parameters

**parametersdict

Arbitrary keyword arguments that are used to initialize the Parameters instance.

Raises

ValidationError

If the provided parameters do not pass validation.

extract_first_person_entity(transcript: str) str
extract_quotes_that_include_first_person_entity(transcript: str, first_person_entity: str) list[str]
predict(context, model_input: Input)

Make predictions on the input data.

Parameters

contextAny

Context for the prediction (e.g., MLflow context)

model_inputScore.Input

The input data for making predictions.

Returns

Union[Score.Result, List[Score.Result]]

Either a single Score.Result or a list of Score.Results

predict_validation()

Placeholder method to satisfy the base class requirement. This validator doesn’t require traditional training.

register_model()

Register the model with MLflow by logging relevant parameters.

save_model()

Save the model to a specified path and log it as an artifact with MLflow.

train_model()

Placeholder method to satisfy the base class requirement. This validator doesn’t require traditional training.