Skip to content

Commit 7ac8bde

Browse files
authored
Merge pull request #130 from fabienric/fix-ovh
Fixes for the OVHcloud provider
2 parents 3d4c2f5 + 8205ff3 commit 7ac8bde

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ Large Language Models (LLMs):
1414
- Cloudflare
1515
- Groq
1616
- OctoAI
17+
- OVHcloud
1718
- Perplexity
1819
- Together
1920
- Mixtral 8x7B from several different providers, including
2021
- Anyscale
2122
- Azure
2223
- Groq
2324
- OctoAI
25+
- OVHcloud
2426
- Perplexity
2527

2628
Embedding Models:

llm_benchmark_suite.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ class _OvhLlm(_Llm):
225225
def __init__(self, model: str, display_model: Optional[str] = None):
226226
super().__init__(
227227
"",
228-
"cloud.ovh.net/" + display_model,
228+
f"endpoints.ai.cloud.ovh.net/{model}",
229+
api_key=os.getenv("OVH_AI_ENDPOINTS_API_KEY"),
229230
base_url=f"https://{model}.endpoints.kepler.ai.cloud.ovh.net/api/openai_compat/v1",
230231
)
231232

@@ -352,6 +353,7 @@ def _text_models():
352353
_GroqLlm("mixtral-8x7b-32768", MIXTRAL_8X7B_INSTRUCT_FP8),
353354
_NvidiaLlm("mistralai/mixtral-8x7b-instruct-v0.1-turbo", MIXTRAL_8X7B_INSTRUCT_FP8),
354355
_TogetherLlm("mistralai/Mixtral-8x7B-Instruct-v0.1", MIXTRAL_8X7B_INSTRUCT),
356+
_OvhLlm("mixtral-8x7b-instruct-v01", MIXTRAL_8X7B_INSTRUCT),
355357
# Llama 3.1 405b
356358
_DatabricksLlm("databricks-meta-llama-3.1-405b-instruct", LLAMA_31_405B_CHAT),
357359
_DeepInfraLlm(
@@ -365,7 +367,7 @@ def _text_models():
365367
_TogetherLlm(
366368
"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo", LLAMA_31_405B_CHAT_FP8
367369
),
368-
# _OvhLlm("llama-3p1-405b-instruct", LLAMA_31_405B_CHAT),
370+
# _OvhLlm("llama-3-1-405b-instruct", LLAMA_31_405B_CHAT),
369371
# Llama 3.1 70b
370372
_CerebrasLlm("llama3.1-70b", LLAMA_31_70B_CHAT),
371373
_CloudflareLlm("@cf/meta/llama-3.1-70b-preview", LLAMA_31_70B_CHAT),
@@ -380,7 +382,7 @@ def _text_models():
380382
_TogetherLlm(
381383
"meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", LLAMA_31_70B_CHAT_FP8
382384
),
383-
# _OvhLlm("llama-3p1-8b-instruct", LLAMA_31_8B_CHAT),
385+
_OvhLlm("llama-3-1-70b-instruct", LLAMA_31_70B_CHAT),
384386
# Llama 3.1 8b
385387
_CerebrasLlm("llama3.1-8b", LLAMA_31_8B_CHAT),
386388
_CloudflareLlm("@cf/meta/llama-3.1-8b-preview", LLAMA_31_8B_CHAT),
@@ -395,7 +397,7 @@ def _text_models():
395397
_TogetherLlm(
396398
"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", LLAMA_31_8B_CHAT_FP8
397399
),
398-
# _OvhLlm("llama-3p1-70b-instruct", LLAMA_31_70B_CHAT),
400+
# _OvhLlm("llama-3-1-8b-instruct", LLAMA_31_8B_CHAT),
399401
# Llama 3 70b
400402
_DatabricksLlm("databricks-meta-llama-3-70b-instruct", LLAMA_3_70B_CHAT),
401403
_DeepInfraLlm("meta-llama/Meta-Llama-3-70B-Instruct", LLAMA_3_70B_CHAT),

llm_request.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,18 @@ def make_openai_url_and_headers(ctx: ApiContext, path: str):
209209
url = ctx.base_url or "https://api.openai.com/v1"
210210
hostname = urllib.parse.urlparse(url).hostname
211211
use_azure_openai = hostname and hostname.endswith("openai.azure.com")
212+
use_ovh = hostname and hostname.endswith("cloud.ovh.net")
212213
if use_azure_openai:
213214
api_key = get_api_key(ctx, "AZURE_OPENAI_API_KEY")
214215
headers = make_headers(api_key=api_key)
215216
url += f"/openai/deployments/{ctx.model.replace('.', '')}{path}?api-version={AZURE_OPENAI_API_VERSION}"
217+
elif use_ovh:
218+
api_key = get_api_key(ctx, "OVH_AI_ENDPOINTS_API_KEY")
219+
headers = {
220+
"content-type": "application/json",
221+
"authorization": api_key
222+
}
223+
url += path
216224
else:
217225
api_key = ctx.api_key if ctx.base_url else get_api_key(ctx, "OPENAI_API_KEY")
218226
headers = make_headers(auth_token=api_key)

0 commit comments

Comments
 (0)