mirror of
https://github.com/hwchase17/langchain.git
synced 2026-03-18 11:07:36 +00:00
docs(core): enhance docstring for RunnableConfig for clarity on total=False (#34756)
This commit is contained in:
@@ -51,8 +51,24 @@ class EmptyDict(TypedDict, total=False):
|
||||
class RunnableConfig(TypedDict, total=False):
|
||||
"""Configuration for a `Runnable`.
|
||||
|
||||
See the [reference docs](https://reference.langchain.com/python/langchain_core/runnables/#langchain_core.runnables.RunnableConfig)
|
||||
for more details.
|
||||
!!! note Custom values
|
||||
|
||||
The `TypedDict` has `total=False` set intentionally to:
|
||||
|
||||
- Allow partial configs to be created and merged together via `merge_configs`
|
||||
- Support config propagation from parent to child runnables via
|
||||
`var_child_runnable_config` (a `ContextVar` that automatically passes
|
||||
config down the call stack without explicit parameter passing), where
|
||||
configs are merged rather than replaced
|
||||
|
||||
!!! example
|
||||
|
||||
```python
|
||||
# Parent sets tags
|
||||
chain.invoke(input, config={"tags": ["parent"]})
|
||||
# Child automatically inherits and can add:
|
||||
# ensure_config({"tags": ["child"]}) -> {"tags": ["parent", "child"]}
|
||||
```
|
||||
"""
|
||||
|
||||
tags: list[str]
|
||||
@@ -92,7 +108,8 @@ class RunnableConfig(TypedDict, total=False):
|
||||
|
||||
configurable: dict[str, Any]
|
||||
"""Runtime values for attributes previously made configurable on this `Runnable`,
|
||||
or sub-Runnables, through `configurable_fields` or `configurable_alternatives`.
|
||||
or sub-`Runnable` objects, through `configurable_fields` or
|
||||
`configurable_alternatives`.
|
||||
|
||||
Check `output_schema` for a description of the attributes that have been made
|
||||
configurable.
|
||||
|
||||
Reference in New Issue
Block a user