community: Update azureml endpoint (#28953)

- In this PR, I have updated the AzureML Endpoint with the latest
endpoint.
- **Description:** I have changed the existing `/chat/completions` to
`/models/chat/completions` in
libs/community/langchain_community/llms/azureml_endpoint.py
    - **Issue:** #25702

---------

Co-authored-by: = <=>
This commit is contained in:
Ashvin
2025-01-03 01:17:02 +05:30
committed by GitHub
parent 7c28321f04
commit d26c102a5a

View File

@@ -434,7 +434,8 @@ class AzureMLBaseEndpoint(BaseModel):
raise ValueError(
"`endpoint_url` should contain the full invocation URL including "
"`/score` for `endpoint_api_type='dedicated'` or `/completions` "
"or `/chat/completions` for `endpoint_api_type='serverless'`"
"or `/chat/completions` or `/models/chat/completions` "
"for `endpoint_api_type='serverless'`"
)
return field_value
@@ -455,16 +456,19 @@ class AzureMLBaseEndpoint(BaseModel):
"Endpoints of type `dedicated` should follow the format "
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/score`."
" If your endpoint URL ends with `/completions` or"
"`/chat/completions`, use `endpoint_api_type='serverless'` instead."
"`/chat/completions` or `/models/chat/completions`,"
"use `endpoint_api_type='serverless'` instead."
)
if field_value == AzureMLEndpointApiType.serverless and not (
endpoint_url.endswith("/completions") # type: ignore[union-attr]
or endpoint_url.endswith("/chat/completions") # type: ignore[union-attr]
or endpoint_url.endswith("/models/chat/completions") # type: ignore[union-attr]
):
raise ValueError(
"Endpoints of type `serverless` should follow the format "
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/chat/completions`"
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/completions`"
" or `https://<your-endpoint>.<your_region>.inference.ml.azure.com/chat/completions`"
" or `https://<your-endpoint>.<your_region>.inference.ml.azure.com/models/chat/completions`"
)
return field_value