Skip to content

Commit 1d20019

Browse files
authored
Merge pull request #124 from fixie-ai/juberti/uv70b
Add UV 70b and use audio_url
2 parents d2829b0 + c8193e4 commit 1d20019

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

llm_benchmark_suite.py

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ async def run(self, pass_argv: List[str], spread: float) -> asyncio.Task:
124124
return await llm_benchmark.run(full_argv)
125125

126126

127+
class _CerebrasLlm(_Llm):
128+
"""See https://docs.cerebras.ai/en/latest/wsc/Model-zoo/MZ-overview.html#list-of-models"""
129+
130+
def __init__(self, model: str, display_model: Optional[str] = None):
131+
super().__init__(
132+
model,
133+
"cerebras.ai/" + (display_model or model),
134+
api_key=os.getenv("CEREBRAS_API_KEY"),
135+
base_url="https://api.cerebras.ai/v1",
136+
)
137+
138+
127139
class _CloudflareLlm(_Llm):
128140
"""See https://developers.cloudflare.com/workers-ai/models/"""
129141

@@ -224,6 +236,17 @@ def __init__(
224236
)
225237

226238

239+
class _OvhLlm(_Llm):
240+
"""See https://llama-3-70b-instruct.endpoints.kepler.ai.cloud.ovh.net/doc"""
241+
242+
def __init__(self, model: str, display_model: Optional[str] = None):
243+
super().__init__(
244+
"",
245+
"cloud.ovh.net/" + display_model,
246+
base_url=f"https://{model}.endpoints.kepler.ai.cloud.ovh.net/api/openai_compat/v1",
247+
)
248+
249+
227250
class _PerplexityLlm(_Llm):
228251
"""See https://docs.perplexity.ai/docs/model-cards"""
229252

@@ -248,26 +271,15 @@ def __init__(self, model: str, display_model: Optional[str] = None):
248271
)
249272

250273

251-
class _OvhLlm(_Llm):
252-
"""See https://llama-3-70b-instruct.endpoints.kepler.ai.cloud.ovh.net/doc"""
253-
254-
def __init__(self, model: str, display_model: Optional[str] = None):
255-
super().__init__(
256-
"",
257-
"cloud.ovh.net/" + display_model,
258-
base_url=f"https://{model}.endpoints.kepler.ai.cloud.ovh.net/api/openai_compat/v1",
259-
)
260-
261-
262-
class _CerebrasLlm(_Llm):
263-
"""See https://docs.cerebras.ai/en/latest/wsc/Model-zoo/MZ-overview.html#list-of-models"""
274+
class _UltravoxLlm(_Llm):
275+
"""See https://docs.ultravox.ai/docs/models"""
264276

265277
def __init__(self, model: str, display_model: Optional[str] = None):
266278
super().__init__(
267279
model,
268-
"cerebras.ai/" + (display_model or model),
269-
api_key=os.getenv("CEREBRAS_API_KEY"),
270-
base_url="https://api.cerebras.ai/v1",
280+
"ultravox.ai/" + (display_model or model),
281+
api_key=os.getenv("ULTRAVOX_API_KEY"),
282+
base_url="https://ultravox.api.fixie.ai/v1",
271283
)
272284

273285

@@ -509,11 +521,8 @@ def _audio_models():
509521
# _Llm(GPT_4O), doesn't support audio yet
510522
_Llm(GEMINI_1_5_PRO),
511523
_Llm(GEMINI_1_5_FLASH),
512-
_Llm(
513-
"fixie-ai/ultravox-v0.4",
514-
base_url="https://ultravox.api.fixie.ai/v1",
515-
api_key=os.getenv("ULTRAVOX_API_KEY"),
516-
),
524+
_UltravoxLlm("fixie-ai/ultravox-v0.4", "ultravox-v0.4-8b"),
525+
_UltravoxLlm("fixie-ai/ultravox-70B", "ultravox-v0.4-70b"),
517526
_Llm(
518527
"fixie-ai/ultravox-v0.2",
519528
"baseten.co/ultravox-v0.2",

llm_request.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,12 @@ def make_openai_messages(ctx: ApiContext):
217217

218218
content: List[Dict[str, Any]] = [{"type": "text", "text": ctx.prompt}]
219219
for file in ctx.files:
220-
# if not file.mime_type.startswith("image/"):
221-
# raise ValueError(f"Unsupported file type: {file.mime_type}")
222220
url = f"data:{file.mime_type};base64,{file.base64_data}"
223-
image_url = {"url": url}
221+
media_url = {"url": url}
222+
url_type = "audio_url" if file.is_audio else "image_url"
224223
if ctx.detail:
225-
image_url["detail"] = ctx.detail
226-
content.append({"type": "image_url", "image_url": image_url})
224+
media_url["detail"] = ctx.detail
225+
content.append({"type": url_type, url_type: media_url})
227226
return [{"role": "user", "content": content}]
228227

229228

0 commit comments

Comments
 (0)