This commit is contained in:
Ashwin Bharambe 2025-10-27 19:20:38 -07:00
parent d089a6d106
commit 8cce68921d
2 changed files with 9 additions and 8 deletions

View file

@ -226,11 +226,11 @@ class OpenAIMixin(NeedsRequestProviderData, ABC, BaseModel):
:param model: The registered model name/identifier
:return: The provider-specific model ID (e.g., "gpt-4")
"""
if not await self.model_store.has_model(model):
# self.model_store is injected by the distribution system at runtime
if not await self.model_store.has_model(model): # type: ignore[attr-defined]
return model
# Look up the registered model to get the provider-specific model ID
# self.model_store is injected by the distribution system at runtime
model_obj: Model = await self.model_store.get_model(model) # type: ignore[attr-defined]
# provider_resource_id is str | None, but we expect it to be str for OpenAI calls
if model_obj.provider_resource_id is None:

View file

@ -64,10 +64,11 @@ def test_telemetry_format_completeness(mock_otlp_collector, llama_stack_client,
# Verify spans
spans = mock_otlp_collector.get_spans()
assert len(spans) == 5, f"Expected 5 spans, got {len(spans)}"
# Expected spans: 1 root span + 3 autotraced method calls from routing/inference
assert len(spans) == 4, f"Expected 4 spans, got {len(spans)}"
# we only need this captured one time
logged_model_id = None
# Collect all model_ids found in spans
logged_model_ids = []
for span in spans:
attrs = span.attributes
@ -87,10 +88,10 @@ def test_telemetry_format_completeness(mock_otlp_collector, llama_stack_client,
args = json.loads(attrs["__args__"])
if "model_id" in args:
logged_model_id = args["model_id"]
logged_model_ids.append(args["model_id"])
assert logged_model_id is not None
assert logged_model_id == text_model_id
# At least one span should capture the fully qualified model ID
assert text_model_id in logged_model_ids, f"Expected to find {text_model_id} in spans, but got {logged_model_ids}"
# TODO: re-enable this once metrics get fixed
"""