Configure particular Runnable fields at runtime.
The name of the Runnable. Used for debugging and tracing.
Input type.
Output Type.
The type of input this Runnable accepts specified as a Pydantic model.
Output schema.
List configurable fields for this Runnable.
Get a Pydantic model that can be used to validate input to the Runnable.
Get a JSON schema that represents the input to the Runnable.
Get a Pydantic model that can be used to validate output to the Runnable.
Get a JSON schema that represents the output of the Runnable.
Runnable that picks keys from dict[str, Any] inputs.
RunnablePick class represents a Runnable that selectively picks keys from a
dictionary input. It allows you to specify one or more keys to extract
from the input dictionary.
The return type depends on the keys parameter:
keys is a str: Returns the single value associated with that keykeys is a list: Returns a dictionary containing only the selected
keysExample:
from langchain_core.runnables.passthrough import RunnablePick
input_data = {
"name": "John",
"age": 30,
"city": "New York",
"country": "USA",
}
# Single key - returns the value directly
runnable_single = RunnablePick(keys="name")
result_single = runnable_single.invoke(input_data)
print(result_single) # Output: "John"
# Multiple keys - returns a dictionary
runnable_multiple = RunnablePick(keys=["name", "age"])
result_multiple = runnable_multiple.invoke(input_data)
print(result_multiple) # Output: {'name': 'John', 'age': 30}The type of config this Runnable accepts specified as a Pydantic model.