Fix custom pricing - separate provider info from model info (#7990)
All checks were successful
Read Version from pyproject.toml / read-version (push) Successful in 34s

* fix(utils.py): initial commit fixing custom cost tracking

refactors out provider specific model info from `get_model_info` - this was causing custom costs to be registered incorrectly

* fix(utils.py): cleanup `_supports_factory` to check provider info, if model info is None

some providers support features like vision across all models

* fix(utils.py): refactor to use _supports_factory

* test: update testing

* fix: fix linting errors

* test: fix testing
This commit is contained in:
Krish Dholakia 2025-01-25 21:49:28 -08:00 committed by GitHub
parent d9b8100cca
commit 03eef5a2a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 118 additions and 91 deletions

View file

@ -5,17 +5,15 @@ from typing import List, Optional, Type, Union
from openai.lib import _parsing, _pydantic
from pydantic import BaseModel
from litellm.types.utils import ModelInfoBase
from litellm.types.utils import ProviderSpecificModelInfo
class BaseLLMModelInfo(ABC):
@abstractmethod
def get_model_info(
def get_provider_info(
self,
model: str,
existing_model_info: Optional[ModelInfoBase] = None,
) -> Optional[ModelInfoBase]:
pass
) -> Optional[ProviderSpecificModelInfo]:
return None
@abstractmethod
def get_models(self) -> List[str]: