Skip to content

Commit

Permalink
Update action_from_model #126
Browse files Browse the repository at this point in the history
  • Loading branch information
TengHu authored Jan 14, 2024
1 parent 80f7c7b commit 891c6a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion actionweaver/actions/factories/pydantic_model_to_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}",
Expand All @@ -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
Expand Down

0 comments on commit 891c6a0

Please sign in to comment.