Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Address PR review feedback on img-gen workers
Louis Choquela549a291764f
diff --git a/pipelex/cogt/img_gen/img_gen_args_factory.py b/pipelex/cogt/img_gen/img_gen_args_factory.pyindex 7426e9828..99f513ffb 100644--- a/pipelex/cogt/img_gen/img_gen_args_factory.py+++ b/pipelex/cogt/img_gen/img_gen_args_factory.py@@ -189,7 +189,7 @@ class ImgGenArgsFactory:raise ImgGenParameterError(msg)if job_params.input_fidelity is not None and ImgGenArgTopic.INPUT_FIDELITY not in model_rules:- msg = f"Model '{model_id}' does not support input_fidelity"+ msg = f"Model '{model_name}' does not support input_fidelity"raise ImgGenParameterError(msg)return args_dictdiff --git a/pipelex/plugins/azure_rest/azure_img_gen_worker.py b/pipelex/plugins/azure_rest/azure_img_gen_worker.pyindex 8db1dfae3..664e1790d 100644--- a/pipelex/plugins/azure_rest/azure_img_gen_worker.py+++ b/pipelex/plugins/azure_rest/azure_img_gen_worker.py@@ -107,9 +107,15 @@ class AzureImgGenWorker(ImgGenWorkerAbstract):if (usage_dict := response_dict.get("usage")) and (img_gen_tokens_usage := img_gen_job.job_report.img_gen_tokens_usage):log.debug(usage_dict, title="Azure img gen usage")nb_tokens: NbTokensByCategoryDict = {}- if input_tokens := usage_dict.get("prompt_tokens") or usage_dict.get("input_tokens"):+ input_tokens = usage_dict.get("prompt_tokens")+ if input_tokens is None:+ input_tokens = usage_dict.get("input_tokens")+ if input_tokens is not None:nb_tokens[TokenCategory.INPUT] = input_tokens- if output_tokens := usage_dict.get("completion_tokens") or usage_dict.get("output_tokens"):+ output_tokens = usage_dict.get("completion_tokens")+ if output_tokens is None:+ output_tokens = usage_dict.get("output_tokens")+ if output_tokens is not None:nb_tokens[TokenCategory.OUTPUT] = output_tokensimg_gen_tokens_usage.nb_tokens_by_category = nb_tokensdiff --git a/pipelex/plugins/gateway/gateway_img_gen_worker.py b/pipelex/plugins/gateway/gateway_img_gen_worker.pyindex 8921bf3de..db690e957 100644--- a/pipelex/plugins/gateway/gateway_img_gen_worker.py+++ b/pipelex/plugins/gateway/gateway_img_gen_worker.py@@ -21,7 +21,6 @@ from pipelex.plugins.fal.fal_poller import FalPollerfrom pipelex.plugins.gateway.gateway_deck import GatewayDeckfrom pipelex.plugins.gateway.gateway_factory import GatewayFactoryfrom pipelex.plugins.gateway.gateway_schemas import GatewayImgGenAzureFlux2Pro, GatewayImgGenAzureGptImage-from pipelex.tools.log.log import logfrom pipelex.tools.misc.filetype_utils import detect_file_type_from_bytesfrom pipelex.tools.misc.image_utils import ImageFormatfrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error@@ -74,7 +73,6 @@ class GatewayImgGenWorker(ImgGenWorkerAbstract):endpoint_path = (self.inference_model.extra_headers or {}).get("endpoint_path") or f"/{self.inference_model.model_id}"config_id = GatewayDeck.get_config_id(headers=self.inference_model.extra_headers or {})- log.debug(args_dict, title="Gateway img gen args")try:# TODO: add portkey tracing headers when enabledresponse = await self.portkey_client.with_options(config=config_id).post( # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]