@@ -131,6 +131,15 @@ class ProviderSpec(BaseModel):
131131 """ ,
132132 )
133133
134+ pip_packages : list [str ] = Field (
135+ default_factory = list ,
136+ description = "The pip dependencies needed for this implementation" ,
137+ )
138+
139+ provider_data_validator : str | None = Field (
140+ default = None ,
141+ )
142+
134143 is_external : bool = Field (default = False , description = "Notes whether this provider is an external provider." )
135144
136145 # used internally by the resolver; this is a hack for now
@@ -145,56 +154,15 @@ class RoutingTable(Protocol):
145154 async def get_provider_impl (self , routing_key : str ) -> Any : ...
146155
147156
148- # TODO: this can now be inlined into RemoteProviderSpec
149- @json_schema_type
150- class AdapterSpec (BaseModel ):
151- adapter_type : str = Field (
152- ...,
153- description = "Unique identifier for this adapter" ,
154- )
155- module : str = Field (
156- default_factory = str ,
157- description = """
158- Fully-qualified name of the module to import. The module is expected to have:
159-
160- - `get_adapter_impl(config, deps)`: returns the adapter implementation
161- """ ,
162- )
163- pip_packages : list [str ] = Field (
164- default_factory = list ,
165- description = "The pip dependencies needed for this implementation" ,
166- )
167- config_class : str = Field (
168- description = "Fully-qualified classname of the config for this provider" ,
169- )
170- provider_data_validator : str | None = Field (
171- default = None ,
172- )
173- description : str | None = Field (
174- default = None ,
175- description = """
176- A description of the provider. This is used to display in the documentation.
177- """ ,
178- )
179-
180-
181157@json_schema_type
182158class InlineProviderSpec (ProviderSpec ):
183- pip_packages : list [str ] = Field (
184- default_factory = list ,
185- description = "The pip dependencies needed for this implementation" ,
186- )
187159 container_image : str | None = Field (
188160 default = None ,
189161 description = """
190162The container image to use for this implementation. If one is provided, pip_packages will be ignored.
191163If a provider depends on other providers, the dependencies MUST NOT specify a container image.
192164""" ,
193165 )
194- # module field is inherited from ProviderSpec
195- provider_data_validator : str | None = Field (
196- default = None ,
197- )
198166 description : str | None = Field (
199167 default = None ,
200168 description = """
@@ -223,44 +191,22 @@ def from_url(cls, url: str) -> "RemoteProviderConfig":
223191
224192@json_schema_type
225193class RemoteProviderSpec (ProviderSpec ):
226- adapter : AdapterSpec = Field (
194+ adapter_type : str = Field (
195+ ...,
196+ description = "Unique identifier for this adapter" ,
197+ )
198+
199+ description : str | None = Field (
200+ default = None ,
227201 description = """
228- If some code is needed to convert the remote responses into Llama Stack compatible
229- API responses, specify the adapter here.
202+ A description of the provider. This is used to display in the documentation.
230203""" ,
231204 )
232205
233206 @property
234207 def container_image (self ) -> str | None :
235208 return None
236209
237- # module field is inherited from ProviderSpec
238-
239- @property
240- def pip_packages (self ) -> list [str ]:
241- return self .adapter .pip_packages
242-
243- @property
244- def provider_data_validator (self ) -> str | None :
245- return self .adapter .provider_data_validator
246-
247-
248- def remote_provider_spec (
249- api : Api ,
250- adapter : AdapterSpec ,
251- api_dependencies : list [Api ] | None = None ,
252- optional_api_dependencies : list [Api ] | None = None ,
253- ) -> RemoteProviderSpec :
254- return RemoteProviderSpec (
255- api = api ,
256- provider_type = f"remote::{ adapter .adapter_type } " ,
257- config_class = adapter .config_class ,
258- module = adapter .module ,
259- adapter = adapter ,
260- api_dependencies = api_dependencies or [],
261- optional_api_dependencies = optional_api_dependencies or [],
262- )
263-
264210
265211class HealthStatus (StrEnum ):
266212 OK = "OK"
0 commit comments