From: offina Date: Sat, 20 Sep 2025 08:26:05 +0000 (+0900) Subject: Add agent variables to training manager configuration X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=03fffa2a2d4f55a36abb3f06d6388c6683f18696;p=aiml-fw%2Fawmf%2Ftm.git Add agent variables to training manager configuration Enable AIMLFW to read the user's agent settings via environment variables, with optional overrides from the recipe file. Issue-ID: AIMLFW-253 Change-Id: If9425c5fd0f34c60a50b0ee5949cda46fac3f1fc Signed-off-by: offina --- diff --git a/trainingmgr/common/trainingmgr_config.py b/trainingmgr/common/trainingmgr_config.py index 6815b3e..a06e606 100644 --- a/trainingmgr/common/trainingmgr_config.py +++ b/trainingmgr/common/trainingmgr_config.py @@ -42,7 +42,7 @@ class TrainingMgrConfig: """ if self.__initialized: return - + self.__kf_adapter_port = getenv('KF_ADAPTER_PORT').rstrip() if getenv('KF_ADAPTER_PORT') is not None else None self.__kf_adapter_ip = getenv('KF_ADAPTER_IP').rstrip() if getenv('KF_ADAPTER_IP') is not None else None @@ -63,6 +63,9 @@ class TrainingMgrConfig: self.__allow_control_access_origin = getenv('ACCESS_CONTROL_ALLOW_ORIGIN').rstrip() if getenv('ACCESS_CONTROL_ALLOW_ORIGIN') is not None else None self.__pipeline = getenv('PIPELINE').rstrip() if getenv('PIPELINE') is not None else None + self.__llm_agent_model_for_tm = getenv('LLM_AGENT_MODEL_FOR_TM').rstrip() if getenv('LLM_AGENT_MODEL_FOR_TM') is not None else None + self.__llm_agent_model_token_for_tm = getenv('LLM_AGENT_MODEL_TOKEN_FOR_TM').rstrip() if getenv('LLM_AGENT_MODEL_TOKEN_FOR_TM') is not None else None + conf_filepath = getenv("CONF_LOG", "common/conf_log.yaml") self.tmgr_logger = TMLogger(conf_filepath) self.__logger = self.tmgr_logger.logger @@ -199,7 +202,7 @@ class TrainingMgrConfig: port number where postgres db is accessible """ return self.__ps_port - + @property def model_management_service_port(self): """ @@ -210,7 +213,7 @@ class TrainingMgrConfig: string model_management_service_port """ return self.__model_management_service_port - + @property def model_management_service_ip(self): @@ -232,7 +235,7 @@ class TrainingMgrConfig: Returns: string allow_control_access_origin - + """ return self.__allow_control_access_origin @@ -245,29 +248,52 @@ class TrainingMgrConfig: Returns: string pipelines - + """ return self.__pipeline + @property + def llm_agent_model_for_tm(self): + """ + Retrieves the name of the LLM agent model for the training manager + Args:None + + Returns: + LLM agent's model + """ + return self.__llm_agent_model_for_tm + + @property + def llm_agent_model_token_for_tm(self): + """ + Retrieves api token of the LLM agent model for the training manager + Args:None + + Returns: + LLM agent's model API token + """ + return self.__llm_agent_model_token_for_tm + def is_config_loaded_properly(self): """ This function checks where all environment variable got value or not. if all environment variables got value then function returns True otherwise it return False. """ - return all([val is not None for val in [self.__kf_adapter_ip, - self.__kf_adapter_port, - self.__data_extraction_ip, + return all([val is not None for val in [ + self.__kf_adapter_ip, + self.__kf_adapter_port, + self.__data_extraction_ip, self.__data_extraction_port, - self.__my_port, - self.__ps_ip, - self.__ps_port, - self.__ps_user, - self.__ps_password, self.__my_ip, - self.__model_management_service_ip, - self.__model_management_service_port, + self.__my_port, + self.__ps_ip, + self.__ps_port, + self.__ps_user, + self.__ps_password, + self.__model_management_service_ip, + self.__model_management_service_port, self.__allow_control_access_origin, - self.__pipeline, - self.__logger]]) - + self.__pipeline, + self.__logger + ]])