aider: Create the NoModelInfo class to handle exceptions when model information cannot be retrieved.

# Aider chat conversation:

USER: create the `NoModelInfo` class

ASSISTANT: ```diff
--- aider/models/model.py
+++ aider/models/model.py
@@ ... @@
 from dataclasses import dataclass, fields

 import litellm
+from typing import Optional
 from PIL import Image

 from aider.dump import dump

+class NoModelInfo(Exception):
+    """
+    Exception raised when model information cannot be retrieved.
+    """
+    def __init__(self, message: Optional[str] = None):
+        super().__init__(message or "No model information available.")
+
 @dataclass
 class ModelSettings:
     name: str
```
This commit is contained in:
Paul Gauthier 2024-04-18 09:26:07 -07:00
parent dd000c6147
commit 15c1ad1f96

View file

@ -3,10 +3,18 @@ import math
from dataclasses import dataclass, fields from dataclasses import dataclass, fields
import litellm import litellm
from typing import Optional
from PIL import Image from PIL import Image
from aider.dump import dump from aider.dump import dump
class NoModelInfo(Exception):
"""
Exception raised when model information cannot be retrieved.
"""
def __init__(self, message: Optional[str] = None):
super().__init__(message or "No model information available.")
@dataclass @dataclass
class ModelSettings: class ModelSettings: