llama-stack-mirror/llama_stack/providers/remote/inference
Rohan Awhad 7cb5d3c60f
chore: standardize unsupported model error #2517 (#2518)
# What does this PR do?

- llama_stack/exceptions.py: Add UnsupportedModelError class
- remote inference ollama.py and utils/inference/model_registry.py:
Changed ValueError in favor of UnsupportedModelError
- utils/inference/litellm_openai_mixin.py: remove `register_model`
function implementation from `LiteLLMOpenAIMixin` class. Now uses the
parent class `ModelRegistryHelper`'s function implementation

Closes #2517


## Test Plan


1. Create a new `test_run_openai.yaml` and paste the following config in
it:

```yaml
version: '2'
image_name: test-image
apis:
- inference
providers:
  inference:
  - provider_id: openai
    provider_type: remote::openai
    config:
      max_tokens: 8192
models:
- metadata: {}
  model_id: "non-existent-model"
  provider_id: openai
  model_type: llm
server:
  port: 8321
```

And run the server with:
```bash
uv run llama stack run test_run_openai.yaml
```

You should now get a `llama_stack.exceptions.UnsupportedModelError` with
the supported list of models in the error message.

---

Tested for the following remote inference providers, and they all raise
the `UnsupportedModelError`:
- Anthropic
- Cerebras
- Fireworks
- Gemini
- Groq
- Ollama
- OpenAI
- SambaNova
- Together
- Watsonx

---------

Co-authored-by: Rohan Awhad <rawhad@redhat.com>
2025-06-27 14:26:58 -04:00
..
anthropic chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
bedrock feat: New OpenAI compat embeddings API (#2314) 2025-05-31 22:11:47 -07:00
cerebras feat: New OpenAI compat embeddings API (#2314) 2025-05-31 22:11:47 -07:00
cerebras_openai_compat feat: introduce APIs for retrieving chat completion requests (#2145) 2025-05-18 21:43:19 -07:00
databricks feat: New OpenAI compat embeddings API (#2314) 2025-05-31 22:11:47 -07:00
fireworks chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
fireworks_openai_compat feat: introduce APIs for retrieving chat completion requests (#2145) 2025-05-18 21:43:19 -07:00
gemini chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
groq chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
groq_openai_compat feat: introduce APIs for retrieving chat completion requests (#2145) 2025-05-18 21:43:19 -07:00
llama_openai_compat feat: introduce APIs for retrieving chat completion requests (#2145) 2025-05-18 21:43:19 -07:00
nvidia refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
ollama chore: standardize unsupported model error #2517 (#2518) 2025-06-27 14:26:58 -04:00
openai chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
passthrough chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
runpod refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
sambanova fix(providers): update sambanova json schema mode (#2306) 2025-05-29 09:54:23 -07:00
sambanova_openai_compat feat: introduce APIs for retrieving chat completion requests (#2145) 2025-05-18 21:43:19 -07:00
tgi feat: New OpenAI compat embeddings API (#2314) 2025-05-31 22:11:47 -07:00
together refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
together_openai_compat feat: introduce APIs for retrieving chat completion requests (#2145) 2025-05-18 21:43:19 -07:00
vllm refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
watsonx refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
__init__.py impls -> inline, adapters -> remote (#381) 2024-11-06 14:54:05 -08:00