From e128dc4e1f3cc31b44b91cdad0eb7e33b90cdb52 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 12 Jun 2024 20:28:16 -0700 Subject: [PATCH 1/3] feat - add azure ai studio models on litellm ui --- litellm/__init__.py | 1 + litellm/llms/openai.py | 20 ++++++++++++++++++++ litellm/utils.py | 3 +++ 3 files changed, 24 insertions(+) diff --git a/litellm/__init__.py b/litellm/__init__.py index 3ac5d0581..b7a287025 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -789,6 +789,7 @@ from .llms.openai import ( MistralConfig, MistralEmbeddingConfig, DeepInfraConfig, + AzureAIStudioConfig, ) from .llms.azure import ( AzureOpenAIConfig, diff --git a/litellm/llms/openai.py b/litellm/llms/openai.py index fa7745af8..1f2b836c3 100644 --- a/litellm/llms/openai.py +++ b/litellm/llms/openai.py @@ -28,6 +28,7 @@ from .prompt_templates.factory import prompt_factory, custom_prompt from openai import OpenAI, AsyncOpenAI from ..types.llms.openai import * import openai +from litellm.types.utils import ProviderField class OpenAIError(Exception): @@ -207,6 +208,25 @@ class MistralEmbeddingConfig: return optional_params +class AzureAIStudioConfig: + def get_required_params(self) -> List[ProviderField]: + """For a given provider, return it's required fields with a description""" + return [ + ProviderField( + field_name="api_key", + field_type="string", + field_description="Your Azure AI Studio API Key.", + field_value="zEJ...", + ), + ProviderField( + field_name="api_base", + field_type="string", + field_description="Your Azure AI Studio API Base.", + field_value="https://Mistral-serverless.", + ), + ] + + class DeepInfraConfig: """ Reference: https://deepinfra.com/docs/advanced/openai_api diff --git a/litellm/utils.py b/litellm/utils.py index 036e74767..58130b266 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -7221,6 +7221,9 @@ def get_provider_fields(custom_llm_provider: str) -> List[ProviderField]: elif custom_llm_provider == "ollama": return litellm.OllamaConfig().get_required_params() + elif custom_llm_provider == "azure_ai": + return litellm.AzureAIStudioConfig().get_required_params() + else: return [] From e88106e916f9b30654af398ee41b35185469260a Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 12 Jun 2024 20:28:54 -0700 Subject: [PATCH 2/3] ui - add azure ai studio models on ui --- ui/litellm-dashboard/src/components/model_dashboard.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsx index d16d8db13..2fe08a8bb 100644 --- a/ui/litellm-dashboard/src/components/model_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx @@ -139,6 +139,7 @@ interface ProviderSettings { enum Providers { OpenAI = "OpenAI", Azure = "Azure", + Azure_AI_Studio = "Azure AI Studio", Anthropic = "Anthropic", Google_AI_Studio = "Google AI Studio", Bedrock = "Amazon Bedrock", @@ -151,6 +152,7 @@ enum Providers { const provider_map: Record = { OpenAI: "openai", Azure: "azure", + Azure_AI_Studio: "azure_ai", Anthropic: "anthropic", Google_AI_Studio: "gemini", Bedrock: "bedrock", @@ -158,6 +160,7 @@ const provider_map: Record = { Vertex_AI: "vertex_ai", Databricks: "databricks", Ollama: "ollama", + }; const retry_policy_map: Record = { From 38b7ab6b62ce6f2b3885b5369c61f4d9cd1936bd Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 12 Jun 2024 20:32:55 -0700 Subject: [PATCH 3/3] model - show sensible defaults --- ui/litellm-dashboard/src/components/model_dashboard.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsx index 2fe08a8bb..e18f4233e 100644 --- a/ui/litellm-dashboard/src/components/model_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx @@ -1248,6 +1248,10 @@ const ModelDashboard: React.FC = ({ return "claude-3-opus"; } else if (selectedProvider == Providers.Google_AI_Studio) { return "gemini-pro"; + } else if (selectedProvider == Providers.Azure_AI_Studio) { + return "azure_ai/command-r-plus"; + } else if (selectedProvider == Providers.Azure) { + return "azure/my-deployment"; } else { return "gpt-3.5-turbo"; }