Update AIService.set_model_name to AIService._sync_model_name_to_metrics to:

- indicate clearly that it's not meant for public use
- make it clear the `self._settings` is the single source of truth for model information
- set the stage for an upcoming change where `AIService` subclasses won't have to ever worry about explicitly calling an `AIService` method to sync model name to metrics

Across all services, switch from accessing `self._model_name` or `self.model_name` in favor of `self._settings.model`.
This commit is contained in:
Paul Kompfner
2026-02-20 11:42:24 -05:00
parent f5b86d9cdc
commit 29e2a861dc
54 changed files with 173 additions and 177 deletions

View File

@@ -78,7 +78,8 @@ class FalImageGenService(ImageGenService):
**kwargs: Additional arguments passed to parent ImageGenService.
"""
super().__init__(**kwargs)
self.set_model_name(model)
self._settings.model = model
self._sync_model_name_to_metrics()
self._params = params
self._aiohttp_session = aiohttp_session
if key:
@@ -103,7 +104,7 @@ class FalImageGenService(ImageGenService):
logger.debug(f"Generating image from prompt: {prompt}")
response = await fal_client.run_async(
self.model_name,
self._settings.model,
arguments={"prompt": prompt, **self._params.model_dump(exclude_none=True)},
)