update: code review

- change type from str to Field with description
- remove test from test_distrubution.py, keep in test_providers.py

Signed-off-by: Wen Zhou <wenzhou@redhat.com>
This commit is contained in:
Wen Zhou 2025-07-03 17:11:52 +02:00
parent 0b051c037b
commit 2ce9402593
3 changed files with 30 additions and 127 deletions

View file

@ -6,7 +6,7 @@
from typing import Any, Protocol, runtime_checkable
from pydantic import BaseModel, HttpUrl, field_validator
from pydantic import BaseModel, Field, HttpUrl, field_validator
from llama_stack.providers.datatypes import HealthResponse
from llama_stack.schema_utils import json_schema_type, webmethod
@ -19,7 +19,9 @@ class ProviderInfo(BaseModel):
provider_type: str
config: dict[str, Any]
health: HealthResponse
metrics: str | None = None # define as string type than httpurl for openapi compatibility
metrics: str | None = Field(
default=None, description="endpoint for metrics from providers. Must be a valid HTTP URL if provided."
)
@field_validator("metrics")
@classmethod