-
Notifications
You must be signed in to change notification settings - Fork 6
add support for model parameters passing #98
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
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 adds support for passing model-specific parameters through the task configuration system, allowing users to configure model behavior at multiple levels (global defaults, model_config file, and per-task settings).
Key Changes
- Introduced a new parameter passing mechanism that allows model settings to be specified in
model_configfiles and per-task configurations - Modified the
deploy_task_agentsfunction to accept model parameters via a newmodel_parparameter - Added validation logic to ensure model settings are properly structured and correspond to defined models
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| src/seclab_taskflow_agent/main.py | Refactored model settings handling to support parameter passing from model_config and task definitions, added validation for model_settings structure |
| doc/GRAMMAR.md | Added documentation for the new model_settings task-level configuration option |
| README.md | Added documentation for the new model_settings section in model_config files, including validation rules and override behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default = 0.0), | ||
| 'tool_choice' : ('auto' if toolboxes else None), | ||
| 'parallel_tool_calls' : (parallel_tool_calls if toolboxes else None)} |
Copilot
AI
Nov 28, 2025
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.
Inconsistent spacing around the assignment operator. The code uses 'temperature' : os.getenv(...) with spaces around the colon, which is not standard Python style. According to PEP 8, dictionary keys should not have spaces around the colon. This should be 'temperature': os.getenv(...) (and similarly for the other keys).
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default = 0.0), | |
| 'tool_choice' : ('auto' if toolboxes else None), | |
| 'parallel_tool_calls' : (parallel_tool_calls if toolboxes else None)} | |
| model_params = {'temperature': os.getenv('MODEL_TEMP', default = 0.0), | |
| 'tool_choice': ('auto' if toolboxes else None), | |
| 'parallel_tool_calls': (parallel_tool_calls if toolboxes else None)} |
| temperature=os.getenv('MODEL_TEMP', default=0.0), | ||
| tool_choice=('auto' if toolboxes else None), | ||
| parallel_tool_calls=(parallel_tool_calls if toolboxes else None)) | ||
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default = 0.0), |
Copilot
AI
Nov 28, 2025
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.
Inconsistent spacing around the = operator. Line 133 uses default = 0.0 with spaces, which deviates from PEP 8 style guidelines. It should be default=0.0 without spaces around the equals sign in function arguments.
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default = 0.0), | |
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default=0.0), |
| raise ValueError(f"Settings section of model_config file {model_config} must be a dictionary") | ||
| if not set(models_params.keys()).difference(model_keys).issubset(set([])): | ||
| raise ValueError(f"Settings section of model_config file {model_config} contains models that are not in the model section") | ||
| for k,v in models_params.items(): |
Copilot
AI
Nov 28, 2025
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.
Missing space after comma in for k,v in models_params.items():. According to PEP 8, there should be a space after the comma: for k, v in models_params.items():.
| for k,v in models_params.items(): | |
| for k, v in models_params.items(): |
README.md
Outdated
| effort: high | ||
| ``` | ||
|
|
||
| You do not need to set parameters for all models defined in the `models` section. When parameters is not set for a model, they'll fall back to the default value. However, all the settings in this section must belong to one of the models specified in the `models` section, otherwise an error will raise: |
Copilot
AI
Nov 28, 2025
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.
Grammatical error: "an error will raise" should be "an error will be raised" (passive voice) or "the system will raise an error" (active voice).
| You do not need to set parameters for all models defined in the `models` section. When parameters is not set for a model, they'll fall back to the default value. However, all the settings in this section must belong to one of the models specified in the `models` section, otherwise an error will raise: | |
| You do not need to set parameters for all models defined in the `models` section. When parameters is not set for a model, they'll fall back to the default value. However, all the settings in this section must belong to one of the models specified in the `models` section, otherwise an error will be raised: |
| temperature=os.getenv('MODEL_TEMP', default=0.0), | ||
| tool_choice=('auto' if toolboxes else None), | ||
| parallel_tool_calls=(parallel_tool_calls if toolboxes else None)) | ||
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default = 0.0), |
Copilot
AI
Nov 28, 2025
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.
The os.getenv('MODEL_TEMP', default=0.0) call returns a string, not a float. Environment variables are always strings, so this will pass "0.0" (a string) to ModelSettings instead of the numeric value 0.0. This should be float(os.getenv('MODEL_TEMP', default='0.0')) or use default=0.0 only after converting the environment variable value to a float.
| model_params = {'temperature' : os.getenv('MODEL_TEMP', default = 0.0), | |
| model_params = {'temperature' : float(os.getenv('MODEL_TEMP', default='0.0')), |
| models_params = m_config.get('model_settings', {}) | ||
| if models_params and not isinstance(models_params, dict): | ||
| raise ValueError(f"Settings section of model_config file {model_config} must be a dictionary") | ||
| if not set(models_params.keys()).difference(model_keys).issubset(set([])): |
Copilot
AI
Nov 28, 2025
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.
The validation logic if not set(models_params.keys()).difference(model_keys).issubset(set([])) is unnecessarily complex. The condition .issubset(set([])) is equivalent to checking if the set is empty. This should be simplified to if set(models_params.keys()) - set(model_keys): or if not set(models_params.keys()).issubset(model_keys): for better readability.
| if not set(models_params.keys()).difference(model_keys).issubset(set([])): | |
| if not set(models_params.keys()).issubset(model_keys): |
| Parameters to the model can also be specified in the task using the `model_settings` section: | ||
|
|
||
| ```yaml | ||
| model: gpt-5-mini |
Copilot
AI
Nov 28, 2025
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.
The example uses gpt-5-mini which may not be a valid model identifier. As of January 2025, there is no GPT-5 model released by OpenAI. Consider using a more realistic example model name like gpt-4o-mini or a placeholder like your-model-name to avoid confusion.
| model: gpt-5-mini | |
| model: gpt-4o-mini |
| model_settings.update(task_model_settings) | ||
|
|
||
| # parse our taskflow grammar | ||
| name = task_body.get('name', 'taskflow') # placeholder, not used yet |
Copilot
AI
Nov 28, 2025
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.
This assignment to 'name' is unnecessary as it is redefined before this value is used.
| name = task_body.get('name', 'taskflow') # placeholder, not used yet |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| raise ValueError(f"Settings section of model_config file {model_config} must be a dictionary") | ||
| if not set(models_params.keys()).difference(model_keys).issubset(set([])): | ||
| raise ValueError(f"Settings section of model_config file {model_config} contains models that are not in the model section") | ||
| for k,v in models_params.items(): |
Copilot
AI
Nov 28, 2025
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.
[nitpick] Missing space after comma in the loop. Should be for k, v in instead of for k,v in according to PEP 8 style guidelines.
| for k,v in models_params.items(): | |
| for k, v in models_params.items(): |
| if not set(models_params.keys()).difference(model_keys).issubset(set([])): | ||
| raise ValueError(f"Settings section of model_config file {model_config} contains models that are not in the model section") |
Copilot
AI
Nov 28, 2025
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.
The error message says "Settings section...contains models that are not in the model section" but should say "models that are not in the models section" (with an 's' on 'models'). Additionally, this error message could be more helpful by indicating which models are problematic. Consider: f"Settings section of model_config file {model_config} contains models that are not defined in the models section: {', '.join(set(models_params.keys()) - set(model_keys))}"
| if not set(models_params.keys()).difference(model_keys).issubset(set([])): | |
| raise ValueError(f"Settings section of model_config file {model_config} contains models that are not in the model section") | |
| problematic_models = set(models_params.keys()) - set(model_keys) | |
| raise ValueError( | |
| f"Settings section of model_config file {model_config} contains models that are not defined in the models section: {', '.join(problematic_models)}" | |
| ) |
No description provided.