pipe() — langchain Function Reference
Architecture documentation for the pipe() function in structured.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD aa20e50e_3f08_075e_f059_e71b8aad4032["pipe()"] 14de95af_eb88_e7a8_1ab1_98d03dd541e0["StructuredPrompt"] aa20e50e_3f08_075e_f059_e71b8aad4032 -->|defined in| 14de95af_eb88_e7a8_1ab1_98d03dd541e0 c93652b8_42d7_bf97_e416_56bd747ea444["__or__()"] c93652b8_42d7_bf97_e416_56bd747ea444 -->|calls| aa20e50e_3f08_075e_f059_e71b8aad4032 style aa20e50e_3f08_075e_f059_e71b8aad4032 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/structured.py lines 149–183
def pipe(
self,
*others: Runnable[Any, Other]
| Callable[[Iterator[Any]], Iterator[Other]]
| Callable[[AsyncIterator[Any]], AsyncIterator[Other]]
| Callable[[Any], Other]
| Mapping[str, Runnable[Any, Other] | Callable[[Any], Other] | Any],
name: str | None = None,
) -> RunnableSerializable[dict, Other]:
"""Pipe the structured prompt to a language model.
Args:
others: The language model to pipe the structured prompt to.
name: The name of the pipeline.
Returns:
A `RunnableSequence` object.
Raises:
NotImplementedError: If the first element of `others` is not a language
model.
"""
if (others and isinstance(others[0], BaseLanguageModel)) or hasattr(
others[0], "with_structured_output"
):
return RunnableSequence(
self,
others[0].with_structured_output(
self.schema_, **self.structured_output_kwargs
),
*others[1:],
name=name,
)
msg = "Structured prompts need to be piped to a language model."
raise NotImplementedError(msg)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does pipe() do?
pipe() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/structured.py.
Where is pipe() defined?
pipe() is defined in libs/core/langchain_core/prompts/structured.py at line 149.
What calls pipe()?
pipe() is called by 1 function(s): __or__.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free