Skip to content

Conversation

@cdoern
Copy link
Contributor

@cdoern cdoern commented Sep 8, 2025

What does this PR do?

currently RemoteProviderSpec has an AdapterSpec embedded in it. Remove AdapterSpec, and put its leftover fields into RemoteProviderSpec.

Additionally, many of the fields were duplicated between InlineProviderSpec and RemoteProviderSpec. Move these to ProviderSpec so they are shared.

Fixup the distro codegen to use RemoteProviderSpec directly rather than remote_provider_spec which took an AdapterSpec and returned a full provider spec

Test Plan

existing distro tests should pass.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 8, 2025
@cdoern cdoern force-pushed the align-datatypes branch 10 times, most recently from 2d7b7c1 to f9d8cda Compare September 10, 2025 20:20
@cdoern cdoern marked this pull request as ready for review September 10, 2025 21:11
@property
def pip_packages(self) -> list[str]:
raise AssertionError("Should not be called on AutoRoutedProviderSpec")
pip_packages: list[str] = Field(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this, seems like ... a separate issue but one I had to wrangle with to get this working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, let me try just removing this?

@cdoern cdoern force-pushed the align-datatypes branch 4 times, most recently from e4f5e2a to b845533 Compare September 11, 2025 13:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR consolidates provider specification data structures by removing the AdapterSpec class and moving its fields directly into RemoteProviderSpec. Additionally, it promotes shared fields between InlineProviderSpec and RemoteProviderSpec to their common base class ProviderSpec to eliminate duplication.

  • Eliminates the AdapterSpec class and inlines its fields into RemoteProviderSpec
  • Moves shared fields (pip_packages, provider_data_validator) to ProviderSpec base class
  • Updates provider registry files to use RemoteProviderSpec constructor directly
  • Replaces remote_provider_spec factory function with direct RemoteProviderSpec usage

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
llama_stack/providers/datatypes.py Removes AdapterSpec class, adds shared fields to ProviderSpec, removes remote_provider_spec function
llama_stack/core/distribution.py Updates provider spec loading to use RemoteProviderSpec directly
llama_stack/providers/registry/*.py Updates all provider registries to use new RemoteProviderSpec constructor
tests/unit/distribution/test_distribution.py Updates test assertions and YAML specs to match new structure
tests/external/ Updates external provider configurations
llama_stack/distributions/starter/starter.py Updates provider filtering to use new field structure
llama_stack/core/datatypes.py Removes unused property override

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

description="HuggingFace Inference Endpoints provider for dedicated model serving.",
),
provider_type="remote::hf::endpoint",
adapter_type="hf::endpoint",
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

[nitpick] The provider_type and adapter_type fields have the same value but different formats (remote::hf::endpoint vs hf::endpoint). This inconsistency could be confusing - consider standardizing the format or documenting why they differ.

Suggested change
adapter_type="hf::endpoint",
adapter_type="remote::hf::endpoint",

Copilot uses AI. Check for mistakes.
Comment on lines +287 to +289
provider_type="remote::azure",
adapter_type="azure",
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Same inconsistency as above - provider_type includes the remote:: prefix while adapter_type does not. This pattern appears to be consistent across the file but could benefit from documentation or standardization.

Copilot uses AI. Check for mistakes.
f.write(malformed_spec)

with pytest.raises(KeyError) as exc_info:
with pytest.raises(ValidationError) as exc_info:
Copy link

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

The exception type change from KeyError to ValidationError should include the corresponding import statement. Ensure ValidationError is imported at the top of the file.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@mattf mattf left a comment

Choose a reason for hiding this comment

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

looking good. co-pilot raises an interesting question. should provider_type be inferred from the spec type and the adapter_type?

RemoteProviderSpec(
   ...
   provider_type="remote::XYZ",
   adapter_type="XYZ",
   ...
)

->

RemoteProviderSpec(
   ...
   adapter_type="XYZ",
   ...
)

the old remove_provider_spec function did this.

@cdoern
Copy link
Contributor Author

cdoern commented Sep 11, 2025

looking good. co-pilot raises an interesting question. should provider_type be inferred from the spec type and the adapter_type?

RemoteProviderSpec(
   ...
   provider_type="remote::XYZ",
   adapter_type="XYZ",
   ...
)

->

RemoteProviderSpec(
   ...
   adapter_type="XYZ",
   ...
)

the old remove_provider_spec function did this.

I also considered this @mattf , but I was thinking the other way: get rid of adapter_type and only use provider_type since it's more descriptive. I don't feel too strongly about this besides getting rid of the remote_provider_spec function as it provides minimal value now that these are aligned more.

I think we keep this as is for now and if we think of a clever further refactor we can pull adapter_type out

@cdoern
Copy link
Contributor Author

cdoern commented Sep 11, 2025

rebased.

@cdoern
Copy link
Contributor Author

cdoern commented Sep 15, 2025

@mattf , any thoughts here?

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.

Quick hold for discussion, is there any impact on external providers that should be reflected here? Thanks

@cdoern
Copy link
Contributor Author

cdoern commented Sep 17, 2025

@leseb yes, external providers will need to switch their provider_spec methods to use RemoteProviderSpec directly rather than the helper.

Given that 0.2.22 is cut, I think we can merge this and let the various external provider authors know about this change.

@mattf
Copy link
Collaborator

mattf commented Sep 17, 2025

@mattf , any thoughts here?

please don't rebase. it makes it very time consuming to figure out what you've changed since the last review.

image

there's no indication what you changed.

@cdoern
Copy link
Contributor Author

cdoern commented Sep 17, 2025

@mattf , I changed nothing besides rebasing since you last reviewed, I believe.

FWIW, if we don't want folks to rebase, we should disable the alerts on the PRs indicating there are conflicts with the main branch, that is the only reason I do it! Sorry for the confusion!

@mattf
Copy link
Collaborator

mattf commented Sep 17, 2025

@mattf , I changed nothing besides rebasing since you last reviewed, I believe.

FWIW, if we don't want folks to rebase, we should disable the alerts on the PRs indicating there are conflicts with the main branch, that is the only reason I do it! Sorry for the confusion!

right now there's an option to merge or rebase to update the branch, please prefer the merge option.

i'll check w/ admins about https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-rebasing-for-pull-requests

@cdoern
Copy link
Contributor Author

cdoern commented Sep 18, 2025

rebasing due to conflicts
Screenshot 2025-09-18 at 9 00 14 AM

all I am changing is the rebase, nothing more.

currently `RemoteProviderSpec` has an `AdapterSpec` embedded in it. Remove `AdapterSpec`, and put its leftover fields into `RemoteProviderSpec`.

Additionally, many of the fields were duplicated between `InlineProviderSpec` and `RemoteProviderSpec`. Move these to `ProviderSpec` so they are shared.

Fixup the distro codegen to use `RemoteProviderSpec` directly rather than `remote_provider_spec` which took an AdapterSpec and returned a full provider spec

Signed-off-by: Charlie Doern <[email protected]>
@cdoern cdoern requested a review from leseb September 18, 2025 13:05
@leseb
Copy link
Collaborator

leseb commented Sep 18, 2025

@cdoern we need to followup on updating the external provider doc. Thanks!

@leseb leseb merged commit 8422bd1 into llamastack:main Sep 18, 2025
43 checks passed
iamemilio pushed a commit to iamemilio/llama-stack that referenced this pull request Sep 24, 2025
# What does this PR do?

currently `RemoteProviderSpec` has an `AdapterSpec` embedded in it.
Remove `AdapterSpec`, and put its leftover fields into
`RemoteProviderSpec`.

Additionally, many of the fields were duplicated between
`InlineProviderSpec` and `RemoteProviderSpec`. Move these to
`ProviderSpec` so they are shared.

Fixup the distro codegen to use `RemoteProviderSpec` directly rather
than `remote_provider_spec` which took an AdapterSpec and returned a
full provider spec

## Test Plan

existing distro tests should pass.

Signed-off-by: Charlie Doern <[email protected]>
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.

3 participants