mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
core: Updated docstring for RunnablePick (#18832)
**Description:** : Updated the docstring for RunnablePick. Added Overview and an Example for RunnablePick class. **Issue:** : #18803
This commit is contained in:
parent
e46419c851
commit
3c4529ac69
@ -610,8 +610,30 @@ class RunnableAssign(RunnableSerializable[Dict[str, Any], Dict[str, Any]]):
|
||||
|
||||
|
||||
class RunnablePick(RunnableSerializable[Dict[str, Any], Dict[str, Any]]):
|
||||
"""
|
||||
Runnable that picks keys from Dict[str, Any] inputs.
|
||||
"""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. It returns a new dictionary containing only
|
||||
the selected keys.
|
||||
|
||||
Example :
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_core.runnables.passthrough import RunnablePick
|
||||
|
||||
input_data = {
|
||||
'name': 'John',
|
||||
'age': 30,
|
||||
'city': 'New York',
|
||||
'country': 'USA'
|
||||
}
|
||||
|
||||
runnable = RunnablePick(keys=['name', 'age'])
|
||||
|
||||
output_data = runnable.invoke(input_data)
|
||||
|
||||
print(output_data) # Output: {'name': 'John', 'age': 30}
|
||||
"""
|
||||
|
||||
keys: Union[str, List[str]]
|
||||
|
Loading…
Reference in New Issue
Block a user