From 891c6a04a6ba1cb6c9a9cd624c32b331bf4a5e66 Mon Sep 17 00:00:00 2001 From: Niel Teng Hu Date: Sun, 14 Jan 2024 15:37:42 -0500 Subject: [PATCH] Update action_from_model #126 --- actionweaver/actions/factories/pydantic_model_to_action.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actionweaver/actions/factories/pydantic_model_to_action.py b/actionweaver/actions/factories/pydantic_model_to_action.py index 304066d..0b2c30b 100644 --- a/actionweaver/actions/factories/pydantic_model_to_action.py +++ b/actionweaver/actions/factories/pydantic_model_to_action.py @@ -29,6 +29,7 @@ def func(*args, **kwargs): if kwargs: (key,) = kwargs.keys() + # the only keyword argument should be the model name if key != model.__name__.lower(): raise ValueError( f"Invalid input: The method should accept a single keyword argument: {model.__name__.lower()}", @@ -53,7 +54,7 @@ def func(*args, **kwargs): description = f"Extract {model.__name__}" func.__doc__ = description - func.__name__ = f"create_{model.__name__.lower()}_{truncated_uuid4()}" + func.__name__ = f"create_{model.__name__.lower()}_from_pydantic_model" return action(name=name, stop=stop, decorators=decorators)( func