mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 19:04:19 +00:00
chore: deprecate /v1/inspect/providers (#1678)
# What does this PR do? with the new /v1/providers API, /v1/inspect/providers is duplicative, deprecate it by removing the route, and add a test for the full /v1/providers API resolves #1623 ## Test Plan `uv run pytest -v tests/integration/providers --stack-config=ollama --text-model="meta-llama/Llama-3.2-3B-Instruct" --embedding-model=all-MiniLM-L6-v2` <img width="1512" alt="Screenshot 2025-03-18 at 9 18 38 AM" src="https://github.com/user-attachments/assets/2db30f25-3ff6-4374-b39d-0047f093fe36" /> Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
1f04ca357b
commit
a483a58c6e
6 changed files with 7 additions and 36 deletions
BIN
distributions/ramalama/faiss_store.db
Normal file
BIN
distributions/ramalama/faiss_store.db
Normal file
Binary file not shown.
2
docs/_static/llama-stack-spec.html
vendored
2
docs/_static/llama-stack-spec.html
vendored
|
@ -2650,7 +2650,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"Inspect"
|
"Providers"
|
||||||
],
|
],
|
||||||
"description": "",
|
"description": "",
|
||||||
"parameters": []
|
"parameters": []
|
||||||
|
|
2
docs/_static/llama-stack-spec.yaml
vendored
2
docs/_static/llama-stack-spec.yaml
vendored
|
@ -1814,7 +1814,7 @@ paths:
|
||||||
default:
|
default:
|
||||||
$ref: '#/components/responses/DefaultError'
|
$ref: '#/components/responses/DefaultError'
|
||||||
tags:
|
tags:
|
||||||
- Inspect
|
- Providers
|
||||||
description: ''
|
description: ''
|
||||||
parameters: []
|
parameters: []
|
||||||
/v1/inspect/routes:
|
/v1/inspect/routes:
|
||||||
|
|
|
@ -24,17 +24,6 @@ class HealthInfo(BaseModel):
|
||||||
# TODO: add a provider level status
|
# TODO: add a provider level status
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
|
||||||
class ProviderInfo(BaseModel):
|
|
||||||
api: str
|
|
||||||
provider_id: str
|
|
||||||
provider_type: str
|
|
||||||
|
|
||||||
|
|
||||||
class ListProvidersResponse(BaseModel):
|
|
||||||
data: List[ProviderInfo]
|
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class VersionInfo(BaseModel):
|
class VersionInfo(BaseModel):
|
||||||
version: str
|
version: str
|
||||||
|
@ -46,9 +35,6 @@ class ListRoutesResponse(BaseModel):
|
||||||
|
|
||||||
@runtime_checkable
|
@runtime_checkable
|
||||||
class Inspect(Protocol):
|
class Inspect(Protocol):
|
||||||
@webmethod(route="/inspect/providers", method="GET")
|
|
||||||
async def list_providers(self) -> ListProvidersResponse: ...
|
|
||||||
|
|
||||||
@webmethod(route="/inspect/routes", method="GET")
|
@webmethod(route="/inspect/routes", method="GET")
|
||||||
async def list_routes(self) -> ListRoutesResponse: ...
|
async def list_routes(self) -> ListRoutesResponse: ...
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,7 @@ from pydantic import BaseModel
|
||||||
from llama_stack.apis.inspect import (
|
from llama_stack.apis.inspect import (
|
||||||
HealthInfo,
|
HealthInfo,
|
||||||
Inspect,
|
Inspect,
|
||||||
ListProvidersResponse,
|
|
||||||
ListRoutesResponse,
|
ListRoutesResponse,
|
||||||
ProviderInfo,
|
|
||||||
RouteInfo,
|
RouteInfo,
|
||||||
VersionInfo,
|
VersionInfo,
|
||||||
)
|
)
|
||||||
|
@ -39,24 +37,6 @@ class DistributionInspectImpl(Inspect):
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def list_providers(self) -> ListProvidersResponse:
|
|
||||||
run_config = self.config.run_config
|
|
||||||
|
|
||||||
ret = []
|
|
||||||
for api, providers in run_config.providers.items():
|
|
||||||
ret.extend(
|
|
||||||
[
|
|
||||||
ProviderInfo(
|
|
||||||
api=api,
|
|
||||||
provider_id=p.provider_id,
|
|
||||||
provider_type=p.provider_type,
|
|
||||||
)
|
|
||||||
for p in providers
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
return ListProvidersResponse(data=ret)
|
|
||||||
|
|
||||||
async def list_routes(self) -> ListRoutesResponse:
|
async def list_routes(self) -> ListRoutesResponse:
|
||||||
run_config = self.config.run_config
|
run_config = self.config.run_config
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,8 @@ class TestProviders:
|
||||||
def test_list(self, llama_stack_client: LlamaStackAsLibraryClient | LlamaStackClient):
|
def test_list(self, llama_stack_client: LlamaStackAsLibraryClient | LlamaStackClient):
|
||||||
provider_list = llama_stack_client.providers.list()
|
provider_list = llama_stack_client.providers.list()
|
||||||
assert provider_list is not None
|
assert provider_list is not None
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
def test_inspect(self, llama_stack_client: LlamaStackAsLibraryClient | LlamaStackClient):
|
||||||
|
provider_list = llama_stack_client.providers.retrieve("ollama")
|
||||||
|
assert provider_list is not None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue