mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
fixes
This commit is contained in:
parent
d089a6d106
commit
8cce68921d
2 changed files with 9 additions and 8 deletions
|
|
@ -226,11 +226,11 @@ class OpenAIMixin(NeedsRequestProviderData, ABC, BaseModel):
|
||||||
:param model: The registered model name/identifier
|
:param model: The registered model name/identifier
|
||||||
:return: The provider-specific model ID (e.g., "gpt-4")
|
: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
|
return model
|
||||||
|
|
||||||
# Look up the registered model to get the provider-specific model ID
|
# 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]
|
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
|
# provider_resource_id is str | None, but we expect it to be str for OpenAI calls
|
||||||
if model_obj.provider_resource_id is None:
|
if model_obj.provider_resource_id is None:
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,11 @@ def test_telemetry_format_completeness(mock_otlp_collector, llama_stack_client,
|
||||||
|
|
||||||
# Verify spans
|
# Verify spans
|
||||||
spans = mock_otlp_collector.get_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
|
# Collect all model_ids found in spans
|
||||||
logged_model_id = None
|
logged_model_ids = []
|
||||||
|
|
||||||
for span in spans:
|
for span in spans:
|
||||||
attrs = span.attributes
|
attrs = span.attributes
|
||||||
|
|
@ -87,10 +88,10 @@ def test_telemetry_format_completeness(mock_otlp_collector, llama_stack_client,
|
||||||
|
|
||||||
args = json.loads(attrs["__args__"])
|
args = json.loads(attrs["__args__"])
|
||||||
if "model_id" in 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
|
# At least one span should capture the fully qualified model ID
|
||||||
assert logged_model_id == text_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
|
# TODO: re-enable this once metrics get fixed
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue