Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctionalFlowStep #31

Open
OlaRonning opened this issue Jul 18, 2023 · 2 comments
Open

FunctionalFlowStep #31

OlaRonning opened this issue Jul 18, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@OlaRonning
Copy link
Collaborator

Why not use **kwargs here?

self, inputs: dict[str, Any]

Then you can name keyword args to the function (i.e., generate), and the remaining will be the arguments for flowstep_fn, so this will go away

filtered_inputs = {
key: value for key, value in inputs.items() if key in fn_args
}

Rename flowstep_fn to inner_fn or step_fn; it's part of a flowstep class, so the context is already clear.

self.required_keys = inspect.getfullargspec(self.flowstep_fn).args

^ is not used.

@stoyan-stoyanov
Copy link
Owner

Good point. Actually, the generate() method is supposed to be used only by the flow class so it might be also _generate() And looking at it the return type is too general.

Also, the flow class should be already taking care of passing the right inputs so I don't know why I added the filtered_inputs check.

required_keys is used in the flow class:

required_inputs = {key: inputs[key] for key in step.required_keys}

@stoyan-stoyanov stoyan-stoyanov self-assigned this Jul 18, 2023
@OlaRonning
Copy link
Collaborator Author

If the two are that tightly interlinked, then you should have a runtime check that you have a flowstep instance.

@stoyan-stoyanov stoyan-stoyanov added the good first issue Good for newcomers label Jul 28, 2023
@stoyan-stoyanov stoyan-stoyanov removed their assignment Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants