mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
* fix: initial commit for adding provider model discovery to gemini * feat(gemini/): add model discovery for gemini/ route * docs(set_keys.md): update docs to show you can check available gemini models as well * feat(anthropic/): add model discovery for anthropic api key * feat(xai/): add model discovery for XAI enables checking what models an xai key can call * ci: bump ci config yml * fix(topaz/common_utils.py): fix linting error * fix: fix linting error for python38
37 lines
1 KiB
Python
37 lines
1 KiB
Python
from typing import List, Optional
|
|
|
|
from litellm.secret_managers.main import get_secret_str
|
|
|
|
from ..base_llm.base_utils import BaseLLMModelInfo
|
|
from ..base_llm.chat.transformation import BaseLLMException
|
|
|
|
|
|
class TopazException(BaseLLMException):
|
|
pass
|
|
|
|
|
|
class TopazModelInfo(BaseLLMModelInfo):
|
|
def get_models(
|
|
self, api_key: Optional[str] = None, api_base: Optional[str] = None
|
|
) -> List[str]:
|
|
return [
|
|
"topaz/Standard V2",
|
|
"topaz/Low Resolution V2",
|
|
"topaz/CGI",
|
|
"topaz/High Resolution V2",
|
|
"topaz/Text Refine",
|
|
]
|
|
|
|
@staticmethod
|
|
def get_api_key(api_key: Optional[str] = None) -> Optional[str]:
|
|
return api_key or get_secret_str("TOPAZ_API_KEY")
|
|
|
|
@staticmethod
|
|
def get_api_base(api_base: Optional[str] = None) -> Optional[str]:
|
|
return (
|
|
api_base or get_secret_str("TOPAZ_API_BASE") or "https://api.topazlabs.com"
|
|
)
|
|
|
|
@staticmethod
|
|
def get_base_model(model: str) -> str:
|
|
return model
|