-
Notifications
You must be signed in to change notification settings - Fork 203
Add config reader support #151
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.
Greptile Summary
This PR introduces a JSON configuration system for the Plexe AI framework by adding a ModelConfigFactory
class that can parse configuration files and create ModelBuilder
instances. The implementation includes three main components: a configuration parser (model_config.py
) with dataclasses for provider and general settings, an example JSON configuration file (plexe.json
) that demonstrates how to specify different LLM providers for various agent roles, and a minimal README for the new CLI directory structure.
The configuration system allows users to externalize provider settings, working directories, and other parameters instead of hardcoding them when instantiating ModelBuilder
objects. The JSON structure mirrors the existing ProviderConfig
class fields, maintaining compatibility with the current architecture. The factory pattern encapsulates the complex parsing logic while providing a clean interface through the get_model_builder()
method.
The PR establishes the foundation for a more flexible, deployment-friendly configuration approach where settings can be managed separately from code. The configuration supports a provider hierarchy with defaults and specialized providers for different agent roles, along with system-wide settings for verbosity and distributed processing.
Important Files Changed
Files Modified
Filename | Score | Overview |
---|---|---|
plexe/cli/model_config.py | 3/5 | Adds JSON configuration parser with dataclasses and factory, but has error handling and validation issues |
plexe/cli/plexe.json | 4/5 | Example JSON config file demonstrating provider hierarchy and system settings |
plexe/cli/README.md | 5/5 | Minimal placeholder README with just a header for the CLI directory |
plexe/cli/init.py | 1/5 | Breaking change that removes all existing CLI module exports, making previously accessible classes unavailable |
Confidence score: 2/5
- This PR contains a critical breaking change that will immediately break existing code importing from
plexe.cli
- Score reflects the removal of all CLI module exports without replacement, despite the PR description claiming it's safe to merge
- Pay close attention to
plexe/cli/__init__.py
which removes the entire public API for the CLI module
Sequence Diagram
sequenceDiagram
participant User
participant ModelConfigFactory
participant FileSystem as "File System"
participant ModelBuilder
participant ProviderConfig
User->>ModelConfigFactory: "__init__(config_file='./plexe.json')"
ModelConfigFactory->>FileSystem: "open(config_file, 'r')"
FileSystem-->>ModelConfigFactory: "file handle"
ModelConfigFactory->>FileSystem: "json.load(f)"
FileSystem-->>ModelConfigFactory: "config data"
alt Config validation fails
ModelConfigFactory->>ModelConfigFactory: "validate data exists"
ModelConfigFactory-->>User: "Exception: Config Error"
else Config validation passes
ModelConfigFactory->>ModelConfigFactory: "ModelProviderJSONConfig(**data['provider'])"
ModelConfigFactory->>ModelConfigFactory: "validate default_provider"
ModelConfigFactory->>ModelConfigFactory: "set null providers to default_provider"
ModelConfigFactory->>ModelConfigFactory: "ModelJSONConfig(provider=model_provider, ...)"
end
User->>ModelConfigFactory: "get_model_builder()"
ModelConfigFactory->>ProviderConfig: "ProviderConfig(default_provider, orchestrator_provider, ...)"
ProviderConfig-->>ModelConfigFactory: "provider_config"
ModelConfigFactory->>ModelBuilder: "ModelBuilder(provider_config, verbose, distributed, working_dir)"
ModelBuilder-->>ModelConfigFactory: "model_builder instance"
ModelConfigFactory-->>User: "model_builder instance"
4 files reviewed, 1 comment
This PR aims to provide a config reader that can read a JSON file configuration. It has not yet been integrated with other code, so it is safe to merge. Additionally, I have included an example config file.