Skip to content

Conversation

@nathan-weinberg
Copy link
Contributor

What does this PR do?

Migrate from @webmethod decorators to FastAPI router pattern

Closes #4347

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 17, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 2025

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

feat: convert models API to use a FastAPI router

Edit this comment to update it. It will appear in the SDK's changelogs.

llama-stack-client-kotlin studio · code · diff

Your SDK built successfully.
generate ⚠️lint ✅test ❗

llama-stack-client-node studio · code · diff

Your SDK built successfully.
generate ⚠️build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/llama-stack-client-node/6328b748f9015433f07fcf762cdf507031fff186/dist.tar.gz
llama-stack-client-python studio · conflict

There was a conflict between your custom code and your generated changes.
You don't need to resolve this conflict right now, but you will need to resolve it for your changes to be released to your users. Read more about why this happened here.

llama-stack-client-go studio · conflict

There was a conflict between your custom code and your generated changes.
You don't need to resolve this conflict right now, but you will need to resolve it for your changes to be released to your users. Read more about why this happened here.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
Last updated: 2025-12-20 01:49:39 UTC

@nathan-weinberg nathan-weinberg marked this pull request as ready for review December 18, 2025 20:16
@nathan-weinberg nathan-weinberg force-pushed the fastapi-models branch 2 times, most recently from 78b26ec to d925af3 Compare December 20, 2025 01:40
@nathan-weinberg nathan-weinberg force-pushed the fastapi-models branch 3 times, most recently from 622891a to 6ddbe30 Compare January 5, 2026 15:40
@gyliu513
Copy link
Contributor

gyliu513 commented Jan 5, 2026

Hi @nathan-weinberg , are you going to update unit test at https://github.com/llamastack/llama-stack/tree/main/tests/unit in follow up PR? Thanks

@nathan-weinberg
Copy link
Contributor Author

Hi @nathan-weinberg , are you going to update unit test at https://github.com/llamastack/llama-stack/tree/main/tests/unit in follow up PR? Thanks

What needs updating?

@gyliu513
Copy link
Contributor

gyliu513 commented Jan 5, 2026

@nathan-weinberg For example, in https://github.com/llamastack/llama-stack/tree/main/tests/unit/core/routers
there aren’t any inference router tests yet (e.g., test_inference_router.py). I think this is just legacy/tech-debt, looks like not all router tests were kept up to date.

@nathan-weinberg
Copy link
Contributor Author

@nathan-weinberg For example, in https://github.com/llamastack/llama-stack/tree/main/tests/unit/core/routers there aren’t any inference router tests yet (e.g., test_inference_router.py). I think this is just legacy/tech-debt, looks like not all router tests were kept up to date.

That would be done as a separate PR then, since it does not pertain to what this PR is doing

could you open an issue to track it?

@mergify
Copy link

mergify bot commented Jan 6, 2026

This pull request has merge conflicts that must be resolved before it can be merged. @nathan-weinberg please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Jan 6, 2026
async def get_model(self, model_id: str) -> Model:
async def get_model(self, request_or_model_id: GetModelRequest | str) -> Model:
# Support both the public Models API (GetModelRequest) and internal ModelStore interface (string)
if isinstance(request_or_model_id, str):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if isinstance(request_or_model_id, str):
if isinstance(request_or_model_id, GetModelRequest):
model_id = request_or_model_id.model_id
else:
model_id = request_or_model_id

you could also use *, in the signature to be extra strict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - curious, what does the * in the signature do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, tests don't seem to like it

Migrate from @webmethod decorators to FastAPI router
pattern

Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert models API to use a FastAPI router

3 participants