nat.middleware.dynamic.dynamic_middleware_config#

Configuration for dynamic middleware.

Classes#

AllowedComponentFunctions

Component functions allowed for auto-registration.

DynamicMiddlewareConfig

Configuration for dynamic middleware.

Module Contents#

class AllowedComponentFunctions(/, **data: Any)#

Bases: pydantic.BaseModel

Component functions allowed for auto-registration.

Default allowlists are provided for each component type. User-provided values are automatically merged with defaults. Set to None or omit to use only defaults.

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.

llms: set[str] | None = None#
embedders: set[str] | None = None#
retrievers: set[str] | None = None#
memory: set[str] | None = None#
object_stores: set[str] | None = None#
authentication: set[str] | None = None#
merge_with_defaults()#

Merge user-provided values with defaults from COMPONENT_FUNCTION_ALLOWLISTS.

class DynamicMiddlewareConfig(/, **data: Any)#

Bases: nat.data_models.middleware.FunctionMiddlewareBaseConfig

Configuration for dynamic middleware.

Controls which components and functions to intercept, and which policies to apply. Supports explicit component references and auto-discovery flags.

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.

llms: list[nat.data_models.component_ref.LLMRef] | None = None#
embedders: list[nat.data_models.component_ref.EmbedderRef] | None = None#
retrievers: list[nat.data_models.component_ref.RetrieverRef] | None = None#
memory: list[nat.data_models.component_ref.MemoryRef] | None = None#
object_stores: list[nat.data_models.component_ref.ObjectStoreRef] | None = None#
auth_providers: list[nat.data_models.component_ref.AuthenticationRef] | None = None#
register_llms: bool | None = None#
register_embedders: bool | None = None#
register_retrievers: bool | None = None#
register_memory: bool | None = None#
register_object_stores: bool | None = None#
register_auth_providers: bool | None = None#
register_workflow_functions: bool | None = None#
enabled: bool = None#
allowed_component_functions: AllowedComponentFunctions | None = None#