-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat(constants): Add utility functions for config access #1631
base: main
Are you sure you want to change the base?
feat(constants): Add utility functions for config access #1631
Conversation
- Add get_env_vars() to access provider environment variables - Add get_providers() to retrieve supported providers list - Add get_models() to access provider model configurations These functions improve code maintainability by encapsulating configuration access.
This is a review from a crew. I'm testing a crew for PRs, so if it sounds weird that is the reason, you are one of the first ones to see this. :) I'll try to personally look into it as well Specific Code Improvements
Historical Context from Related PRsThis PR builds upon prior discussions in related pull requests, particularly the following:
These pull requests collectively indicate a strong trend towards improving user experience and security in CLI interactions, emphasizing the necessity of sound configuration management. Implications for Related FilesAdding these utility functions enhances the encapsulation of configuration management, reducing direct access to raw data structures. It will allow changes in the underlying configuration constants without impacting other parts of the code, provided that the interface remains consistent. This approach not only improves maintainability but also encourages collaborative development by fostering a better understanding of data flow. In conclusion, while the current implementation is a solid foundation, implementing the suggested improvements will align the code with best practices and ensure a more robust, maintainable system moving forward. |
- Add type hints for Dict, List, and Optional types - Enhance get_env_vars with better error handling for invalid inputs - Add unit tests for get_env_vars function - Fix get_models return type consistency
Hey @Jacques-Murray! I like where you are going with this. However, where in the code should we call these updated functions? We try not to add code to the library that doesn't get called by anything. |
This PR adds utility functions to better encapsulate configuration access in constants.py:
These functions improve code maintainability by: