nemo_evaluator.adapters.registry#

Core registry system for interceptors and post-evaluation hooks with interface awareness.

Module Contents#

Classes#

InterceptorMetadata

Metadata for registered interceptors and post-evaluation hooks

InterceptorRegistry

Central registry for all interceptors and post-evaluation hooks with interface awareness. Singleton.

Data#

API#

class nemo_evaluator.adapters.registry.InterceptorMetadata[source]#

Metadata for registered interceptors and post-evaluation hooks

description: str#

None

init_schema: Type[pydantic.BaseModel] | None#

None

interceptor_class: Type[nemo_evaluator.adapters.types.RequestInterceptor | nemo_evaluator.adapters.types.ResponseInterceptor | nemo_evaluator.adapters.types.RequestToResponseInterceptor | nemo_evaluator.adapters.types.PostEvalHook]#

None

name: str#

None

supports_post_eval_hook() bool[source]#

Check if this is a post-evaluation hook

supports_request_interception() bool[source]#

Check if this interceptor can handle requests

supports_request_to_response_interception() bool[source]#

Check if this interceptor can handle request-to-response interception

supports_response_interception() bool[source]#

Check if this interceptor can handle responses

class nemo_evaluator.adapters.registry.InterceptorRegistry[source]#

Central registry for all interceptors and post-evaluation hooks with interface awareness. Singleton.

Initialization

clear_cache() None[source]#

Clear the instance cache

discover_components(
modules: list[str] | None = None,
dirs: list[str] | None = None,
) None[source]#

Auto-discover interceptors and post-evaluation hooks from modules and directories.

Args: modules: List of module paths to import and discover components from dirs: List of directory paths to scan for Python files with components

get_all_components() dict[str, nemo_evaluator.adapters.registry.InterceptorMetadata][source]#

Get all available components (interceptors and post-eval hooks)

classmethod get_instance() nemo_evaluator.adapters.registry.InterceptorRegistry[source]#

Get the singleton instance of the registry

get_interceptors() dict[str, nemo_evaluator.adapters.registry.InterceptorMetadata][source]#

Get all interceptors (excluding post-eval hooks)

get_metadata(
name: str,
) nemo_evaluator.adapters.registry.InterceptorMetadata | None[source]#

Get metadata for a specific component

get_post_eval_hooks() dict[str, nemo_evaluator.adapters.registry.InterceptorMetadata][source]#

Get all post-evaluation hooks

is_post_eval_hook(name: str) bool[source]#

Check if a component is a post-evaluation hook

is_request_interceptor(name: str) bool[source]#

Check if a component supports request interception

is_request_to_response_interceptor(name: str) bool[source]#

Check if a component supports request-to-response interception

is_response_interceptor(name: str) bool[source]#

Check if a component supports response interception

register(
name: str,
interceptor_class: Type[nemo_evaluator.adapters.types.RequestInterceptor | nemo_evaluator.adapters.types.ResponseInterceptor | nemo_evaluator.adapters.types.RequestToResponseInterceptor | nemo_evaluator.adapters.types.PostEvalHook],
metadata: nemo_evaluator.adapters.registry.InterceptorMetadata,
) None[source]#

Register an interceptor or post-evaluation hook class with metadata

reset() None[source]#

Reset the registry (for testing)

nemo_evaluator.adapters.registry.logger#

‘get_logger(…)’