You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It does not respect arg2's default value in the spec, which should be none. and it will set a dict or zero for this situation.(Where arg2 is a basemodel, so a dict with all field set, and param to be 0)
Problem2
The second problem is langserve is different with runnable's direct invoke(and other endopint too) with optional config. When I run
runnable.invoke(input, {"configurable": {}})
The config set for runnable will not contain these optional fields.
but when I tried to invoke via langserve's api handler, I noticed it will be serialized with all optional fields with None value.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've tried to use custom config spec to config custom runnables for a while.
In the most of the time, all works like a charm. I implement a runnable have custom config_spec like this:
Even more, I can annotate a BaseModel.
For most of the part everything works well, but I've found two problem.
Problem 1
The first is in the swagger docs, the default value is like this
It does not respect arg2's default value in the spec, which should be none. and it will set a dict or zero for this situation.(Where arg2 is a basemodel, so a dict with all field set, and param to be 0)
Problem2
The second problem is langserve is different with runnable's direct
invoke
(and other endopint too) with optional config. When I runThe config set for runnable will not contain these optional fields.
but when I tried to invoke via langserve's api handler, I noticed it will be serialized with all optional fields with None value.
I will got config like this
For the second problem
My quick solve for this is to add
exclude_unset=True
here.langserve/langserve/api_handler.py
Line 142 in 594527e
Question
I'm not sure if the way to use runnable config the right way.
Any advice on custom runnable config, and related problem?
Beta Was this translation helpful? Give feedback.
All reactions