Skip to content

Commit 352a105

Browse files
authored
Fix: Follow infinity api url format (#8346)
* Follow infinity api url format * Update test_infinity.py
1 parent dfb0266 commit 352a105

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

litellm/llms/infinity/rerank/transformation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020

2121

2222
class InfinityRerankConfig(CohereRerankConfig):
23+
def get_complete_url(self, api_base: str, model: str) -> str:
24+
# Remove trailing slashes and ensure clean base URL
25+
api_base = api_base.rstrip("/")
26+
if not api_base.endswith("/rerank"):
27+
api_base = f"{api_base}/rerank"
28+
return api_base
29+
2330
def validate_environment(
2431
self,
2532
headers: dict,

tests/llm_translation/test_infinity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def return_val():
6969
_url = mock_post.call_args.kwargs["url"]
7070
print("Arguments passed to API=", args_to_api)
7171
print("url = ", _url)
72-
assert _url == "https://api.infinity.ai/v1/rerank"
72+
assert _url == "https://api.infinity.ai/rerank"
7373

7474
request_data = json.loads(args_to_api)
7575
assert request_data["query"] == expected_payload["query"]
@@ -133,7 +133,7 @@ def return_val():
133133
_url = mock_post.call_args.kwargs["url"]
134134
print("Arguments passed to API=", args_to_api)
135135
print("url = ", _url)
136-
assert _url == "https://env.infinity.ai/v1/rerank"
136+
assert _url == "https://env.infinity.ai/rerank"
137137

138138
request_data = json.loads(args_to_api)
139139
assert request_data["query"] == expected_payload["query"]

0 commit comments

Comments
 (0)