mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 11:45:00 +00:00
feat: Load model settings from package resource using importlib.resources
This commit is contained in:
parent
ddbaa8b32b
commit
5095a9e1c3
1 changed files with 7 additions and 3 deletions
|
@ -103,10 +103,14 @@ class ModelSettings:
|
||||||
remove_reasoning: Optional[str] = None
|
remove_reasoning: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
# load these from aider/resources/model-settings.yml
|
import importlib.resources
|
||||||
# use the proper packaging way to locate that file
|
|
||||||
# ai!
|
# Load model settings from package resource
|
||||||
MODEL_SETTINGS = []
|
MODEL_SETTINGS = []
|
||||||
|
with importlib.resources.open_text("aider.resources", "model-settings.yml") as f:
|
||||||
|
model_settings_list = yaml.safe_load(f)
|
||||||
|
for model_settings_dict in model_settings_list:
|
||||||
|
MODEL_SETTINGS.append(ModelSettings(**model_settings_dict))
|
||||||
|
|
||||||
class ModelInfoManager:
|
class ModelInfoManager:
|
||||||
MODEL_INFO_URL = (
|
MODEL_INFO_URL = (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue