-
Couldn't load subscription status.
- Fork 1.2k
feat: split API and provider specs into separate llama-stack-api pkg #3895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
431d00f to
2477826
Compare
|
marking this as ready for review to get some eyes on this! I appreciate any and all feedback here and can provider more context if necessary! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still wondering if we need to publish a new package - it adds to management overhead.
Would you be open to experiment to see what the experience will be like if we just created llama-stack[api] with the dependencies below and see what the developer experience will be for external providers?
"pydantic>=2.11.9",
"jsonschema",
"opentelemetry-sdk>=1.30.0",
"opentelemetry-exporter-otlp-proto-http>=1.30.0",
|
@raghotham sure, let me try in a separate branch. I think an extra like |
|
FWIW I'd prefer |
|
rebasing just to keep up to date. Once I am back from PTO will re-work to do the extra's approach. |
|
@raghotham , @ashwinb , @franciscojavierarceo, @leseb regarding extras vs separate package, here are my findings on why a separate pkg is desirable and actually the only option as opposed to an extra: Extras vs. Separate Package for Python extras control which dependencies get installed, not which source code is included in the package. If we used llama-stack[api], running pip install llama-stack[api] would:
This defeats the goal of providing a lightweight API-only package for external providers. Why the Separate Package Approach is Correct The current llama-stack-spec package (which I can rename to
Why the Separate Directory is Required
This pattern is standard in the Python ecosystem (examples: boto3 vs boto3-stubs, mypy vs mypy-extensions). As a concrete action in the meantime I can rename this to |
b8a7a20 to
d1df2e4
Compare
|
stack has a public api with versioning and lifecycle - /v1, /v1alpha, /v1beta. great, hard work. behind those public apis is a bunch of fast moving implementation code. @cdoern does this effectively expose that implementation code with a version for use by other projects? |
|
@mattf , the proposal here is to publish This code though is already exposed in llama-stack and is imported already by external providers. This PR just moves that code to a separately published package that if we choose we can version and release separately from Without this change, external providers will need to keep importing |
|
I wonder if we could do this a bit more piecemeal as a set of stacked PRs. Right now this feels like moving way too much out perhaps. I am going to think about it a bit more though. |
this will move the conflict from the llama-stack package to the llama-stack-api package and open a new category of issues where a user's llama-stack version isn't compatible with their llama-stack-api version. correct me if i'm wrong, i see four approaches for external providers -
consider (3) - a responses provider would be implemented against the public chat, prompt, conversations, file api endpoints, instead of against the internal provider apis. we can make (3) simpler by passing a LlamaStackClient to the external providers instead of internal provider apis. i recommend we do not do the package split. |
|
responding to each option:
Option 3 would be great but I imagine would require a re-architecture of how we register external providers and our APIs in general during stack standup. The reason external providers based around our internal provider datatypes is because that is the only way we can verify they are valid implementations and the stack will work. Would it make more sense to instead standardize our Provider Datatypes enabling the External Provider ecosystem to have a solid foundation on which folks can build providers. Otherwise, if we keep these types "internal" it's really a sneaky way of allowing breaking changes to publicly consumed API types that we really should have some backwards compatibility on.
I see the version incompatibility issue between |
|
If the alternative here is to standardize:
we can also go that route @mattf ! I do think though that a package with less deps than the entire server of Additionally, the issue of llama-stack server being a different version than what an external-provider is up to will still be problematic, especially when it comes to testing these providers. Presumably our |
that's the crux. the internal development speed of stack should not be limited by the development speed of external providers. it'd be very reasonable for a production system to standardize on 0.3.0 and make sure all the supported external providers are compatible. there's value in that productization of llama stack.
the public apis i'm referring to are the ones you just painstakingly worked to define, e.g http://localhost:8321/v1/completions etc. the other side of giving an external provider a LlamaStackClient is that the external provider can be a separate process. stack already has the concept of a passthrough provider.
i don't think we should do (4). it should be possible to achieve fast internal development and stability for external providers. |
|
I think extension "ABI" is a legitimate need if you want to enable extensions. However the approach the PR takes may need to be thought through. We have to be careful to expose absolutely minimal things. This PR seeems to move way too many things potentially. |
|
I guess we need to see what some of the external providers look like. What "extension points" are they using? Without that information we'd be designing this in a vacuum. |
|
@ashwinb that is a fair point. I can likely decrease the surface of this down to the following:
Anything else I moved is a dependent of those two. for example The provider utilities I moved are ones used directly in the API pkg. This is probably something to fix rather than to move. Most of these were from the vector_io API. I can work on fixing this in a precursor PR to this one if that'd make sense. My intended scope here was just the apis pkg and the provider datatypes. So I guess we could scope some pre-work here to unwind anything else that is moved here as a requirement that we don't want in the new sub-package? |
|
@cdoern I think that list is quite reasonable and you are exactly right that there's a bunch of things we should fix so we don't need to move as much into the extension support. |
|
@cdoern (with my provider developer hat on) I like the idea, especially isolating external providers from internal changes in z-stream releases (if the |
d67be1a to
29a322c
Compare
Extract API definitions, models, and provider specifications into a standalone llama-stack-api package that can be published to PyPI independently of the main llama-stack server. Motivation External providers currently import from llama-stack, which overrides the installed version and causes dependency conflicts. This separation allows external providers to: - Install only the type definitions they need without server dependencies - Avoid version conflicts with the installed llama-stack package - Be versioned and released independently This enables us to re-enable external provider module tests that were previously blocked by these import conflicts. Changes - Created llama-stack-api package with minimal dependencies (pydantic, jsonschema) - Moved APIs, models, providers datatypes, strong_typing, and schema_utils - Updated all imports from llama_stack.* to llama_stack_api.* - Preserved git history using git mv for moved files - Configured local editable install for development workflow - Updated linting and type-checking configuration for both packages - Rebased on top of upstream src/ layout changes Testing Package builds successfully and can be imported independently. All pre-commit hooks pass with expected exclusions maintained. Next Steps - Publish llama-stack-api to PyPI - Update external provider dependencies - Re-enable external provider module tests Signed-off-by: Charlie Doern <[email protected]>
What does this PR do?
Extract API definitions, models, and provider specifications into a standalone llama-stack-api package that can be published to PyPI independently of the main llama-stack server.
see: #2978 and #2978 (comment)
Motivation
External providers currently import from llama-stack, which overrides the installed version and causes dependency conflicts. This separation allows external providers to:
This enables us to re-enable external provider module tests that were previously blocked by these import conflicts.
Changes
Notes
the
provider.utils.vector_ioutility is used heavily in theapi.vector_iopkg so I needed to move this. I wonder If it'd be better to instead relocate those utils elsewhere or if it makes sense for the utils for all providers to be in this pkg so external providers can take advantage of them cc @franciscojavierarceocore.telemetrywas moved tollama_stack_apibecause it is directly used by the apis (trace_protocol) cc @ehhuang @iamemilioNext Steps
relates to #3237
Test Plan
Package builds successfully and can be imported independently. All pre-commit hooks pass with expected exclusions maintained.