Address review comments

Signed-off-by: Bill Murdock <bmurdock@redhat.com>
This commit is contained in:
Bill Murdock 2025-10-06 15:45:24 -04:00
parent ca771cd921
commit 1d941b6aa0
9 changed files with 61 additions and 200 deletions

View file

@ -25,12 +25,16 @@ class WatsonXConfig(RemoteInferenceProviderConfig):
default_factory=lambda: os.getenv("WATSONX_BASE_URL", "https://us-south.ml.cloud.ibm.com"),
description="A base url for accessing the watsonx.ai",
)
# This seems like it should be required, but none of the other remote inference
# providers require it, so this is optional here too for consistency.
# The OpenAIConfig uses default=None instead, so this is following that precedent.
api_key: SecretStr | None = Field(
default_factory=lambda: os.getenv("WATSONX_API_KEY"),
default=None,
description="The watsonx.ai API key",
)
# As above, this is optional here too for consistency.
project_id: str | None = Field(
default_factory=lambda: os.getenv("WATSONX_PROJECT_ID"),
default=None,
description="The watsonx.ai project ID",
)
timeout: int = Field(

View file

@ -16,9 +16,6 @@ from llama_stack.providers.utils.inference.litellm_openai_mixin import LiteLLMOp
class WatsonXInferenceAdapter(LiteLLMOpenAIMixin):
_config: WatsonXConfig
__provider_id__: str = "watsonx"
def __init__(self, config: WatsonXConfig):
LiteLLMOpenAIMixin.__init__(
self,
@ -29,17 +26,9 @@ class WatsonXInferenceAdapter(LiteLLMOpenAIMixin):
self.available_models = None
self.config = config
# get_api_key = LiteLLMOpenAIMixin.get_api_key
def get_base_url(self) -> str:
return self.config.url
async def initialize(self):
await super().initialize()
async def shutdown(self):
await super().shutdown()
async def _get_params(self, request: ChatCompletionRequest) -> dict[str, Any]:
# Get base parameters from parent
params = await super()._get_params(request)