Skip to content

Conversation

@franciscojavierarceo
Copy link
Collaborator

What does this PR do?

Fixes this warning in llama stack build:

WARNING  2025-09-15 15:29:02,197 llama_stack.core.distribution:149 core: Failed to import module prompts: No module named
         'llama_stack.providers.registry.prompts'"

Test Plan

Test added

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

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

Can you clarify why this is the right fix? Thanks!

@franciscojavierarceo
Copy link
Collaborator Author

Can you clarify why this is the right fix? Thanks!

  1. The original implementation did not use the provider construct (because I believe it does not make sense to have providers for prompts), so it is not really a providable_api
    • I should have caught this warning in the original implementation
  2. I confirmed the API and endpoints works and the tests pass

Let me know if i missed something though!

Copy link
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

thanks! This mechanism of providable_apis is going to get tricky as we expand, I wonder if we should have a way on the API definition itself to set an API as "providable" or not rather than having the logic here, but that can be done in a follow up.

def providable_apis() -> list[Api]:
routing_table_apis = {x.routing_table_api for x in builtin_automatically_routed_apis()}
return [api for api in Api if api not in routing_table_apis and api != Api.inspect and api != Api.providers]
internal_apis = {Api.inspect, Api.providers, Api.prompts}
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I have this in a branch as well. This is the right fix! thanks

@ehhuang
Copy link
Contributor

ehhuang commented Sep 16, 2025

have a way on the API definition itself to set an API as "providable"

+1

Comment on lines 155 to 166
def test_internal_apis_excluded(self):
"""Test that internal APIs are excluded and other APIs are included in providable APIs."""
apis = providable_apis()
internal_apis = {Api.inspect, Api.providers, Api.prompts}

for internal_api in internal_apis:
assert internal_api not in apis, f"Internal API {internal_api} should not be in providable_apis"

included_apis = {Api.inference, Api.safety, Api.agents}
for api in included_apis:
assert api in apis, f"API {api} should be in providable_apis"

Copy link
Contributor

Choose a reason for hiding this comment

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

while this verifies the change in this PR, this test does not prevent new providers from running into the same issue. I wonder if we can add a test that catches the current issue that's fixed by this PR?

Copy link
Collaborator Author

@franciscojavierarceo franciscojavierarceo Sep 16, 2025

Choose a reason for hiding this comment

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

How about a global that can be imported and tested against?

Copy link
Contributor

Choose a reason for hiding this comment

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

like a fixture? yea i think that can work

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

mind taking a look at the latest change? if you're good with it, feel free to merge. I confirmed it'll fail the test by raising the import error for the registry (since APIs of this nature should not have a registry).

Copy link
Contributor

@ehhuang ehhuang left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! One comment on testing

@leseb leseb merged commit 9acf497 into llamastack:main Sep 17, 2025
21 checks passed
iamemilio pushed a commit to iamemilio/llama-stack that referenced this pull request Sep 24, 2025
# What does this PR do?
Fixes this warning in llama stack build:

```bash
WARNING  2025-09-15 15:29:02,197 llama_stack.core.distribution:149 core: Failed to import module prompts: No module named
         'llama_stack.providers.registry.prompts'"
```

## Test Plan
Test added

---------

Signed-off-by: Francisco Javier Arceo <farceo@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.

4 participants