feat(llm): support configurations with YAML#277
feat(llm): support configurations with YAML#277try-agaaain wants to merge 3 commits intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the legacy .env configuration management with YAML-based configuration to streamline and centralize configuration handling. Key changes include the replacement of update_env calls with update_configs, updates to the BaseConfig class to support YAML generation and synchronization, and dependency updates across requirements and build files.
- Replaced .env-related functions with YAML-based functions in configuration blocks.
- Refactored BaseConfig to generate, update, and check YAML configurations.
- Updated project dependencies and .gitignore to support YAML.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| hugegraph-llm/src/hugegraph_llm/demo/rag_demo/configs_block.py | Replaced update_env with update_configs in configuration functions. |
| hugegraph-llm/src/hugegraph_llm/config/models/base_config.py | Refactored configuration syncing logic to use YAML instead of .env. |
| hugegraph-llm/requirements.txt | Added OmegaConf dependency. |
| hugegraph-llm/pyproject.toml | Updated dependencies (Gradio and OmegaConf). |
| hugegraph-llm/.gitignore | Configured to ignore config.yaml. |
| current_class_name = self.__class__.__name__ | ||
| with open(yaml_path, "r", encoding="utf-8") as f: | ||
| content = f.read() | ||
| yaml_config = yaml.safe_load(content) if content.strip() else {} |
There was a problem hiding this comment.
Before iterating over the YAML config section, ensure that current_class_name exists as a key in yaml_config. Consider initializing yaml_config[current_class_name] to an empty dict if it does not exist to prevent potential KeyError.
| yaml_config = yaml.safe_load(content) if content.strip() else {} | |
| yaml_config = yaml.safe_load(content) if content.strip() else {} | |
| current_class_name = self.__class__.__name__ | |
| if current_class_name not in yaml_config: | |
| yaml_config[current_class_name] = {} |
| if yaml_file_config.get(current_class_name): | ||
| self._sync_yaml_to_object(yaml_file_config, object_config_dict) | ||
|
|
||
| # Step 2: Add missing onfig items from object to yaml.config |
There was a problem hiding this comment.
There is a minor typo in the comment ('onfig' should be 'config') – please correct it for clarity.
| # Step 2: Add missing onfig items from object to yaml.config | |
| # Step 2: Add missing config items from object to yaml.config |
| pydantic-settings~=2.6.1 | ||
| apscheduler~=3.10.4 | ||
| litellm~=1.61.13 | ||
| OmegaConf~=2.3 No newline at end of file |
There was a problem hiding this comment.
| OmegaConf~=2.3 | |
| OmegaConf~=2.3 | |
keep a line -> EOF
Link to #234
I'm working on replacing the
.envconfiguration method with YAML and have completed a preliminary implementation. (I'll switch to OmegaConf later)The generated configuration file looks like this:
config.yaml
The
LLMConfigsection has a large number of configuration items. Do there any suggestions on how to better organize and manage these configurations?