llama-stack-mirror/llama_stack/providers/utils/inference
Kai Wu e3fd70c321
fix: change ModelRegistryHelper to use ProviderModelEntry instead of hardcoded ModelType.llm (#3451)
# What does this PR do?
<!-- Provide a short summary of what this PR does and why. Link to
relevant issues if applicable. -->
change ModelRegistryHelper to use ProviderModelEntry instead of
hardcoded ModelType.llm which fixed issue #3330.
<!-- If resolving an issue, uncomment and update the line below -->
<!-- Closes #[3330] -->

## Test Plan
<!-- Describe the tests you ran to verify your changes with result
summaries. *Provide clear instructions so the plan can be easily
re-executed.* -->
1. open llama-stack server 
```
uv sync --python 3.12
source .venv/bin/activate
uv run llama stack build --distro starter --image-type venv  --run
```
2.Used following script to test 
```
from llama_stack_client import LlamaStackClient
import os
def test_openai_embedding_type():
    client = LlamaStackClient(
        base_url=os.environ.get("LLAMA_STACK_ENDPOINT", "http://localhost:8321"),
        provider_data={
        "openai_api_key": os.environ.get("OPENAI_API_KEY", ""),
    },
    )
    model = client.models.retrieve("openai/text-embedding-3-small")
    print(model)
    assert model.identifier == "openai/text-embedding-3-small"
    assert model.model_type == "embedding"
test_openai_embedding_type()
```
logs:
```
python test_openai.py
INFO:httpx:HTTP Request: GET http://localhost:8321/v1/models/openai/text-embedding-3-small "HTTP/1.1 200 OK"
Model(identifier='openai/text-embedding-3-small', metadata={'embedding_dimension': 1536.0, 'context_length': 8192.0}, api_model_type='embedding', provider_id='openai', type='model', provider_resource_id='text-embedding-3-small', owner=None, source='listed_from_provider', model_type='embedding')
```
2025-09-22 12:55:32 -04:00
..
__init__.py chore: enable pyupgrade fixes (#1806) 2025-05-01 14:23:50 -07:00
embedding_mixin.py fix: Make SentenceTransformer embedding operations non-blocking (#3335) 2025-09-04 13:58:41 -04:00
inference_store.py chore: simplify authorized sqlstore (#3496) 2025-09-19 16:13:56 -07:00
litellm_openai_mixin.py chore: indicate to mypy that InferenceProvider.batch_completion/batch_chat_completion is concrete (#3239) 2025-08-22 14:17:30 -07:00
model_registry.py fix: change ModelRegistryHelper to use ProviderModelEntry instead of hardcoded ModelType.llm (#3451) 2025-09-22 12:55:32 -04:00
openai_compat.py refactor(logging): rename llama_stack logger categories (#3065) 2025-08-21 17:31:04 -07:00
openai_mixin.py feat: include all models from provider's /v1/models (#3471) 2025-09-18 05:17:11 -04:00
prompt_adapter.py refactor(logging): rename llama_stack logger categories (#3065) 2025-08-21 17:31:04 -07:00