repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversational_retrieval/prompts.py | libs/langchain/langchain_classic/chains/conversational_retrieval/prompts.py | from langchain_core.prompts.prompt import PromptTemplate
_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its original language.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:""" # noqa: E501
CONDE... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversational_retrieval/__init__.py | libs/langchain/langchain_classic/chains/conversational_retrieval/__init__.py | """Chain for chatting with a vector database."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversational_retrieval/base.py | libs/langchain/langchain_classic/chains/conversational_retrieval/base.py | """Chain for chatting with a vector database."""
from __future__ import annotations
import inspect
import warnings
from abc import abstractmethod
from collections.abc import Callable
from pathlib import Path
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import (
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversation/memory.py | libs/langchain/langchain_classic/chains/conversation/memory.py | """Memory modules for conversation prompts."""
from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
from langchain_classic.memory.buffer import (
ConversationBufferMemory,
ConversationStringBufferMemory,
)
from langchain_classic.memory.buffer_window import ConversationBuffe... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversation/prompt.py | libs/langchain/langchain_classic/chains/conversation/prompt.py | from langchain_core.prompts.prompt import PromptTemplate
from langchain_classic.memory.prompt import (
ENTITY_EXTRACTION_PROMPT,
ENTITY_MEMORY_CONVERSATION_TEMPLATE,
ENTITY_SUMMARIZATION_PROMPT,
KNOWLEDGE_TRIPLE_EXTRACTION_PROMPT,
SUMMARY_PROMPT,
)
DEFAULT_TEMPLATE = """The following is a friendly... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversation/__init__.py | libs/langchain/langchain_classic/chains/conversation/__init__.py | """Chain that carries on a conversation from a prompt plus history."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/conversation/base.py | libs/langchain/langchain_classic/chains/conversation/base.py | """Chain that carries on a conversation and calls an LLM."""
from langchain_core._api import deprecated
from langchain_core.prompts import BasePromptTemplate
from pydantic import ConfigDict, Field, model_validator
from typing_extensions import Self, override
from langchain_classic.base_memory import BaseMemory
from l... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/query_constructor/parser.py | libs/langchain/langchain_classic/chains/query_constructor/parser.py | import datetime
import warnings
from collections.abc import Sequence
from typing import Any, Literal
from langchain_core.utils import check_package_version
from typing_extensions import TypedDict
try:
check_package_version("lark", gte_version="1.1.5")
from lark import Lark, Transformer, v_args
_HAS_LARK ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/query_constructor/schema.py | libs/langchain/langchain_classic/chains/query_constructor/schema.py | from pydantic import BaseModel, ConfigDict
class AttributeInfo(BaseModel):
"""Information about a data source attribute."""
name: str
description: str
type: str
model_config = ConfigDict(
arbitrary_types_allowed=True,
frozen=True,
)
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/query_constructor/ir.py | libs/langchain/langchain_classic/chains/query_constructor/ir.py | """Internal representation of a structured query language."""
from langchain_core.structured_query import (
Comparator,
Comparison,
Expr,
FilterDirective,
Operation,
Operator,
StructuredQuery,
Visitor,
)
__all__ = [
"Comparator",
"Comparison",
"Expr",
"FilterDirective",... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/query_constructor/prompt.py | libs/langchain/langchain_classic/chains/query_constructor/prompt.py | from langchain_core.prompts import PromptTemplate
SONG_DATA_SOURCE = """\
```json
{{
"content": "Lyrics of a song",
"attributes": {{
"artist": {{
"type": "string",
"description": "Name of the song artist"
}},
"length": {{
"type": "integer",
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/query_constructor/__init__.py | libs/langchain/langchain_classic/chains/query_constructor/__init__.py | from langchain_classic.chains.query_constructor.base import (
load_query_constructor_runnable,
)
__all__ = ["load_query_constructor_runnable"]
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/query_constructor/base.py | libs/langchain/langchain_classic/chains/query_constructor/base.py | """LLM Chain for turning a user text query into a structured query."""
from __future__ import annotations
import json
from collections.abc import Callable, Sequence
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.exceptions import OutputParserException
from langchain_core.... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/llm_router.py | libs/langchain/langchain_classic/chains/router/llm_router.py | """Base classes for LLM-powered router chains."""
from __future__ import annotations
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.exceptions import OutputParser... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/multi_prompt_prompt.py | libs/langchain/langchain_classic/chains/router/multi_prompt_prompt.py | """Prompt for the router chain in the multi-prompt chain."""
MULTI_PROMPT_ROUTER_TEMPLATE = """\
Given a raw text input to a language model select the model prompt best suited for \
the input. You will be given the names of the available prompts and a description of \
what the prompt is best suited for. You may also r... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/multi_retrieval_prompt.py | libs/langchain/langchain_classic/chains/router/multi_retrieval_prompt.py | """Prompt for the router chain in the multi-retrieval qa chain."""
MULTI_RETRIEVAL_ROUTER_TEMPLATE = """\
Given a query to a question answering system select the system best suited \
for the input. You will be given the names of the available systems and a description \
of what questions the system is best suited for.... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/embedding_router.py | libs/langchain/langchain_classic/chains/router/embedding_router.py | from __future__ import annotations
from collections.abc import Sequence
from typing import Any
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_cor... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/multi_retrieval_qa.py | libs/langchain/langchain_classic/chains/router/multi_retrieval_qa.py | """Use a single chain to route an input to one of multiple retrieval qa chains."""
from __future__ import annotations
from collections.abc import Mapping
from typing import Any
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import PromptTemplate
from langchain_core.retriever... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/multi_prompt.py | libs/langchain/langchain_classic/chains/router/multi_prompt.py | """Use a single chain to route an input to one of multiple llm chains."""
from __future__ import annotations
from typing import Any
from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import PromptTemplate
from typing_extensions import o... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/__init__.py | libs/langchain/langchain_classic/chains/router/__init__.py | from langchain_classic.chains.router.base import MultiRouteChain, RouterChain
from langchain_classic.chains.router.llm_router import LLMRouterChain
from langchain_classic.chains.router.multi_prompt import MultiPromptChain
from langchain_classic.chains.router.multi_retrieval_qa import MultiRetrievalQAChain
__all__ = [
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/router/base.py | libs/langchain/langchain_classic/chains/router/base.py | """Base classes for chain routing."""
from __future__ import annotations
from abc import ABC
from collections.abc import Mapping
from typing import Any, NamedTuple
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
Callbacks,
)
from pydantic import ConfigD... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/reduce.py | libs/langchain/langchain_classic/chains/combine_documents/reduce.py | """Combine many documents together by recursively reducing them."""
from __future__ import annotations
from collections.abc import Callable
from typing import Any, Protocol
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from pyd... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/map_reduce.py | libs/langchain/langchain_classic/chains/combine_documents/map_reduce.py | """Combining documents by mapping a chain over them first, then combining results."""
from __future__ import annotations
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.runnables.config ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/refine.py | libs/langchain/langchain_classic/chains/combine_documents/refine.py | """Combine documents by doing a first pass and then refining on more documents."""
from __future__ import annotations
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.prompts import BaseP... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/stuff.py | libs/langchain/langchain_classic/chains/combine_documents/stuff.py | """Chain that combines documents by stuffing into context."""
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.language_models import LanguageModelLike
from langchain_core.output_parsers i... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py | libs/langchain/langchain_classic/chains/combine_documents/map_rerank.py | """Combining documents by mapping a chain over them first, then reranking results."""
from __future__ import annotations
from collections.abc import Sequence
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Doc... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/__init__.py | libs/langchain/langchain_classic/chains/combine_documents/__init__.py | """Different ways to combine documents."""
from langchain_classic.chains.combine_documents.reduce import (
acollapse_docs,
collapse_docs,
split_list_of_docs,
)
from langchain_classic.chains.combine_documents.stuff import (
create_stuff_documents_chain,
)
__all__ = [
"acollapse_docs",
"collapse... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/combine_documents/base.py | libs/langchain/langchain_classic/chains/combine_documents/base.py | """Base interface for chains combining documents."""
from abc import ABC, abstractmethod
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.documents import Document
from la... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/ernie_functions/__init__.py | libs/langchain/langchain_classic/chains/ernie_functions/__init__.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.ernie_functions.base import (
convert_to_ernie_function,
create_ernie_fn_chain,
create_ernie_fn_runnable,
create_structured_output_chain,
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/ernie_functions/base.py | libs/langchain/langchain_classic/chains/ernie_functions/base.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.ernie_functions.base import (
convert_python_function_to_ernie_function,
convert_to_ernie_function,
create_ernie_fn_chain,
create_ernie_fn_runn... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/sql_database/query.py | libs/langchain/langchain_classic/chains/sql_database/query.py | from __future__ import annotations
from typing import TYPE_CHECKING, Any, TypedDict
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import BasePromptTemplate
from langchain_core.runnables import Runnable, RunnablePassth... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/sql_database/prompt.py | libs/langchain/langchain_classic/chains/sql_database/prompt.py | from langchain_core.output_parsers.list import CommaSeparatedListOutputParser
from langchain_core.prompts.prompt import PromptTemplate
PROMPT_SUFFIX = """Only use the following tables:
{table_info}
Question: {input}"""
_DEFAULT_TEMPLATE = """Given an input question, first create a syntactically correct {dialect} que... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/sql_database/__init__.py | libs/langchain/langchain_classic/chains/sql_database/__init__.py | """Chain for interacting with SQL Database."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/cypher_utils.py | libs/langchain/langchain_classic/chains/graph_qa/cypher_utils.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.cypher_utils import (
CypherQueryCorrector,
Schema,
)
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for r... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/prompts.py | libs/langchain/langchain_classic/chains/graph_qa/prompts.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.prompts import (
AQL_FIX_TEMPLATE,
AQL_GENERATION_TEMPLATE,
AQL_QA_TEMPLATE,
CYPHER_GENERATION_PROMPT,
CYPHER_GENERATION_TEMPL... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/nebulagraph.py | libs/langchain/langchain_classic/chains/graph_qa/nebulagraph.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.nebulagraph import NebulaGraphQAChain
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# ha... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/neptune_sparql.py | libs/langchain/langchain_classic/chains/graph_qa/neptune_sparql.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.neptune_sparql import (
INTERMEDIATE_STEPS_KEY,
SPARQL_GENERATION_TEMPLATE,
NeptuneSparqlQAChain,
extract_sparql,
)
# Create a wa... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/falkordb.py | libs/langchain/langchain_classic/chains/graph_qa/falkordb.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.falkordb import (
INTERMEDIATE_STEPS_KEY,
FalkorDBQAChain,
extract_cypher,
)
# Create a way to dynamically look up deprecated imports.
# ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/arangodb.py | libs/langchain/langchain_classic/chains/graph_qa/arangodb.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.arangodb import ArangoGraphQAChain
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handl... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/neptune_cypher.py | libs/langchain/langchain_classic/chains/graph_qa/neptune_cypher.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.neptune_cypher import (
INTERMEDIATE_STEPS_KEY,
NeptuneOpenCypherQAChain,
extract_cypher,
trim_query,
use_simple_prompt,
)... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/sparql.py | libs/langchain/langchain_classic/chains/graph_qa/sparql.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.sparql import GraphSparqlQAChain
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handlin... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/kuzu.py | libs/langchain/langchain_classic/chains/graph_qa/kuzu.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.kuzu import (
KuzuQAChain,
extract_cypher,
remove_prefix,
)
# Create a way to dynamically look up deprecated imports.
# Used to consolida... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/__init__.py | libs/langchain/langchain_classic/chains/graph_qa/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/gremlin.py | libs/langchain/langchain_classic/chains/graph_qa/gremlin.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.gremlin import (
GRAPHDB_SPARQL_FIX_TEMPLATE,
INTERMEDIATE_STEPS_KEY,
GremlinQAChain,
extract_gremlin,
)
# Create a way to dynami... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/base.py | libs/langchain/langchain_classic/chains/graph_qa/base.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.base import GraphQAChain
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling option... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/ontotext_graphdb.py | libs/langchain/langchain_classic/chains/graph_qa/ontotext_graphdb.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.ontotext_graphdb import (
OntotextGraphDBQAChain,
)
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising dep... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/hugegraph.py | libs/langchain/langchain_classic/chains/graph_qa/hugegraph.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.hugegraph import HugeGraphQAChain
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handli... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/graph_qa/cypher.py | libs/langchain/langchain_classic/chains/graph_qa/cypher.py | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.graph_qa.cypher import (
CYPHER_GENERATION_PROMPT,
INTERMEDIATE_STEPS_KEY,
GraphCypherQAChain,
construct_schema,
extract_cypher,
)
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/natbot/prompt.py | libs/langchain/langchain_classic/chains/natbot/prompt.py | from langchain_core.prompts.prompt import PromptTemplate
_PROMPT_TEMPLATE = """
You are an agents controlling a browser. You are given:
(1) an objective that you are trying to achieve
(2) the URL of your current web page
(3) a simplified text description of what's visible in the browser window (more on that below)... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/natbot/__init__.py | libs/langchain/langchain_classic/chains/natbot/__init__.py | """Implement a GPT-3 driven browser.
Heavily influenced from https://github.com/nat/natbot
"""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/natbot/base.py | libs/langchain/langchain_classic/chains/natbot/base.py | """Implement an LLM driven browser."""
from __future__ import annotations
import warnings
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import CallbackManagerForChainRun
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers i... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/natbot/crawler.py | libs/langchain/langchain_classic/chains/natbot/crawler.py | import logging
import time
from sys import platform
from typing import (
TYPE_CHECKING,
Any,
TypedDict,
)
if TYPE_CHECKING:
from playwright.sync_api import Browser, CDPSession, Page
logger = logging.getLogger(__name__)
black_listed_elements: set[str] = {
"html",
"head",
"title",
"meta... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/retrieval_qa/prompt.py | libs/langchain/langchain_classic/chains/retrieval_qa/prompt.py | from langchain_core.prompts import PromptTemplate
prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
{context}
Question: {question}
Helpful Answer:""" # noqa: E501
PROMPT = PromptTemp... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/retrieval_qa/__init__.py | libs/langchain/langchain_classic/chains/retrieval_qa/__init__.py | """Chain for question-answering against a vector database."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/retrieval_qa/base.py | libs/langchain/langchain_classic/chains/retrieval_qa/base.py | """Chain for question-answering against a vector database."""
from __future__ import annotations
import inspect
from abc import abstractmethod
from typing import Any
from langchain_core._api import deprecated
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/openai_tools/extraction.py | libs/langchain/langchain_classic/chains/openai_tools/extraction.py | from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers.openai_tools import PydanticToolsParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import Runnable
from langchain_core.utils.function_callin... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/openai_tools/__init__.py | libs/langchain/langchain_classic/chains/openai_tools/__init__.py | from langchain_classic.chains.openai_tools.extraction import (
create_extraction_chain_pydantic,
)
__all__ = ["create_extraction_chain_pydantic"]
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/flare/prompts.py | libs/langchain/langchain_classic/chains/flare/prompts.py | from langchain_core.output_parsers import BaseOutputParser
from langchain_core.prompts import PromptTemplate
from typing_extensions import override
class FinishedOutputParser(BaseOutputParser[tuple[str, bool]]):
"""Output parser that checks if the output is finished."""
finished_value: str = "FINISHED"
"... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/flare/__init__.py | libs/langchain/langchain_classic/chains/flare/__init__.py | """Adapted from https://github.com/jzbjyb/FLARE."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain/langchain_classic/chains/flare/base.py | libs/langchain/langchain_classic/chains/flare/base.py | from __future__ import annotations
import logging
import re
from collections.abc import Sequence
from typing import Any
from langchain_core.callbacks import (
CallbackManagerForChainRun,
)
from langchain_core.language_models import BaseLanguageModel
from langchain_core.messages import AIMessage
from langchain_cor... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/scripts/check_imports.py | libs/langchain_v1/scripts/check_imports.py | """Check imports script.
Quickly verify that a list of Python files can be loaded by the Python interpreter
without raising any errors. Ran before running more expensive tests. Useful in
Makefiles.
If loading a file fails, the script prints the problematic filename and the detailed
error traceback.
"""
import random... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/__init__.py | libs/langchain_v1/tests/__init__.py | """All tests for this package."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/test_dependencies.py | libs/langchain_v1/tests/unit_tests/test_dependencies.py | """A unit test meant to catch accidental introduction of non-optional dependencies."""
from collections.abc import Mapping
from pathlib import Path
from typing import Any
import pytest
import toml
from packaging.requirements import Requirement
HERE = Path(__file__).parent
PYPROJECT_TOML = HERE / "../../pyproject.to... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/test_pytest_config.py | libs/langchain_v1/tests/unit_tests/test_pytest_config.py | import pytest
import pytest_socket
import requests
def test_socket_disabled() -> None:
"""This test should fail."""
with pytest.raises(pytest_socket.SocketBlockedError):
requests.get("https://www.example.com", timeout=1)
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/conftest.py | libs/langchain_v1/tests/unit_tests/conftest.py | """Configuration for unit tests."""
from collections.abc import Sequence
from importlib import util
from typing import Any
import pytest
from langchain_tests.conftest import CustomPersister, CustomSerializer, base_vcr_config
from vcr import VCR
_EXTRA_HEADERS = [
("openai-organization", "PLACEHOLDER"),
("use... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/__init__.py | libs/langchain_v1/tests/unit_tests/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/test_imports.py | libs/langchain_v1/tests/unit_tests/test_imports.py | import importlib
import warnings
from pathlib import Path
# Attempt to recursively import all modules in langchain
PKG_ROOT = Path(__file__).parent.parent.parent
def test_import_all() -> None:
"""Generate the public API for this package."""
with warnings.catch_warnings():
warnings.filterwarnings(acti... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/tools/__init__.py | libs/langchain_v1/tests/unit_tests/tools/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/tools/test_imports.py | libs/langchain_v1/tests/unit_tests/tools/test_imports.py | from langchain import tools
EXPECTED_ALL = {
"BaseTool",
"InjectedState",
"InjectedStore",
"InjectedToolArg",
"InjectedToolCallId",
"ToolException",
"ToolRuntime",
"tool",
}
def test_all_imports() -> None:
assert set(tools.__all__) == EXPECTED_ALL
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/chat_models/test_chat_models.py | libs/langchain_v1/tests/unit_tests/chat_models/test_chat_models.py | import os
from typing import TYPE_CHECKING
from unittest import mock
import pytest
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnableConfig, RunnableSequence
from pydantic import SecretStr
from langchain.chat_models import __all__, init_chat_model
from langchain.chat_m... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/chat_models/__init__.py | libs/langchain_v1/tests/unit_tests/chat_models/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_react_agent.py | libs/langchain_v1/tests/unit_tests/agents/test_react_agent.py | # import dataclasses
# import inspect
# from types import UnionType
# from typing import (
# Annotated,
# Union,
# )
# import pytest
# from langchain_core.language_models import BaseChatModel
# from langchain_core.messages import (
# AIMessage,
# HumanMessage,
# MessageLikeRepresentation,
# Rem... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | true |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py | libs/langchain_v1/tests/unit_tests/agents/test_return_direct_graph.py | """Tests for return_direct tool graph structure."""
from langchain_core.tools import tool
from syrupy.assertion import SnapshotAssertion
from langchain.agents.factory import create_agent
from .model import FakeToolCallingModel
def test_agent_graph_without_return_direct_tools(snapshot: SnapshotAssertion) -> None:
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_agent_name.py | libs/langchain_v1/tests/unit_tests/agents/test_agent_name.py | """Test agent name parameter in create_agent.
This module tests that the name parameter correctly sets .name on AIMessage outputs.
"""
from __future__ import annotations
import pytest
from langchain_core.messages import AIMessage, HumanMessage
from langchain_core.tools import tool
from langchain.agents import creat... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_system_message.py | libs/langchain_v1/tests/unit_tests/agents/test_system_message.py | """Comprehensive unit tests for system message handling in agents.
This module consolidates all system message and dynamic prompt tests:
- Basic system message scenarios (none, string, SystemMessage)
- ModelRequest system_message field support
- System message updates via middleware
- Multiple middleware chaining
- Ca... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | true |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/conftest_store.py | libs/langchain_v1/tests/unit_tests/agents/conftest_store.py | from contextlib import asynccontextmanager, contextmanager
from langgraph.store.memory import InMemoryStore
@contextmanager
def _store_memory():
store = InMemoryStore()
yield store
@asynccontextmanager
async def _store_memory_aio():
store = InMemoryStore()
yield store
# Placeholder functions for ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_responses.py | libs/langchain_v1/tests/unit_tests/agents/test_responses.py | """Unit tests for langgraph.prebuilt.responses module."""
import pytest
# Skip this test since langgraph.prebuilt.responses is not available
pytest.skip("langgraph.prebuilt.responses not available", allow_module_level=True)
class _TestModel(BaseModel):
"""A test model for structured output."""
name: str
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/model.py | libs/langchain_v1/tests/unit_tests/agents/model.py | import json
from collections.abc import Callable, Sequence
from dataclasses import asdict, is_dataclass
from typing import (
Any,
Generic,
Literal,
TypeVar,
)
from langchain_core.callbacks import CallbackManagerForLLMRun
from langchain_core.language_models import BaseChatModel, LanguageModelInput
from ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/any_str.py | libs/langchain_v1/tests/unit_tests/agents/any_str.py | import re
class AnyStr(str):
__slots__ = ("prefix",)
def __init__(self, prefix: str | re.Pattern = "") -> None:
super().__init__()
self.prefix = prefix
def __eq__(self, other: object) -> bool:
return isinstance(other, str) and (
other.startswith(self.prefix)
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py | libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py | """Test ToolRuntime injection with create_agent.
This module tests the injected runtime functionality when using tools
with the create_agent factory. The ToolRuntime provides tools access to:
- state: Current graph state
- tool_call_id: ID of the current tool call
- config: RunnableConfig for the execution
- context: ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_response_format.py | libs/langchain_v1/tests/unit_tests/agents/test_response_format.py | """Test suite for create_agent with structured output response_format permutations."""
import json
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from typing import Any
from unittest.mock import patch
import pytest
from langchain_core.language_models import LanguageModelInput
from la... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/conftest.py | libs/langchain_v1/tests/unit_tests/agents/conftest.py | import os
from collections.abc import AsyncIterator, Iterator
from uuid import UUID
import pytest
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.store.base import BaseStore
from pytest_mock import MockerFixture
from .conftest_checkpointer import (
_checkpointer_memory,
_checkpointer_... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/utils.py | libs/langchain_v1/tests/unit_tests/agents/utils.py | import json
from pathlib import Path
from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel
class BaseSchema(BaseModel):
model_config = ConfigDict(
alias_generator=to_camel,
populate_by_name=True,
from_attributes=True,
)
def load_spec(spec_name: st... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_create_agent_tool_validation.py | libs/langchain_v1/tests/unit_tests/agents/test_create_agent_tool_validation.py | import sys
from typing import Annotated
import pytest
from langchain_core.messages import HumanMessage
from langgraph.prebuilt import InjectedStore, ToolRuntime
from langgraph.store.base import BaseStore
from langgraph.store.memory import InMemoryStore
from langchain.agents import AgentState, create_agent
from langch... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_response_format_integration.py | libs/langchain_v1/tests/unit_tests/agents/test_response_format_integration.py | r"""Test response_format for langchain-openai.
If tests fail, cassettes may need to be re-recorded.
To re-record cassettes:
1. Delete existing cassettes (`rm tests/cassettes/test_inference_to_*.yaml.gz`)
2. Re run the tests with a valid OPENAI_API_KEY in your environment:
```bash
OPENAI_API_KEY=... uv run python -m ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/__init__.py | libs/langchain_v1/tests/unit_tests/agents/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py | libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py | from __future__ import annotations
import pytest
# Skip this test since langgraph.prebuilt.responses is not available
pytest.skip("langgraph.prebuilt.responses not available", allow_module_level=True)
try:
from langchain_openai import ChatOpenAI
except ImportError:
skip_openai_integration_tests = True
else:
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/messages.py | libs/langchain_v1/tests/unit_tests/agents/messages.py | """Redefined messages as a work-around for pydantic issue with AnyStr.
The code below creates version of pydantic models
that will work in unit tests with AnyStr as id field
Please note that the `id` field is assigned AFTER the model is created
to workaround an issue with pydantic ignoring the __eq__ method on
subclas... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/conftest_checkpointer.py | libs/langchain_v1/tests/unit_tests/agents/conftest_checkpointer.py | from contextlib import asynccontextmanager, contextmanager
from .memory_assert import (
MemorySaverAssertImmutable,
)
@contextmanager
def _checkpointer_memory():
yield MemorySaverAssertImmutable()
@asynccontextmanager
async def _checkpointer_memory_aio():
yield MemorySaverAssertImmutable()
# Placehol... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_state_schema.py | libs/langchain_v1/tests/unit_tests/agents/test_state_schema.py | """Test state_schema parameter in create_agent.
This module tests that the state_schema parameter allows users to extend
AgentState without needing to create custom middleware.
"""
from __future__ import annotations
from typing import Any
from langchain_core.messages import HumanMessage
from langchain_core.tools im... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/memory_assert.py | libs/langchain_v1/tests/unit_tests/agents/memory_assert.py | import os
import tempfile
import time
from collections import defaultdict
from functools import partial
from langgraph.checkpoint.base import (
ChannelVersions,
Checkpoint,
CheckpointMetadata,
SerializerProtocol,
)
from langgraph.checkpoint.memory import InMemorySaver, PersistentDict
from langgraph.pre... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/test_responses_spec.py | libs/langchain_v1/tests/unit_tests/agents/test_responses_spec.py | from __future__ import annotations
import pytest
# Skip this test since langgraph.prebuilt.responses is not available
pytest.skip("langgraph.prebuilt.responses not available", allow_module_level=True)
try:
from langchain_openai import ChatOpenAI
except ImportError:
skip_openai_integration_tests = True
else:
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/__init__.py | libs/langchain_v1/tests/unit_tests/agents/middleware/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py | import sys
from collections.abc import Awaitable, Callable
from typing import Annotated, Any
import pytest
from langchain_core.language_models import GenericFakeChatModel
from langchain_core.messages import AIMessage, HumanMessage, ToolCall, ToolMessage
from langchain_core.tools import InjectedToolCallId, tool
from la... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | true |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py | """Consolidated tests for middleware decorators: before_model, after_model, and wrap_model_call."""
from typing import Any
import pytest
from langchain_core.messages import AIMessage, HumanMessage
from langchain_core.tools import tool
from langgraph.runtime import Runtime
from syrupy.assertion import SnapshotAssertio... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py | """Tests for wrap_tool_call decorator functionality.
These tests verify the decorator-based approach for wrapping tool calls,
focusing on the handler pattern (not generators).
"""
import time
from collections.abc import Callable
from langchain_core.messages import HumanMessage, ToolCall, ToolMessage
from langchain_c... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_tools.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_tools.py | """Test Middleware handling of tools in agents."""
from collections.abc import Callable
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from langchain_core.tools import tool
from langgraph.prebuilt.tool_node import ToolNode
from langchain.agents.factory import create_agent
from... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py | """Tests for sync/async middleware composition with wrap_tool_call and awrap_tool_call.
These tests verify the desired behavior:
1. If middleware defines both sync and async -> use both on respective paths
2. If middleware defines only sync -> use on sync path, raise NotImplementedError on async path
3. If middleware ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_diagram.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_diagram.py | from collections.abc import Callable
from langchain_core.messages import AIMessage
from syrupy.assertion import SnapshotAssertion
from langchain.agents.factory import create_agent
from langchain.agents.middleware.types import AgentMiddleware, ModelRequest
from tests.unit_tests.agents.model import FakeToolCallingModel... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/langchain_v1/tests/unit_tests/agents/middleware/core/__init__.py | libs/langchain_v1/tests/unit_tests/agents/middleware/core/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.