mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-23 08:22:28 +00:00
feat: migrate Providers API to FastAPI router pattern (#4405)
# What does this PR do? Convert Providers API from @webmethod decorators to FastAPI router pattern. Fixes: https://github.com/llamastack/llama-stack/issues/4350 <!-- Provide a short summary of what this PR does and why. Link to relevant issues if applicable. --> <!-- If resolving an issue, uncomment and update the line below --> <!-- Closes #[issue-number] --> ## Test Plan CI Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
722d9c53e7
commit
cd5095a247
13 changed files with 287 additions and 121 deletions
43
src/llama_stack_api/providers/models.py
Normal file
43
src/llama_stack_api/providers/models.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
"""Pydantic models for Providers API requests and responses.
|
||||
|
||||
This module defines the request and response models for the Providers API
|
||||
using Pydantic with Field descriptions for OpenAPI schema generation.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from llama_stack_api.datatypes import HealthResponse
|
||||
from llama_stack_api.schema_utils import json_schema_type
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class ProviderInfo(BaseModel):
|
||||
"""Information about a registered provider including its configuration and health status."""
|
||||
|
||||
api: str = Field(..., description="The API name this provider implements")
|
||||
provider_id: str = Field(..., description="Unique identifier for the provider")
|
||||
provider_type: str = Field(..., description="The type of provider implementation")
|
||||
config: dict[str, Any] = Field(..., description="Configuration parameters for the provider")
|
||||
health: HealthResponse = Field(..., description="Current health status of the provider")
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class ListProvidersResponse(BaseModel):
|
||||
"""Response containing a list of all available providers."""
|
||||
|
||||
data: list[ProviderInfo] = Field(..., description="List of provider information objects")
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class InspectProviderRequest(BaseModel):
|
||||
"""Request model for inspecting a provider by ID."""
|
||||
|
||||
provider_id: str = Field(..., description="The ID of the provider to inspect.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue