base.py — langchain Source File
Architecture documentation for base.py, a python file in the langchain codebase. 12 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 88d855b2_bf93_3a66_5e7c_636159530471["base.py"] 7025b240_fdc3_cf68_b72f_f41dac94566b["json"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 7025b240_fdc3_cf68_b72f_f41dac94566b cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 88d855b2_bf93_3a66_5e7c_636159530471 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 b19a8b7e_fbee_95b1_65b8_509a1ed3cad7["langchain_core._api"] 88d855b2_bf93_3a66_5e7c_636159530471 --> b19a8b7e_fbee_95b1_65b8_509a1ed3cad7 83d7c7fd_1989_762c_9cf3_cecb50ada22b["langchain_core.output_parsers"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 83d7c7fd_1989_762c_9cf3_cecb50ada22b 89a4ade4_215f_cae5_8190_9505303396df["langchain_core.output_parsers.openai_functions"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 89a4ade4_215f_cae5_8190_9505303396df e621cf3d_5d65_d51d_0d81_469c2c9e4846["langchain_core.output_parsers.openai_tools"] 88d855b2_bf93_3a66_5e7c_636159530471 --> e621cf3d_5d65_d51d_0d81_469c2c9e4846 e6b4f61e_7b98_6666_3641_26b069517d4a["langchain_core.prompts"] 88d855b2_bf93_3a66_5e7c_636159530471 --> e6b4f61e_7b98_6666_3641_26b069517d4a 2ceb1686_0f8c_8ae0_36d1_7c0b702fda1c["langchain_core.runnables"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 2ceb1686_0f8c_8ae0_36d1_7c0b702fda1c a6f93333_6d02_5473_677b_843422594588["langchain_core.utils.function_calling"] 88d855b2_bf93_3a66_5e7c_636159530471 --> a6f93333_6d02_5473_677b_843422594588 1014fe78_cb2c_fde4_a624_ae899aa7ca8e["langchain_core.utils.pydantic"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 1014fe78_cb2c_fde4_a624_ae899aa7ca8e 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"] 88d855b2_bf93_3a66_5e7c_636159530471 --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7 style 88d855b2_bf93_3a66_5e7c_636159530471 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import json
from collections.abc import Callable, Sequence
from typing import Any, Literal
from langchain_core._api import deprecated
from langchain_core.output_parsers import (
BaseGenerationOutputParser,
BaseOutputParser,
JsonOutputParser,
PydanticOutputParser,
)
from langchain_core.output_parsers.openai_functions import (
JsonOutputFunctionsParser,
PydanticAttrOutputFunctionsParser,
PydanticOutputFunctionsParser,
)
from langchain_core.output_parsers.openai_tools import (
JsonOutputKeyToolsParser,
PydanticToolsParser,
)
from langchain_core.prompts import BasePromptTemplate
from langchain_core.runnables import Runnable
from langchain_core.utils.function_calling import (
convert_to_openai_function,
convert_to_openai_tool,
)
from langchain_core.utils.pydantic import is_basemodel_subclass
from pydantic import BaseModel
@deprecated(
since="0.1.14",
message=(
"LangChain has introduced a method called `with_structured_output` that "
"is available on ChatModels capable of tool calling. "
"You can read more about the method here: "
"<https://docs.langchain.com/oss/python/langchain/models#structured-outputs>. "
"Please follow our extraction use case documentation for more guidelines "
"on how to do information extraction with LLMs. "
"<https://python.langchain.com/docs/use_cases/extraction/>. "
"If you notice other issues, please provide "
"feedback here: "
"<https://github.com/langchain-ai/langchain/discussions/18154>"
),
removal="1.0",
alternative=(
"""
from pydantic import BaseModel, Field
from langchain_anthropic import ChatAnthropic
class Joke(BaseModel):
setup: str = Field(description="The setup of the joke")
punchline: str = Field(description="The punchline to the joke")
# Or any other chat model that supports tools.
# Please reference to the documentation of structured_output
# to see an up to date list of which models support
# with_structured_output.
model = ChatAnthropic(model="claude-opus-4-1-20250805", temperature=0)
structured_model = model.with_structured_output(Joke)
// ... (528 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- collections.abc
- json
- langchain_core._api
- langchain_core.output_parsers
- langchain_core.output_parsers.openai_functions
- langchain_core.output_parsers.openai_tools
- langchain_core.prompts
- langchain_core.runnables
- langchain_core.utils.function_calling
- langchain_core.utils.pydantic
- pydantic
- typing
Source
Frequently Asked Questions
What does base.py do?
base.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in base.py?
base.py defines 7 function(s): _create_openai_functions_structured_output_runnable, _create_openai_json_runnable, _create_openai_tools_runnable, _get_openai_tool_output_parser, create_openai_fn_runnable, create_structured_output_runnable, get_openai_output_parser.
What does base.py depend on?
base.py imports 12 module(s): collections.abc, json, langchain_core._api, langchain_core.output_parsers, langchain_core.output_parsers.openai_functions, langchain_core.output_parsers.openai_tools, langchain_core.prompts, langchain_core.runnables, and 4 more.
Where is base.py in the architecture?
base.py is located at libs/langchain/langchain_classic/chains/structured_output/base.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/langchain_classic/chains/structured_output).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free