mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
Litellm dev 12 30 2024 p1 (#7480)
* test(azure_openai_o1.py): initial commit with testing for azure openai o1 preview model * fix(base_llm_unit_tests.py): handle azure o1 preview response format tests skip as o1 on azure doesn't support tool calling yet * fix: initial commit of azure o1 handler using openai caller simplifies calling + allows fake streaming logic alr. implemented for openai to just work * feat(azure/o1_handler.py): fake o1 streaming for azure o1 models azure does not currently support streaming for o1 * feat(o1_transformation.py): support overriding 'should_fake_stream' on azure/o1 via 'supports_native_streaming' param on model info enables user to toggle on when azure allows o1 streaming without needing to bump versions * style(router.py): remove 'give feedback/get help' messaging when router is used Prevents noisy messaging Closes https://github.com/BerriAI/litellm/issues/5942 * test: fix azure o1 test * test: fix tests * fix: fix test
This commit is contained in:
parent
f0ed02d3ee
commit
0178e75cd9
17 changed files with 273 additions and 141 deletions
|
@ -12,10 +12,41 @@ Translations handled by LiteLLM:
|
|||
- Temperature => drop param (if user opts in to dropping param)
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from litellm import verbose_logger
|
||||
from litellm.utils import get_model_info
|
||||
|
||||
from ...openai.chat.o1_transformation import OpenAIO1Config
|
||||
|
||||
|
||||
class AzureOpenAIO1Config(OpenAIO1Config):
|
||||
def should_fake_stream(
|
||||
self,
|
||||
model: Optional[str],
|
||||
stream: Optional[bool],
|
||||
custom_llm_provider: Optional[str] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Currently no Azure OpenAI models support native streaming.
|
||||
"""
|
||||
if stream is not True:
|
||||
return False
|
||||
|
||||
if model is not None:
|
||||
try:
|
||||
model_info = get_model_info(
|
||||
model=model, custom_llm_provider=custom_llm_provider
|
||||
)
|
||||
if model_info.get("supports_native_streaming") is True:
|
||||
return False
|
||||
except Exception as e:
|
||||
verbose_logger.debug(
|
||||
f"Error getting model info in AzureOpenAIO1Config: {e}"
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
def is_o1_model(self, model: str) -> bool:
|
||||
o1_models = ["o1-mini", "o1-preview"]
|
||||
for m in o1_models:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue