- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
feat: combine ProviderSpec datatypes #3378
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
Conversation
2d7b7c1    to
    f9d8cda      
    Compare
  
    f9d8cda    to
    7f0b608      
    Compare
  
            
          
                llama_stack/core/datatypes.py
              
                Outdated
          
        
      | @property | ||
| def pip_packages(self) -> list[str]: | ||
| raise AssertionError("Should not be called on AutoRoutedProviderSpec") | ||
| pip_packages: list[str] = Field( | 
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.
this, seems like ... a separate issue but one I had to wrangle with to get this working.
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.
actually, let me try just removing this?
e4f5e2a    to
    b845533      
    Compare
  
    b845533    to
    911f8c7      
    Compare
  
    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.
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 AdapterSpecclass and inlines its fields intoRemoteProviderSpec
- Moves shared fields (pip_packages,provider_data_validator) toProviderSpecbase class
- Updates provider registry files to use RemoteProviderSpecconstructor directly
- Replaces remote_provider_specfactory function with directRemoteProviderSpecusage
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 AdapterSpecclass, adds shared fields toProviderSpec, removesremote_provider_specfunction | 
| llama_stack/core/distribution.py | Updates provider spec loading to use RemoteProviderSpecdirectly | 
| llama_stack/providers/registry/*.py | Updates all provider registries to use new RemoteProviderSpecconstructor | 
| 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", | 
    
      
    
      Copilot
AI
    
    
    
      Sep 11, 2025 
    
  
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.
[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.
| adapter_type="hf::endpoint", | |
| adapter_type="remote::hf::endpoint", | 
| provider_type="remote::azure", | ||
| adapter_type="azure", | 
    
      
    
      Copilot
AI
    
    
    
      Sep 11, 2025 
    
  
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.
[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.
| f.write(malformed_spec) | ||
|  | ||
| with pytest.raises(KeyError) as exc_info: | ||
| with pytest.raises(ValidationError) as exc_info: | 
    
      
    
      Copilot
AI
    
    
    
      Sep 11, 2025 
    
  
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.
The exception type change from KeyError to ValidationError should include the corresponding import statement. Ensure ValidationError is imported at the top of the file.
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.
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  I think we keep this as is for now and if we think of a clever further refactor we can pull  | 
911f8c7    to
    99c31e6      
    Compare
  
    | rebased. | 
| @mattf , any thoughts here? | 
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.
Quick hold for discussion, is there any impact on external providers that should be reflected here? Thanks
| @leseb yes, external providers will need to switch their  Given that 0.2.22 is cut, I think we can merge this and let the various external provider authors know about this change. | 
99c31e6    to
    06ef5a0      
    Compare
  
    | 
 please don't rebase. it makes it very time consuming to figure out what you've changed since the last review.   there's no indication what you changed. | 
| @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 | 
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]>
06ef5a0    to
    686f87d      
    Compare
  
    | @cdoern we need to followup on updating the external provider doc. Thanks! | 
# 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]>

What does this PR do?
currently
RemoteProviderSpechas anAdapterSpecembedded in it. RemoveAdapterSpec, and put its leftover fields intoRemoteProviderSpec.Additionally, many of the fields were duplicated between
InlineProviderSpecandRemoteProviderSpec. Move these toProviderSpecso they are shared.Fixup the distro codegen to use
RemoteProviderSpecdirectly rather thanremote_provider_specwhich took an AdapterSpec and returned a full provider specTest Plan
existing distro tests should pass.