mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
[BETA] Add OpenAI /images/variations
+ Topaz API support (#7700)
* feat(main.py): initial commit for `/image/variations` endpoint support * refactor(base_llm/): introduce new base llm base config for image variation endpoints * refactor(openai/image_variations/transformation.py): implement openai image variation transformation handler * fix: test * feat(openai/): working openai `/image/variation` endpoint calls via sdk * feat(topaz/): topaz sync image variation call support Addresses https://github.com/BerriAI/litellm/issues/7593 ' * fix(topaz/transformation.py): fix linting errors * fix(openai/image_variations/handler.py): fix passing json data * fix(main.py): image_variation/ support async image variation route - `aimage_variation` * fix(test_get_model_info.py): fix test * fix: cleanup unused imports * feat(openai/): add async `/image/variations` endpoint support * feat(topaz/): support async `/image/variations` calls * fix: test * fix(utils.py): fix get_model_info_helper for no model info w/ provider config handles situation where model info is not known but provider config exists * test(test_router_fallbacks.py): mark flaky test * fix: fix unused imports * test: bump otel load test perf threshold - accounts for current load tests hitting same server
This commit is contained in:
parent
d21e4dedbd
commit
8ee79dd5d9
25 changed files with 1254 additions and 20 deletions
37
litellm/llms/topaz/common_utils.py
Normal file
37
litellm/llms/topaz/common_utils.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
from typing import List, Optional
|
||||
|
||||
from litellm.secret_managers.main import get_secret_str
|
||||
from litellm.types.utils import ModelInfoBase
|
||||
|
||||
from ..base_llm.base_utils import BaseLLMModelInfo
|
||||
from ..base_llm.chat.transformation import BaseLLMException
|
||||
|
||||
|
||||
class TopazException(BaseLLMException):
|
||||
pass
|
||||
|
||||
|
||||
class TopazModelInfo(BaseLLMModelInfo):
|
||||
def get_model_info(
|
||||
self, model: str, existing_model_info: Optional[ModelInfoBase] = None
|
||||
) -> Optional[ModelInfoBase]:
|
||||
return existing_model_info
|
||||
|
||||
def get_models(self) -> 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"
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue