llm.py — langchain Source File
Architecture documentation for llm.py, a python file in the langchain codebase. 17 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0cb3a171_64ff_944b_88ef_4b11fdfc752a["llm.py"] f3365e3c_fb7a_bb9a_bc79_059b06cb7024["warnings"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> f3365e3c_fb7a_bb9a_bc79_059b06cb7024 2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 2bf6d401_816d_d011_3b05_a6114f55ff58 feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> feec1ec4_6917_867b_d228_b134d0ff8099 2485b66a_3839_d0b6_ad9c_a4ff40457dc6["langchain_core._api"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 2485b66a_3839_d0b6_ad9c_a4ff40457dc6 17a62cb3_fefd_6320_b757_b53bb4a1c661["langchain_core.callbacks"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 17a62cb3_fefd_6320_b757_b53bb4a1c661 e929cf21_6ab8_6ff3_3765_0d35a099a053["langchain_core.language_models"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> e929cf21_6ab8_6ff3_3765_0d35a099a053 9444498b_8066_55c7_b3a2_1d90c4162a32["langchain_core.messages"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 9444498b_8066_55c7_b3a2_1d90c4162a32 628cbc5d_711f_ac0c_2f53_db992d48d7da["langchain_core.output_parsers"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 628cbc5d_711f_ac0c_2f53_db992d48d7da 4382dc25_6fba_324a_49e2_e9742d579385["langchain_core.outputs"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 4382dc25_6fba_324a_49e2_e9742d579385 b9f9a99f_aaea_6efd_1322_fc2c11bdc4b4["langchain_core.prompt_values"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> b9f9a99f_aaea_6efd_1322_fc2c11bdc4b4 435e49bf_bb2e_2016_ead7_0afb9d57ad71["langchain_core.prompts"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 435e49bf_bb2e_2016_ead7_0afb9d57ad71 31eab4ab_7281_1e6c_b17d_12e6ad9de07a["langchain_core.runnables"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 31eab4ab_7281_1e6c_b17d_12e6ad9de07a 98287a56_7cd6_c103_aa17_5ec9576ef7cf["langchain_core.runnables.configurable"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 98287a56_7cd6_c103_aa17_5ec9576ef7cf 642ed52d_bfb8_4975_afd4_eabf3187405c["langchain_core.utils.input"] 0cb3a171_64ff_944b_88ef_4b11fdfc752a --> 642ed52d_bfb8_4975_afd4_eabf3187405c style 0cb3a171_64ff_944b_88ef_4b11fdfc752a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Chain that just formats a prompt and calls an LLM."""
from __future__ import annotations
import warnings
from collections.abc import Sequence
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.callbacks import (
AsyncCallbackManager,
AsyncCallbackManagerForChainRun,
CallbackManager,
CallbackManagerForChainRun,
Callbacks,
)
from langchain_core.language_models import (
BaseLanguageModel,
LanguageModelInput,
)
from langchain_core.messages import BaseMessage
from langchain_core.output_parsers import BaseLLMOutputParser, StrOutputParser
from langchain_core.outputs import ChatGeneration, Generation, LLMResult
from langchain_core.prompt_values import PromptValue
from langchain_core.prompts import BasePromptTemplate, PromptTemplate
from langchain_core.runnables import (
Runnable,
RunnableBinding,
RunnableBranch,
RunnableWithFallbacks,
)
from langchain_core.runnables.configurable import DynamicRunnable
from langchain_core.utils.input import get_colored_text
from pydantic import ConfigDict, Field
from typing_extensions import override
from langchain_classic.chains.base import Chain
@deprecated(
since="0.1.17",
alternative="RunnableSequence, e.g., `prompt | llm`",
removal="1.0",
)
class LLMChain(Chain):
"""Chain to run queries against LLMs.
This class is deprecated. See below for an example implementation using
LangChain runnables:
```python
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import PromptTemplate
from langchain_openai import OpenAI
prompt_template = "Tell me a {adjective} joke"
prompt = PromptTemplate(input_variables=["adjective"], template=prompt_template)
model = OpenAI()
chain = prompt | model | StrOutputParser()
// ... (373 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- collections.abc
- langchain_classic.chains.base
- langchain_core._api
- langchain_core.callbacks
- langchain_core.language_models
- langchain_core.messages
- langchain_core.output_parsers
- langchain_core.outputs
- langchain_core.prompt_values
- langchain_core.prompts
- langchain_core.runnables
- langchain_core.runnables.configurable
- langchain_core.utils.input
- pydantic
- typing
- typing_extensions
- warnings
Source
Frequently Asked Questions
What does llm.py do?
llm.py is a source file in the langchain codebase, written in python. It belongs to the AgentOrchestration domain, ClassicChains subdomain.
What functions are defined in llm.py?
llm.py defines 1 function(s): _get_language_model.
What does llm.py depend on?
llm.py imports 17 module(s): collections.abc, langchain_classic.chains.base, langchain_core._api, langchain_core.callbacks, langchain_core.language_models, langchain_core.messages, langchain_core.output_parsers, langchain_core.outputs, and 9 more.
Where is llm.py in the architecture?
llm.py is located at libs/langchain/langchain_classic/chains/llm.py (domain: AgentOrchestration, subdomain: ClassicChains, directory: libs/langchain/langchain_classic/chains).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free