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.
Tweak to make_optional_batch_params to raise error if it's inconsistent
Louis Choquelb96a4a84b5a8
diff --git a/pipelex/core/pipes/pipe_run_params.py b/pipelex/core/pipes/pipe_run_params.pyindex 037c2b501..34c0ac93e 100644--- a/pipelex/core/pipes/pipe_run_params.py+++ b/pipelex/core/pipes/pipe_run_params.py@@ -6,6 +6,7 @@ from pydantic import BaseModel, Field, field_validatorfrom pipelex import logfrom pipelex.core.memory.working_memory import BATCH_ITEM_STUFF_NAME, MAIN_STUFF_NAME+from pipelex.exceptions import BatchParamsErrorfrom pipelex.types import Self, StrEnum@@ -178,16 +179,19 @@ class BatchParams(BaseModel):def make_optional_batch_params(cls,input_list_name: str | None,- input_item_name: str | None = None,+ input_item_name: str | None,) -> BatchParams | None:- the_batch_params: BatchParams | None = Noneif input_list_name:input_item_stuff_name = input_item_name or BATCH_ITEM_STUFF_NAME- the_batch_params = BatchParams(+ return BatchParams(input_list_stuff_name=input_list_name,input_item_stuff_name=input_item_stuff_name,)- return the_batch_params+ elif input_item_name:+ msg = "input_item_name is required when input_list_name is not provided"+ raise BatchParamsError(msg)+ else:+ return None@classmethoddef make_default(cls) -> BatchParams:diff --git a/pipelex/exceptions.py b/pipelex/exceptions.pyindex f16a8b59d..c8dfbdb45 100644--- a/pipelex/exceptions.py+++ b/pipelex/exceptions.py@@ -221,6 +221,10 @@ class DryRunError(PipeExecutionError):super().__init__(message)+class BatchParamsError(PipelexError):+ pass++class PipeConditionError(PipelexError):pass