-
Notifications
You must be signed in to change notification settings - Fork 60
feat(llm): support configurations with YAML #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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] = {} |
Copilot uses AI. Check for mistakes.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot uses AI. Check for mistakes.
@@ -18,3 +18,4 @@ openpyxl~=3.1.5 | |||
pydantic-settings~=2.6.1 | |||
apscheduler~=3.10.4 | |||
litellm~=1.61.13 | |||
OmegaConf~=2.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OmegaConf~=2.3 | |
OmegaConf~=2.3 | |
keep a line -> EOF
Link to #234
I'm working on replacing the
.env
configuration 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
LLMConfig
section has a large number of configuration items. Do there any suggestions on how to better organize and manage these configurations?