Skip to content

Commit 889c681

Browse files
ashvin-ashinxi
authored andcommitted
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.
1 parent 148fb8a commit 889c681

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

libs/community/langchain_community/llms/azureml_endpoint.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def validate_endpoint_url(cls, field_value: Any) -> str:
434434
raise ValueError(
435435
"`endpoint_url` should contain the full invocation URL including "
436436
"`/score` for `endpoint_api_type='dedicated'` or `/completions` "
437-
"or `/chat/completions` or `/models/chat/completions` "
437+
"or `/models/chat/completions` "
438438
"for `endpoint_api_type='serverless'`"
439439
)
440440
return field_value
@@ -456,18 +456,16 @@ def validate_endpoint_api_type(
456456
"Endpoints of type `dedicated` should follow the format "
457457
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/score`."
458458
" If your endpoint URL ends with `/completions` or"
459-
"`/chat/completions` or `/models/chat/completions`,"
459+
"`/models/chat/completions`,"
460460
"use `endpoint_api_type='serverless'` instead."
461461
)
462462
if field_value == AzureMLEndpointApiType.serverless and not (
463463
endpoint_url.endswith("/completions") # type: ignore[union-attr]
464-
or endpoint_url.endswith("/chat/completions") # type: ignore[union-attr]
465464
or endpoint_url.endswith("/models/chat/completions") # type: ignore[union-attr]
466465
):
467466
raise ValueError(
468467
"Endpoints of type `serverless` should follow the format "
469468
"`https://<your-endpoint>.<your_region>.inference.ml.azure.com/completions`"
470-
" or `https://<your-endpoint>.<your_region>.inference.ml.azure.com/chat/completions`"
471469
" or `https://<your-endpoint>.<your_region>.inference.ml.azure.com/models/chat/completions`"
472470
)
473471

0 commit comments

Comments
 (0)