core: typo in runnable (#28815)

Thank you for contributing to LangChain!

**Description:** Typo
This commit is contained in:
Wang Ran (汪然) 2024-12-19 22:25:57 +08:00 committed by GitHub
parent c823cc532d
commit 51b8ddaf10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -190,7 +190,7 @@ class Runnable(Generic[Input, Output], ABC):
def buggy_double(y: int) -> int: def buggy_double(y: int) -> int:
'''Buggy code that will fail 70% of the time''' \"\"\"Buggy code that will fail 70% of the time\"\"\"
if random.random() > 0.3: if random.random() > 0.3:
print('This code failed, and will probably be retried!') # noqa: T201 print('This code failed, and will probably be retried!') # noqa: T201
raise ValueError('Triggered buggy code') raise ValueError('Triggered buggy code')
@ -520,13 +520,13 @@ class Runnable(Generic[Input, Output], ABC):
def get_config_jsonschema( def get_config_jsonschema(
self, *, include: Optional[Sequence[str]] = None self, *, include: Optional[Sequence[str]] = None
) -> dict[str, Any]: ) -> dict[str, Any]:
"""Get a JSON schema that represents the output of the Runnable. """Get a JSON schema that represents the config of the Runnable.
Args: Args:
include: A list of fields to include in the config schema. include: A list of fields to include in the config schema.
Returns: Returns:
A JSON schema that represents the output of the Runnable. A JSON schema that represents the config of the Runnable.
.. versionadded:: 0.3.0 .. versionadded:: 0.3.0
""" """
@ -625,7 +625,7 @@ class Runnable(Generic[Input, Output], ABC):
return RunnableSequence(self, *others, name=name) return RunnableSequence(self, *others, name=name)
def pick(self, keys: Union[str, list[str]]) -> RunnableSerializable[Any, Any]: def pick(self, keys: Union[str, list[str]]) -> RunnableSerializable[Any, Any]:
"""Pick keys from the dict output of this Runnable. """Pick keys from the output dict of this Runnable.
Pick single key: Pick single key:
.. code-block:: python .. code-block:: python
@ -712,8 +712,8 @@ class Runnable(Generic[Input, Output], ABC):
print(chain_with_assign.input_schema.model_json_schema()) print(chain_with_assign.input_schema.model_json_schema())
# {'title': 'PromptInput', 'type': 'object', 'properties': # {'title': 'PromptInput', 'type': 'object', 'properties':
{'question': {'title': 'Question', 'type': 'string'}}} {'question': {'title': 'Question', 'type': 'string'}}}
print(chain_with_assign.output_schema.model_json_schema()) # print(chain_with_assign.output_schema.model_json_schema())
{'title': 'RunnableSequenceOutput', 'type': 'object', 'properties': # {'title': 'RunnableSequenceOutput', 'type': 'object', 'properties':
{'str': {'title': 'Str', {'str': {'title': 'Str',
'type': 'string'}, 'hello': {'title': 'Hello', 'type': 'string'}}} 'type': 'string'}, 'hello': {'title': 'Hello', 'type': 'string'}}}