Custom registration#
genai_monitor.registration.api.register_function
#
register_function(
func: Callable,
model_output_to_bytes: Callable[[Any], bytes],
bytes_to_model_output: Callable[[bytes], Any],
model_output_to_base_type: Optional[
Callable[[Any], BaseType]
] = None,
parse_inference_method_arguments: Optional[
Callable[[Dict[str, Any]], Jsonable]
] = None,
model_hashing_function: Optional[
Callable[[object], str]
] = None,
max_unique_instances: int = 1,
)
Registers a function.
PARAMETER | DESCRIPTION |
---|---|
func
|
The function to register.
TYPE:
|
model_output_to_bytes
|
The function to convert the model output to bytes.
TYPE:
|
bytes_to_model_output
|
The function to convert bytes to the model output.
TYPE:
|
model_output_to_base_type
|
The function to convert the model output to a base type.
TYPE:
|
parse_inference_method_arguments
|
The function to parse the inference method arguments.
TYPE:
|
model_hashing_function
|
The function to hash the model.
TYPE:
|
max_unique_instances
|
The maximum number of unique sample instances for each conditioning.
TYPE:
|
Source code in src/genai_monitor/registration/api.py
genai_monitor.registration.api.register_class
#
register_class(
cls: Type,
inference_methods: List[str],
model_output_to_bytes: Callable[[Any], bytes],
bytes_to_model_output: Callable[[bytes], Any],
model_output_to_base_type: Optional[
Callable[[Any], BaseType]
] = None,
parse_inference_method_arguments: Optional[
Callable[[Dict[str, Any]], Jsonable]
] = None,
model_hashing_function: Optional[
Callable[[object], str]
] = None,
max_unique_instances: int = 1,
)
Registers a class with inference methods.
PARAMETER | DESCRIPTION |
---|---|
cls
|
The class to register.
TYPE:
|
inference_methods
|
The names of the inference methods.
TYPE:
|
model_output_to_bytes
|
The function to convert the model output to bytes.
TYPE:
|
bytes_to_model_output
|
The function to convert bytes to the model output.
TYPE:
|
model_output_to_base_type
|
The function to convert the model output to a base type.
TYPE:
|
parse_inference_method_arguments
|
The function to parse the inference method arguments.
TYPE:
|
model_hashing_function
|
The function to hash the model.
TYPE:
|
max_unique_instances
|
The maximum number of unique sample instances for each conditioning.
TYPE:
|