iiiiSaber commented on code in PR #438:
URL: https://github.com/apache/hugegraph-ai/pull/438#discussion_r4657898448
##########
hugegraph-llm/src/hugegraph_llm/config/models/base_prompt_config.py:
##########
@@ -91,12 +91,17 @@ class BasePromptConfig:
def ensure_yaml_file_exists(self):
if os.path.exists(yaml_file_path):
- log.info("Loading prompt file '%s' successfully.", F_NAME)
with open(yaml_file_path, "r", encoding="utf-8") as file:
data = yaml.safe_load(file)
- # Load existing values from the YAML file into the class
attributes
- for key, value in data.items():
- setattr(self, key, value)
+
+ if data is None:
+ self._set_language_defaults()
+ log.info("Prompt file %s is empty; using built-in defaults
without writing", yaml_file_path)
Review Comment:
Thanks for catching the reload case. Fixed in `9851a6c`. The empty-file
reload now clears overrides for every field written by the YAML serializer.
Both paths use the same field mapping.
The regression test loads overrides, empties the file, and reloads it on the
same `PromptConfig` instance. It verifies that the built-in values return and
the file stays empty. All 19 targeted tests passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]