fix(main.py): fix lm_studio/ embedding routing (#7658)

* fix(main.py): fix lm_studio/ embedding routing

adds the mapping + updates docs with example

* docs(self_serve.md): update doc to show how to auto-add sso users to teams

* fix(streaming_handler.py): simplify async iterator check, to just check if streaming response is an async iterable
This commit is contained in:
Krish Dholakia 2025-01-09 23:03:24 -08:00 committed by GitHub
parent 14d4b695df
commit afdcbe3d64
6 changed files with 109 additions and 38 deletions

View file

@ -3218,6 +3218,7 @@ def embedding( # noqa: PLR0915
api_base=api_base,
api_key=api_key,
)
if dynamic_api_key is not None:
api_key = dynamic_api_key
@ -3395,18 +3396,19 @@ def embedding( # noqa: PLR0915
custom_llm_provider == "openai_like"
or custom_llm_provider == "jina_ai"
or custom_llm_provider == "hosted_vllm"
or custom_llm_provider == "lm_studio"
):
api_base = (
api_base or litellm.api_base or get_secret_str("OPENAI_LIKE_API_BASE")
)
# set API KEY
api_key = (
api_key
or litellm.api_key
or litellm.openai_like_key
or get_secret_str("OPENAI_LIKE_API_KEY")
)
if api_key is None:
api_key = (
litellm.api_key
or litellm.openai_like_key
or get_secret_str("OPENAI_LIKE_API_KEY")
)
## EMBEDDING CALL
response = openai_like_embedding.embedding(