semantic_router.layer.LayerConfig#

class semantic_router.layer.LayerConfig(routes: List[Route] = [], encoder_type: str = 'openai', encoder_name: str | None = None)#

Bases: object

Generates a LayerConfig object that can be used for initializing a RouteLayer.

__init__(routes: List[Route] = [], encoder_type: str = 'openai', encoder_name: str | None = None)#

Methods

__init__([routes, encoder_type, encoder_name])

add(route)

from_file(path)

get(name)

remove(name)

to_dict()

to_file(path)

Save the routes to a file in JSON or YAML format

Attributes

routes

to_file(path: str)#

Save the routes to a file in JSON or YAML format