Skip to content

Commit

Permalink
Merge pull request #32 from hmasdev/remove-unrequired-kwargs-in-creat…
Browse files Browse the repository at this point in the history
…e_input_runnable

Refactor create_input_runnable in io.py
  • Loading branch information
hmasdev authored Oct 27, 2024
2 parents 0535429 + 9db6fd6 commit 5519e80
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions langchain_werewolf/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@
def create_input_runnable(
input_func: Callable[[str], Any] | EInputOutputType = click.prompt,
styler: Callable[[str], str] | None = None,
**kwargs,
) -> Runnable[str, str]:
if isinstance(input_func, EInputOutputType):
try:
input_func = _input_map[input_func]
except KeyError:
raise ValueError(f'Invalid input_func: {input_func}')
kwargs = {k: v for k, v in kwargs.items() if k != 'styler'}
return (
(RunnableLambda(styler) if styler else RunnablePassthrough())
| RunnableLambda(partial(input_func, **kwargs))
| RunnableLambda(input_func)
| RunnableLambda(str)
).with_types(
input_type=str,
Expand Down

0 comments on commit 5519e80

Please sign in to comment.