mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
(feat) set Azure vision enhancement params using os.environ
This commit is contained in:
parent
113383ac70
commit
d80ae8b9bb
1 changed files with 15 additions and 0 deletions
|
@ -1659,9 +1659,24 @@ class Router:
|
|||
),
|
||||
)
|
||||
|
||||
# Azure GPT-Vision Enhancements, users can pass os.environ/
|
||||
data_sources = model.get("litellm_params", {}).get("dataSources", [])
|
||||
|
||||
for data_source in data_sources:
|
||||
params = data_source.get("parameters", {})
|
||||
for param_key in ["endpoint", "key"]:
|
||||
# if endpoint or key set for Azure GPT Vision Enhancements, check if it's an env var
|
||||
if param_key in params and params[param_key].startswith(
|
||||
"os.environ/"
|
||||
):
|
||||
env_name = params[param_key].replace("os.environ/", "")
|
||||
params[param_key] = os.environ.get(env_name, "")
|
||||
|
||||
# done reading model["litellm_params"]
|
||||
if custom_llm_provider not in litellm.provider_list:
|
||||
raise Exception(f"Unsupported provider - {custom_llm_provider}")
|
||||
|
||||
# init OpenAI, Azure clients
|
||||
self.set_client(model=model)
|
||||
|
||||
verbose_router_logger.debug(f"\nInitialized Model List {self.model_list}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue