@@ -44,6 +44,7 @@ def format(self, record):
4444
4545class Env :
4646 """Runtime environment singleton."""
47+
4748 config : Config
4849 connections : dict [str , mc .types .LLMAsyncFunctionType ]
4950 debug : bool
@@ -66,9 +67,7 @@ def init(config: Config | str | PathLike, debug: bool = False):
6667 if isinstance (config , (str , PathLike )):
6768 config = Config .load (config )
6869 else :
69- raise ValueError (
70- "config must be a path (str or PathLike) or Config instance"
71- )
70+ raise ValueError ("config must be a path (str or PathLike) or Config instance" )
7271 env .config = config
7372
7473 env ._init_components ()
@@ -84,18 +83,12 @@ def init(config: Config | str | PathLike, debug: bool = False):
8483 if inspect .iscoroutinefunction (conn_config ):
8584 env .connections [conn_name ] = conn_config
8685 elif isinstance (conn_config , str ):
87- env .connections [conn_name ] = resolve_instance_or_callable (
88- conn_config
89- )
86+ env .connections [conn_name ] = resolve_instance_or_callable (conn_config )
9087 else :
91- mc .configure (
92- ** conn_config , EMBEDDING_DB_TYPE = mc .EmbeddingDbType .NONE
93- )
88+ mc .configure (** conn_config , EMBEDDING_DB_TYPE = mc .EmbeddingDbType .NONE )
9489 env .connections [conn_name ] = mc .env ().llm_async_function
9590 except mc .LLMConfigError as e :
96- raise ValueError (
97- f"Error in configuration for connection '{ conn_name } ': { e } "
98- ) from e
91+ raise ValueError (f"Error in configuration for connection '{ conn_name } ': { e } " ) from e
9992
10093 logging .info ("Done initializing %d connections." , len (env .connections ))
10194
0 commit comments