diff --git a/docs/docs/SUMMARY.md b/docs/docs/SUMMARY.md index 78d3bb0dc..9b3429815 100644 --- a/docs/docs/SUMMARY.md +++ b/docs/docs/SUMMARY.md @@ -115,6 +115,7 @@ search: - azure - [AzureOAI](api/fastagency/studio/models/llms/azure/AzureOAI.md) - [AzureOAIAPIKey](api/fastagency/studio/models/llms/azure/AzureOAIAPIKey.md) + - [UrlModel](api/fastagency/studio/models/llms/azure/UrlModel.md) - openai - [OpenAI](api/fastagency/studio/models/llms/openai/OpenAI.md) - [OpenAIAPIKey](api/fastagency/studio/models/llms/openai/OpenAIAPIKey.md) diff --git a/docs/docs/en/api/fastagency/studio/models/llms/azure/UrlModel.md b/docs/docs/en/api/fastagency/studio/models/llms/azure/UrlModel.md new file mode 100644 index 000000000..c6f95ae68 --- /dev/null +++ b/docs/docs/en/api/fastagency/studio/models/llms/azure/UrlModel.md @@ -0,0 +1,11 @@ +--- +# 0.5 - API +# 2 - Release +# 3 - Contributing +# 5 - Template Page +# 10 - Default +search: + boost: 0.5 +--- + +::: fastagency.studio.models.llms.azure.UrlModel diff --git a/fastagency/studio/models/llms/azure.py b/fastagency/studio/models/llms/azure.py index 8a860a3e2..c4adfb8fc 100644 --- a/fastagency/studio/models/llms/azure.py +++ b/fastagency/studio/models/llms/azure.py @@ -1,7 +1,7 @@ from typing import Annotated, Any, Dict, Literal from uuid import UUID -from pydantic import AfterValidator, Field, HttpUrl +from pydantic import AfterValidator, BaseModel, Field, HttpUrl from typing_extensions import TypeAlias from ..base import Model @@ -44,6 +44,10 @@ async def create_autogen(cls, model_id: UUID, user_id: UUID, **kwargs: Any) -> s URL = Annotated[HttpUrl, AfterValidator(lambda x: str(x).rstrip("/"))] +class UrlModel(BaseModel): + url: URL + + @register("llm") class AzureOAI(Model): model: Annotated[ @@ -60,7 +64,7 @@ class AzureOAI(Model): base_url: Annotated[ URL, Field(description="The base URL of the Azure OpenAI API") - ] = URL(url="https://api.openai.com/v1") + ] = UrlModel(url="https://{your-resource-name}.openai.azure.com").url api_type: Annotated[ Literal["azure"], diff --git a/tests/studio/models/llms/test_azure.py b/tests/studio/models/llms/test_azure.py index 81261eb80..f2f2aaa2b 100644 --- a/tests/studio/models/llms/test_azure.py +++ b/tests/studio/models/llms/test_azure.py @@ -98,7 +98,7 @@ def test_azure_model_schema(self) -> None: "title": "API Key", }, "base_url": { - "default": "https://api.openai.com/v1", + "default": "https://{your-resource-name}.openai.azure.com", "description": "The base URL of the Azure OpenAI API", "format": "uri", "maxLength": 2083,