mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
fix: use provider_data API keys in list_provider_model_ids
Anthropic and Databricks providers were calling get_api_key() which only checks config, not provider_data. Changed to use _get_api_key_from_config_or_provider_data() so dynamic model listing works with per-request API keys.
This commit is contained in:
parent
c0d51c89e6
commit
7293d438ef
2 changed files with 4 additions and 2 deletions
|
|
@ -33,4 +33,5 @@ class AnthropicInferenceAdapter(OpenAIMixin):
|
||||||
return "https://api.anthropic.com/v1"
|
return "https://api.anthropic.com/v1"
|
||||||
|
|
||||||
async def list_provider_model_ids(self) -> Iterable[str]:
|
async def list_provider_model_ids(self) -> Iterable[str]:
|
||||||
return [m.id async for m in AsyncAnthropic(api_key=self.get_api_key()).models.list()]
|
api_key = self._get_api_key_from_config_or_provider_data()
|
||||||
|
return [m.id async for m in AsyncAnthropic(api_key=api_key).models.list()]
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,11 @@ class DatabricksInferenceAdapter(OpenAIMixin):
|
||||||
|
|
||||||
async def list_provider_model_ids(self) -> Iterable[str]:
|
async def list_provider_model_ids(self) -> Iterable[str]:
|
||||||
# Filter out None values from endpoint names
|
# Filter out None values from endpoint names
|
||||||
|
api_token = self._get_api_key_from_config_or_provider_data()
|
||||||
return [
|
return [
|
||||||
endpoint.name # type: ignore[misc]
|
endpoint.name # type: ignore[misc]
|
||||||
for endpoint in WorkspaceClient(
|
for endpoint in WorkspaceClient(
|
||||||
host=self.config.url, token=self.get_api_key()
|
host=self.config.url, token=api_token
|
||||||
).serving_endpoints.list() # TODO: this is not async
|
).serving_endpoints.list() # TODO: this is not async
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue