mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-08 12:31:49 +00:00
community: Fix redundancy in code. (#29022)
In my previous PR (#28953), I added an unwanted condition for validating the Azure ML Endpoint. In this PR, I have rectified the issue.
This commit is contained in:
parent
c8d6f9d52b
commit
20a715a103
@ -434,7 +434,7 @@ class AzureMLBaseEndpoint(BaseModel):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
"`endpoint_url` should contain the full invocation URL including "
|
"`endpoint_url` should contain the full invocation URL including "
|
||||||
"`/score` for `endpoint_api_type='dedicated'` or `/completions` "
|
"`/score` for `endpoint_api_type='dedicated'` or `/completions` "
|
||||||
"or `/chat/completions` or `/models/chat/completions` "
|
"or `/models/chat/completions` "
|
||||||
"for `endpoint_api_type='serverless'`"
|
"for `endpoint_api_type='serverless'`"
|
||||||
)
|
)
|
||||||
return field_value
|
return field_value
|
||||||
@ -456,18 +456,16 @@ class AzureMLBaseEndpoint(BaseModel):
|
|||||||
"Endpoints of type `dedicated` should follow the format "
|
"Endpoints of type `dedicated` should follow the format "
|
||||||
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/score`."
|
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/score`."
|
||||||
" If your endpoint URL ends with `/completions` or"
|
" If your endpoint URL ends with `/completions` or"
|
||||||
"`/chat/completions` or `/models/chat/completions`,"
|
"`/models/chat/completions`,"
|
||||||
"use `endpoint_api_type='serverless'` instead."
|
"use `endpoint_api_type='serverless'` instead."
|
||||||
)
|
)
|
||||||
if field_value == AzureMLEndpointApiType.serverless and not (
|
if field_value == AzureMLEndpointApiType.serverless and not (
|
||||||
endpoint_url.endswith("/completions") # type: ignore[union-attr]
|
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]
|
or endpoint_url.endswith("/models/chat/completions") # type: ignore[union-attr]
|
||||||
):
|
):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Endpoints of type `serverless` should follow the format "
|
"Endpoints of type `serverless` should follow the format "
|
||||||
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/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`"
|
" or `https://<your-endpoint>.<your_region>.inference.ml.azure.com/models/chat/completions`"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user