sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
langchain-ai/langgraph:libs/sdk-py/tests/test_serde_schema.py
from dataclasses import dataclass from typing import runtime_checkable from pydantic import BaseModel from langgraph_sdk.schema import ( _BaseModelLike, _DataclassLike, ) def rc(cls: type) -> type: return runtime_checkable(cls) class MyModel(BaseModel): foo: str def test_base_model_like(): a...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/sdk-py/tests/test_serde_schema.py", "license": "MIT License", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/sdk-py/tests/test_serde.py
from typing import Any import orjson import pytest from pydantic import BaseModel from langgraph_sdk.client import _aencode_json async def _serde_roundtrip(data: Any): _, body = await _aencode_json(data) return orjson.loads(body) # ty: ignore[invalid-argument-type] async def test_serde_basic(): # Tes...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/sdk-py/tests/test_serde.py", "license": "MIT License", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/cli/langgraph_cli/schemas.py
from typing import Any, Literal, TypedDict Distros = Literal["debian", "wolfi", "bookworm"] MiddlewareOrders = Literal["auth_first", "middleware_first"] class TTLConfig(TypedDict, total=False): """Configuration for TTL (time-to-live) behavior in the store.""" refresh_on_read: bool """Default behavior fo...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/cli/langgraph_cli/schemas.py", "license": "MIT License", "lines": 579, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
langchain-ai/langgraph:libs/prebuilt/tests/test_on_tool_call.py
"""Unit tests for tool call interceptor in ToolNode.""" from collections.abc import Callable from unittest.mock import Mock import pytest from langchain_core.messages import AIMessage, ToolCall, ToolMessage from langchain_core.runnables import RunnableConfig from langchain_core.tools import tool from langgraph.store....
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/test_on_tool_call.py", "license": "MIT License", "lines": 1160, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/prebuilt/tests/test_tool_node_interceptor_unregistered.py
"""Test tool node interceptor handling of unregistered tools.""" from collections.abc import Awaitable, Callable from unittest.mock import Mock import pytest from langchain_core.messages import AIMessage, ToolMessage from langchain_core.runnables.config import RunnableConfig from langchain_core.tools import tool as d...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/test_tool_node_interceptor_unregistered.py", "license": "MIT License", "lines": 693, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/prebuilt/tests/test_tool_node_validation_error_filtering.py
"""Unit tests for ValidationError filtering in ToolNode. This module tests that validation errors are filtered to only include arguments that the LLM controls. Injected arguments (InjectedState, InjectedStore, ToolRuntime) are automatically provided by the system and should not appear in validation error messages. Thi...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/test_tool_node_validation_error_filtering.py", "license": "MIT License", "lines": 390, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/sdk-py/langgraph_sdk/errors.py
from __future__ import annotations import logging import sys from typing import Any, Literal, cast import httpx import orjson logger = logging.getLogger(__name__) class LangGraphError(Exception): pass class APIError(httpx.HTTPStatusError, LangGraphError): message: str request: httpx.Request body...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/sdk-py/langgraph_sdk/errors.py", "license": "MIT License", "lines": 181, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langchain-ai/langgraph:libs/sdk-py/tests/test_errors.py
from __future__ import annotations from typing import cast import httpx import orjson import pytest from langgraph_sdk.errors import ( APIStatusError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, Un...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/sdk-py/tests/test_errors.py", "license": "MIT License", "lines": 125, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/cli/examples/graph_prerelease_reqs_fail/agent.py
from collections.abc import Sequence from typing import Annotated, Literal, TypedDict from langchain_community.tools.tavily_search import TavilySearchResults from langchain_core.messages import BaseMessage from langchain_openai import ChatOpenAI from langgraph.graph import END, StateGraph, add_messages from langgraph....
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/cli/examples/graph_prerelease_reqs_fail/agent.py", "license": "MIT License", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/cli/tests/unit_tests/test_util.py
from unittest.mock import patch from langgraph_cli.util import clean_empty_lines, warn_non_wolfi_distro def test_clean_empty_lines(): """Test clean_empty_lines function.""" # Test with empty lines input_str = "line1\n\nline2\n\nline3" result = clean_empty_lines(input_str) assert result == "line1\...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/cli/tests/unit_tests/test_util.py", "license": "MIT License", "lines": 149, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/sdk-py/tests/test_client_stream.py
from __future__ import annotations from collections.abc import Iterator, Sequence from pathlib import Path import httpx import pytest from langgraph_sdk.client import HttpClient, SyncHttpClient from langgraph_sdk.schema import StreamPart from langgraph_sdk.sse import BytesLike, BytesLineDecoder, SSEDecoder with ope...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/sdk-py/tests/test_client_stream.py", "license": "MIT License", "lines": 210, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/cli/examples/graph_prerelease_reqs/agent.py
from collections.abc import Sequence from typing import Annotated, Literal, TypedDict from langchain_core.messages import BaseMessage from langchain_openai import ChatOpenAI from langgraph.graph import END, StateGraph, add_messages from langgraph.prebuilt import ToolNode tools = [] model_oai = ChatOpenAI(temperature...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/cli/examples/graph_prerelease_reqs/agent.py", "license": "MIT License", "lines": 67, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/cli/python-monorepo-example/apps/agent/src/agent/graph.py
"""Simple LangGraph agent for monorepo testing.""" from common import get_common_prefix from langchain_core.messages import AIMessage from langgraph.graph import END, START, StateGraph from shared import get_dummy_message from agent.state import State def call_model(state: State) -> dict: """Simple node that us...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/cli/python-monorepo-example/apps/agent/src/agent/graph.py", "license": "MIT License", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/cli/python-monorepo-example/apps/agent/src/agent/state.py
"""State definition for the agent.""" from collections.abc import Sequence from typing import Annotated, TypedDict from langchain_core.messages import BaseMessage from langgraph.graph.message import add_messages class State(TypedDict): """The state of the agent.""" messages: Annotated[Sequence[BaseMessage]...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/cli/python-monorepo-example/apps/agent/src/agent/state.py", "license": "MIT License", "lines": 8, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/sdk-py/tests/test_api_parity.py
from __future__ import annotations import inspect import re import pytest from langgraph_sdk.client import ( AssistantsClient, CronClient, RunsClient, StoreClient, SyncAssistantsClient, SyncCronClient, SyncRunsClient, SyncStoreClient, SyncThreadsClient, ThreadsClient, ) def ...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/sdk-py/tests/test_api_parity.py", "license": "MIT License", "lines": 100, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/checkpoint/tests/test_redis_cache.py
"""Unit tests for Redis cache implementation.""" import time import pytest import redis from langgraph.cache.base import FullKey from langgraph.cache.redis import RedisCache class TestRedisCache: @pytest.fixture(autouse=True) def setup(self) -> None: """Set up test Redis client and cache.""" ...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/checkpoint/tests/test_redis_cache.py", "license": "MIT License", "lines": 248, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/tests/test_managed_values.py
from typing_extensions import NotRequired, Required, TypedDict from langgraph.graph import StateGraph from langgraph.managed import RemainingSteps class StatePlain(TypedDict): remaining_steps: RemainingSteps class StateNotRequired(TypedDict): remaining_steps: NotRequired[RemainingSteps] class StateRequir...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/test_managed_values.py", "license": "MIT License", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/prebuilt/tests/test_deprecation.py
import pytest from langgraph.warnings import LangGraphDeprecatedSinceV10 from typing_extensions import TypedDict from langgraph.prebuilt import create_react_agent from tests.model import FakeToolCallingModel class Config(TypedDict): model: str @pytest.mark.filterwarnings("ignore:`config_schema` is deprecated")...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/test_deprecation.py", "license": "MIT License", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/langgraph/_internal/_constants.py
"""Constants used for Pregel operations.""" import sys from typing import Literal, cast # --- Reserved write keys --- INPUT = sys.intern("__input__") # for values passed as input to the graph INTERRUPT = sys.intern("__interrupt__") # for dynamic interrupts raised by nodes RESUME = sys.intern("__resume__") # for value...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/_internal/_constants.py", "license": "MIT License", "lines": 104, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langchain-ai/langgraph:libs/langgraph/langgraph/_internal/_retry.py
def default_retry_on(exc: Exception) -> bool: import httpx import requests if isinstance(exc, ConnectionError): return True if isinstance(exc, httpx.HTTPStatusError): return 500 <= exc.response.status_code < 600 if isinstance(exc, requests.HTTPError): return 500 <= exc.respo...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/_internal/_retry.py", "license": "MIT License", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/langgraph/langgraph/graph/_node.py
from __future__ import annotations from collections.abc import Sequence from dataclasses import dataclass from typing import Any, Generic, Protocol, TypeAlias from langchain_core.runnables import Runnable, RunnableConfig from langgraph.store.base import BaseStore from langgraph._internal._typing import EMPTY_SEQ fro...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/graph/_node.py", "license": "MIT License", "lines": 67, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/langgraph/langgraph/pregel/main.py
from __future__ import annotations import asyncio import concurrent import concurrent.futures import contextlib import queue import warnings import weakref from collections import defaultdict, deque from collections.abc import ( AsyncIterator, Awaitable, Callable, Iterator, Mapping, Sequence, )...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/pregel/main.py", "license": "MIT License", "lines": 3025, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langchain-ai/langgraph:libs/langgraph/langgraph/runtime.py
from __future__ import annotations from dataclasses import dataclass, field, replace from typing import Any, Generic, cast from langgraph.store.base import BaseStore from typing_extensions import TypedDict, Unpack from langgraph._internal._constants import CONF, CONFIG_KEY_RUNTIME from langgraph.config import get_co...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/runtime.py", "license": "MIT License", "lines": 115, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
langchain-ai/langgraph:libs/langgraph/tests/test_interrupt_migration.py
import warnings import pytest from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer from langgraph.types import Interrupt from langgraph.warnings import LangGraphDeprecatedSinceV10 @pytest.mark.filterwarnings("ignore:LangGraphDeprecatedSinceV10") def test_interrupt_legacy_ns() -> None: with warning...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/test_interrupt_migration.py", "license": "MIT License", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/tests/test_runtime.py
from dataclasses import dataclass from typing import Any import pytest from pydantic import BaseModel, ValidationError from typing_extensions import TypedDict from langgraph.graph import END, START, StateGraph from langgraph.runtime import Runtime, get_runtime def test_injected_runtime() -> None: @dataclass ...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/test_runtime.py", "license": "MIT License", "lines": 296, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/langgraph/warnings.py
"""LangGraph specific warnings.""" from __future__ import annotations __all__ = ( "LangGraphDeprecationWarning", "LangGraphDeprecatedSinceV05", "LangGraphDeprecatedSinceV10", ) class LangGraphDeprecationWarning(DeprecationWarning): """A LangGraph specific deprecation warning. Attributes: ...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/warnings.py", "license": "MIT License", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/langgraph/tests/test_deprecation.py
from __future__ import annotations import warnings from typing import Any, Optional import pytest from langchain_core.runnables import RunnableConfig from pytest_mock import MockerFixture from typing_extensions import NotRequired, TypedDict from langgraph.channels.last_value import LastValue from langgraph.errors im...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/test_deprecation.py", "license": "MIT License", "lines": 261, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/tests/test_config_async.py
import pytest from langchain_core.callbacks import AsyncCallbackManager from langgraph._internal._config import get_async_callback_manager_for_config pytestmark = pytest.mark.anyio def test_new_async_manager_includes_tags() -> None: config = {"callbacks": None} manager = get_async_callback_manager_for_confi...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/test_config_async.py", "license": "MIT License", "lines": 13, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/langgraph/typing.py
from __future__ import annotations from typing_extensions import TypeVar from langgraph._internal._typing import StateLike __all__ = ( "StateT", "StateT_co", "StateT_contra", "InputT", "OutputT", "ContextT", ) StateT = TypeVar("StateT", bound=StateLike) """Type variable used to represent the...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/langgraph/typing.py", "license": "MIT License", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langchain-ai/langgraph:libs/langgraph/tests/test_type_checking.py
from dataclasses import dataclass from operator import add from typing import Annotated, Any import pytest from langchain_core.runnables import RunnableConfig from pydantic import BaseModel from typing_extensions import TypedDict from langgraph.graph import StateGraph from langgraph.types import Command def test_ty...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/test_type_checking.py", "license": "MIT License", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/prebuilt/tests/test_react_agent_graph.py
from collections.abc import Callable import pytest from pydantic import BaseModel from syrupy import SnapshotAssertion from langgraph.prebuilt import create_react_agent from tests.model import FakeToolCallingModel model = FakeToolCallingModel() def tool() -> None: """Testing tool.""" ... def pre_model_ho...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/test_react_agent_graph.py", "license": "MIT License", "lines": 38, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/checkpoint-sqlite/langgraph/store/sqlite/aio.py
from __future__ import annotations import asyncio import logging from collections import defaultdict from collections.abc import AsyncIterator, Callable, Iterable, Sequence from contextlib import asynccontextmanager from types import TracebackType from typing import Any, cast import aiosqlite import orjson import sql...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/checkpoint-sqlite/langgraph/store/sqlite/aio.py", "license": "MIT License", "lines": 537, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langchain-ai/langgraph:libs/checkpoint-sqlite/langgraph/store/sqlite/base.py
from __future__ import annotations import concurrent.futures import datetime import logging import re import sqlite3 import threading from collections import defaultdict from collections.abc import Callable, Iterable, Iterator, Sequence from contextlib import contextmanager from typing import Any, Literal, NamedTuple,...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/checkpoint-sqlite/langgraph/store/sqlite/base.py", "license": "MIT License", "lines": 1258, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langchain-ai/langgraph:libs/checkpoint-sqlite/tests/test_async_store.py
# mypy: disable-error-code="union-attr,arg-type,index,operator" import asyncio import os import tempfile import uuid from collections.abc import AsyncIterator, Generator, Iterable from contextlib import asynccontextmanager from typing import cast import pytest from langgraph.store.base import ( GetOp, Item, ...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/checkpoint-sqlite/tests/test_async_store.py", "license": "MIT License", "lines": 604, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/checkpoint-sqlite/tests/test_store.py
# mypy: disable-error-code="union-attr,arg-type,index,operator" import os import re import tempfile import uuid from collections.abc import Generator, Iterable from contextlib import contextmanager from typing import Any, Literal, cast import pytest from langchain_core.embeddings import Embeddings from langgraph.store...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/checkpoint-sqlite/tests/test_store.py", "license": "MIT License", "lines": 1016, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/checkpoint-sqlite/tests/test_ttl.py
"""Test SQLite store Time-To-Live (TTL) functionality.""" import asyncio import os import tempfile import time from collections.abc import Generator import pytest from langgraph.store.base import TTLConfig from langgraph.store.sqlite import SqliteStore from langgraph.store.sqlite.aio import AsyncSqliteStore @pytes...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/checkpoint-sqlite/tests/test_ttl.py", "license": "MIT License", "lines": 322, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/prebuilt/tests/conftest_checkpointer.py
from contextlib import asynccontextmanager, contextmanager from uuid import uuid4 from langgraph.checkpoint.postgres import PostgresSaver from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver from langgraph.checkpoint.sqlite import SqliteSaver from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver fro...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/conftest_checkpointer.py", "license": "MIT License", "lines": 154, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/prebuilt/tests/conftest_store.py
from contextlib import asynccontextmanager, contextmanager from uuid import uuid4 from langgraph.store.memory import InMemoryStore from langgraph.store.postgres import AsyncPostgresStore, PostgresStore from psycopg import AsyncConnection, Connection DEFAULT_POSTGRES_URI = "postgres://postgres:postgres@localhost:5442/...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/prebuilt/tests/conftest_store.py", "license": "MIT License", "lines": 127, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/tests/conftest_checkpointer.py
import os from contextlib import asynccontextmanager, contextmanager from uuid import uuid4 import pytest from langgraph.checkpoint.postgres import PostgresSaver from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver from langgraph.checkpoint.serde.encrypted import EncryptedSerializer from langgraph.checkpoi...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/conftest_checkpointer.py", "license": "MIT License", "lines": 207, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langchain-ai/langgraph:libs/langgraph/tests/example_app/example_graph.py
from typing import Annotated from langchain_core.messages import AIMessage, BaseMessage, ToolMessage from langchain_core.tools import tool from typing_extensions import TypedDict from langgraph.func import entrypoint, task from langgraph.graph.message import add_messages from tests.fake_chat import FakeChatModel cl...
{ "repo_id": "langchain-ai/langgraph", "file_path": "libs/langgraph/tests/example_app/example_graph.py", "license": "MIT License", "lines": 74, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/base/langflow/alembic/versions/169b35510b37_added_job_type_to_make_jobs_generic_and_.py
"""added job_type to make jobs generic and user_id for ownership Revision ID: 169b35510b37 Revises: 369268b9af8b Create Date: 2026-02-10 16:15:51.830502 Phase: EXPAND """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "16...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/alembic/versions/169b35510b37_added_job_type_to_make_jobs_generic_and_.py", "license": "MIT License", "lines": 48, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, ...
function_simple
langflow-ai/langflow:src/backend/base/langflow/alembic/versions/26ef53e27502_adding_asset_id_and_asset_type_to_job_.py
"""adding asset_id and asset_type to job table for polymorphism of jobs. Revision ID: 26ef53e27502 Revises: 169b35510b37 Create Date: 2026-02-12 16:42:09.706216 Phase: EXPAND """ from collections.abc import Sequence import sqlalchemy as sa import sqlmodel from alembic import op # revision identifiers, used by Alem...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/alembic/versions/26ef53e27502_adding_asset_id_and_asset_type_to_job_.py", "license": "MIT License", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, ...
function_simple
langflow-ai/langflow:src/backend/base/langflow/alembic/versions/c187c3b9bb94_merge_job_asset_and_sso_heads.py
"""merge_job_asset_and_sso_heads Revision ID: c187c3b9bb94 Revises: 26ef53e27502, b1c2d3e4f5a6 Create Date: 2026-02-25 14:19:54.858370 Phase: EXPAND """ from collections.abc import Sequence # revision identifiers, used by Alembic. revision: str = "c187c3b9bb94" down_revision: str | Sequence[str] | None = ("26ef53e2...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/alembic/versions/c187c3b9bb94_merge_job_asset_and_sso_heads.py", "license": "MIT License", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template...
function_simple
langflow-ai/langflow:src/backend/base/langflow/api/utils/kb_helpers.py
import asyncio import contextlib import gc import json import uuid from datetime import datetime, timezone from functools import lru_cache from pathlib import Path import chromadb import chromadb.errors import pandas as pd from chromadb.api.shared_system_client import SharedSystemClient from chromadb.config import Set...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/api/utils/kb_helpers.py", "license": "MIT License", "lines": 384, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/base/langflow/schema/knowledge_base.py
from pydantic import BaseModel class KnowledgeBaseInfo(BaseModel): id: str dir_name: str = "" name: str embedding_provider: str | None = "Unknown" embedding_model: str | None = "Unknown" size: int = 0 words: int = 0 characters: int = 0 chunks: int = 0 avg_chunk_size: float = 0....
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/schema/knowledge_base.py", "license": "MIT License", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/base/langflow/utils/kb_constants.py
MAX_RETRY_ATTEMPTS = 5 INGESTION_BATCH_SIZE = 200 EXPONENTIAL_BACKOFF_MULTIPLIER = 2 MIN_KB_NAME_LENGTH = 3 CHUNK_PREVIEW_MULTIPLIER = 3
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/utils/kb_constants.py", "license": "MIT License", "lines": 5, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/tests/unit/test_knowledge_bases_api.py
import io import json import uuid from unittest.mock import AsyncMock, MagicMock, patch import pandas as pd import pytest from httpx import AsyncClient from langflow.api.utils.kb_helpers import ( KBAnalysisHelper, KBIngestionHelper, KBStorageHelper, ) @pytest.fixture def sample_text_file(): """Create...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/test_knowledge_bases_api.py", "license": "MIT License", "lines": 497, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_agentics_component.py
"""Unit tests for Agentics components.""" from __future__ import annotations import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True) from lfx.components.agentics import SemanticAggregato...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_agentics_component.py", "license": "MIT License", "lines": 114, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_llm_factory.py
"""Unit tests for Agentics LLM factory.""" from __future__ import annotations import sys from unittest.mock import MagicMock, patch import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_llm_factory.py", "license": "MIT License", "lines": 173, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_model_config.py
"""Unit tests for Agentics model configuration helpers.""" from __future__ import annotations import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True) from lfx.components.agentics.constan...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_model_config.py", "license": "MIT License", "lines": 139, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_schema_builder.py
"""Unit tests for Agentics schema builder helper.""" from __future__ import annotations import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True) from lfx.components.agentics.helpers.schem...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_schema_builder.py", "license": "MIT License", "lines": 88, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_semantic_aggregator.py
"""Unit tests for Agentics SemanticAggregator component.""" from __future__ import annotations import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True) from lfx.components.agentics.semant...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_semantic_aggregator.py", "license": "MIT License", "lines": 71, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_semantic_map.py
"""Unit tests for Agentics SemanticMap component.""" from __future__ import annotations import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True) from lfx.components.agentics.semantic_map ...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_semantic_map.py", "license": "MIT License", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/components/bundles/agentics/test_synthetic_data_generator.py
"""Unit tests for Agentics SyntheticDataGenerator component.""" from __future__ import annotations import pytest try: import agentics # noqa: F401 import crewai # noqa: F401 except ImportError: pytest.skip("agentics-py and crewai not installed", allow_module_level=True) from lfx.components.agentics.sy...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/bundles/agentics/test_synthetic_data_generator.py", "license": "MIT License", "lines": 79, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": ""...
test
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/constants.py
"""Constants and configuration values for Agentics components.""" from __future__ import annotations # Default URLs DEFAULT_OLLAMA_URL = "http://localhost:11434" # Provider names PROVIDER_IBM_WATSONX = "IBM WatsonX" PROVIDER_GOOGLE = "Google Generative AI" PROVIDER_OPENAI = "OpenAI" PROVIDER_ANTHROPIC = "Anthropic" ...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/constants.py", "license": "MIT License", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/helpers/llm_factory.py
"""Factory functions for creating and configuring LLM instances for different providers.""" from __future__ import annotations from typing import TYPE_CHECKING from lfx.base.models.watsonx_constants import IBM_WATSONX_URLS from lfx.components.agentics.constants import ( DEFAULT_OLLAMA_URL, ERROR_UNSUPPORTED_...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/helpers/llm_factory.py", "license": "MIT License", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/helpers/model_config.py
"""Model configuration and validation helpers for Agentics components.""" from __future__ import annotations from typing import Any from lfx.components.agentics.constants import ( ERROR_MODEL_NOT_SELECTED, PROVIDER_IBM_WATSONX, PROVIDER_OLLAMA, ) def validate_model_selection(model: Any) -> tuple[str, s...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/helpers/model_config.py", "license": "MIT License", "lines": 67, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/helpers/schema_builder.py
"""Schema building utilities for converting field definitions to Pydantic models.""" from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Any def build_schema_fields(fields: list[dict[str, Any]]) -> list[tuple[str, str, str, bool]]: """Convert field defin...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/helpers/schema_builder.py", "license": "MIT License", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/inputs/base_component.py
"""Base component for Agentics components.""" from __future__ import annotations from typing import ClassVar from lfx.base.models.unified_models import ( get_language_model_options, update_model_options_in_build_config, ) from lfx.components.agentics.helpers import update_provider_fields_visibility from lfx....
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/inputs/base_component.py", "license": "MIT License", "lines": 42, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/inputs/common_inputs.py
"""Common input field definitions shared across Agentics components.""" from __future__ import annotations from lfx.base.models.watsonx_constants import IBM_WATSONX_URLS from lfx.components.agentics.constants import DEFAULT_OLLAMA_URL from lfx.io import ( DropdownInput, MessageInput, ModelInput, Secre...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/inputs/common_inputs.py", "license": "MIT License", "lines": 127, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/semantic_aggregator.py
"""SemanticAggregator component for aggregating and summarizing input data using LLM-based semantic analysis.""" from __future__ import annotations from typing import ClassVar from pydantic import create_model from lfx.components.agentics.constants import ( ERROR_AGENTICS_NOT_INSTALLED, ERROR_INPUT_SCHEMA_R...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/semantic_aggregator.py", "license": "MIT License", "lines": 105, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/semantic_map.py
"""SemanticMap component for transforming each row of input data using LLM-based semantic processing.""" from __future__ import annotations from typing import ClassVar from pydantic import create_model from lfx.components.agentics.constants import ( ERROR_AGENTICS_NOT_INSTALLED, ERROR_INPUT_SCHEMA_REQUIRED,...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/semantic_map.py", "license": "MIT License", "lines": 118, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/lfx/src/lfx/components/agentics/synthetic_data_generator.py
"""SyntheticDataGenerator component for creating synthetic data using LLM-based generation.""" from __future__ import annotations from typing import ClassVar from lfx.components.agentics.constants import ERROR_AGENTICS_NOT_INSTALLED from lfx.components.agentics.helpers import ( build_schema_fields, prepare_l...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/agentics/synthetic_data_generator.py", "license": "MIT License", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/tests/unit/agentic/services/test_provider_service_multi.py
"""Tests for multi-variable provider support in provider service.""" from unittest.mock import MagicMock, patch import pytest from langflow.agentic.services.provider_service import get_enabled_providers_for_user class TestGetEnabledProvidersForUserMulti: """Tests for get_enabled_providers_for_user with multiple...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/agentic/services/test_provider_service_multi.py", "license": "MIT License", "lines": 77, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:scripts/ci/test_constraint_preservation.py
import subprocess # Simulate the sed pattern from release.yml # The pattern should preserve trailing commas SED_PATTERN = 's|"langflow-base[^"]*"|"langflow-base[complete]>=0.8.0.rc3,<1.dev0"|g' TEST_CASES = [ ' "langflow-base[complete]~=0.8.0",', ' "langflow-base~=0.8.0",', ' "langflow-base[opena...
{ "repo_id": "langflow-ai/langflow", "file_path": "scripts/ci/test_constraint_preservation.py", "license": "MIT License", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/base/langflow/services/tracing/openlayer.py
from __future__ import annotations import json import os import re import time from typing import TYPE_CHECKING, Any, TypedDict from langchain_core.documents import Document from langchain_core.messages import BaseMessage from loguru import logger from typing_extensions import override from langflow.schema.data impo...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/services/tracing/openlayer.py", "license": "MIT License", "lines": 671, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/tests/unit/components/languagemodels/test_litellm_proxy.py
from unittest.mock import MagicMock, patch import httpx import pytest from lfx.components.litellm.litellm_proxy import LiteLLMProxyComponent from lfx.inputs.inputs import IntInput, SecretStrInput, SliderInput, StrInput from pydantic.v1 import SecretStr from tests.base import ComponentTestBaseWithoutClient def _mock...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/languagemodels/test_litellm_proxy.py", "license": "MIT License", "lines": 200, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/lfx/src/lfx/components/litellm/litellm_proxy.py
import httpx from langchain_openai import ChatOpenAI from pydantic.v1 import SecretStr from lfx.base.models.model import LCModelComponent from lfx.field_typing import LanguageModel from lfx.field_typing.range_spec import RangeSpec from lfx.inputs.inputs import IntInput, SecretStrInput, SliderInput, StrInput class Li...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/litellm/litellm_proxy.py", "license": "MIT License", "lines": 127, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/tests/unit/components/docling/test_chunk_docling_document_component.py
"""Tests for ChunkDoclingDocumentComponent HybridChunker parameters.""" import sys import types import pytest pytest.importorskip("tiktoken") pytest.importorskip("docling_core") from lfx.components.docling.chunk_docling_document import ChunkDoclingDocumentComponent def _base_build_config(): return { "...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/docling/test_chunk_docling_document_component.py", "license": "MIT License", "lines": 153, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": ""...
test
langflow-ai/langflow:src/backend/base/langflow/alembic/versions/b1c2d3e4f5a6_add_sso_plugin_tables_sso_user_profile_.py
"""add SSO plugin tables sso_user_profile and sso_config Revision ID: b1c2d3e4f5a6 Revises: 369268b9af8b Create Date: 2026-02-24 Phase: EXPAND """ from collections.abc import Sequence import sqlalchemy as sa import sqlmodel from alembic import op from langflow.utils import migration # revision identifiers, used by...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/alembic/versions/b1c2d3e4f5a6_add_sso_plugin_tables_sso_user_profile_.py", "license": "MIT License", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, ...
function_simple
langflow-ai/langflow:src/backend/base/langflow/plugin_routes.py
"""Plugin route discovery and registration with conflict protection. Plugins register via the ``langflow.plugins`` entry-point group. They receive a wrapper so they cannot overwrite or shadow existing Langflow routes. """ from importlib.metadata import entry_points from fastapi import FastAPI from lfx.log.logger imp...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/plugin_routes.py", "license": "MIT License", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/base/langflow/services/database/models/auth/sso.py
"""SSO plugin tables. These tables are used by the SSO plugin for identity and provider configuration. Migrations are managed by Langflow (OSS); the plugin must not create or migrate these tables. Plugins must use these tables via the models exported from ``langflow.services.database.models`` (e.g. ``SSOUserProfile``...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/services/database/models/auth/sso.py", "license": "MIT License", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/tests/unit/test_plugin_routes.py
"""Tests for plugin route discovery and conflict protection. Ensures that plugins loaded via the langflow.plugins entry-point group cannot overwrite or shadow existing Langflow routes. """ from unittest.mock import MagicMock, patch import pytest from fastapi import FastAPI from fastapi.routing import APIRouter from ...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/test_plugin_routes.py", "license": "MIT License", "lines": 183, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/test_sso_models.py
"""Tests for SSO plugin models against a real database. No mocks: uses in-memory SQLite with foreign keys enabled to verify CASCADE delete, unique constraints, and default values. """ import pytest from langflow.services.database.models.auth.sso import SSOConfig, SSOUserProfile from langflow.services.database.models....
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/test_sso_models.py", "license": "MIT License", "lines": 154, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/base/langflow/helpers/windows_postgres_helper.py
"""Helper for Windows + PostgreSQL event loop configuration.""" import asyncio import os import platform from lfx.log.logger import logger LANGFLOW_DATABASE_URL = "LANGFLOW_DATABASE_URL" POSTGRESQL_PREFIXES = ("postgresql", "postgres") def configure_windows_postgres_event_loop(source: str | None = None) -> bool: ...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/helpers/windows_postgres_helper.py", "license": "MIT License", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/tests/unit/test_database_windows_postgres_integration.py
"""Integration tests for database service with Windows + PostgreSQL fix. Tests that the database service properly handles event loop configuration across different platforms and database types. """ import asyncio import os from unittest.mock import MagicMock, patch import pytest from langflow.services.database.servi...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/test_database_windows_postgres_integration.py", "license": "MIT License", "lines": 114, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/test_windows_postgres_helper.py
"""Unit tests for Windows + PostgreSQL event loop configuration. These tests ensure the fix works correctly across all platforms: - Windows with PostgreSQL (applies fix) - Windows with SQLite (no fix) - Linux (no fix) - macOS (no fix) - Docker (no fix) """ import asyncio import os from unittest.mock import MagicMock,...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/test_windows_postgres_helper.py", "license": "MIT License", "lines": 164, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/integration/test_openai_error_propagation.py
"""Test error propagation in OpenAI-compatible streaming API.""" import json import pytest from httpx import AsyncClient @pytest.mark.integration async def test_openai_pre_streaming_error_format(client: AsyncClient, created_api_key): """Test that pre-streaming errors (e.g., invalid flow ID) return proper error ...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/integration/test_openai_error_propagation.py", "license": "MIT License", "lines": 112, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/base/langflow/api/v2/schemas.py
"""Pydantic schemas for v2 API endpoints.""" from pydantic import BaseModel class MCPServerConfig(BaseModel): """Pydantic model for MCP server configuration.""" command: str | None = None args: list[str] | None = None env: dict[str, str] | None = None headers: dict[str, str] | None = None ur...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/api/v2/schemas.py", "license": "MIT License", "lines": 11, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/base/langflow/services/auth/constants.py
"""Auth-related constants shared by service and utils (avoids circular imports).""" AUTO_LOGIN_WARNING = "In v2.0, LANGFLOW_SKIP_AUTH_AUTO_LOGIN will be removed. Please update your authentication method." AUTO_LOGIN_ERROR = ( "Since v1.5, LANGFLOW_AUTO_LOGIN requires a valid API key. " "Set LANGFLOW_SKIP_AUTH_...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/services/auth/constants.py", "license": "MIT License", "lines": 7, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/base/langflow/services/auth/exceptions.py
"""Framework-agnostic authentication exceptions.""" from __future__ import annotations class AuthenticationError(Exception): """Base exception for authentication failures.""" def __init__(self, message: str, *, error_code: str | None = None): self.message = message self.error_code = error_co...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/services/auth/exceptions.py", "license": "MIT License", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/tests/unit/services/auth/test_auth_service.py
from __future__ import annotations from datetime import datetime, timedelta, timezone from types import SimpleNamespace from unittest.mock import AsyncMock, patch from uuid import UUID, uuid4 import jwt import pytest from fastapi import HTTPException, status from langflow.services.auth.exceptions import ( Inactiv...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/services/auth/test_auth_service.py", "license": "MIT License", "lines": 342, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/services/auth/test_pluggable_auth.py
from __future__ import annotations from types import SimpleNamespace from unittest.mock import MagicMock, patch import pytest from langflow.services.auth import utils as auth_utils from langflow.services.base import Service from langflow.services.schema import ServiceType from lfx.services.manager import get_service_...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/services/auth/test_pluggable_auth.py", "license": "MIT License", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/lfx/src/lfx/services/auth/base.py
"""Abstract base class for authentication services. Defines the interface that all auth implementations must follow in the pluggable services architecture. LFX provides a minimal no-op implementation; full-featured implementations (JWT, OIDC, SAML) live in Langflow or plugins. """ from __future__ import annotations ...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/services/auth/base.py", "license": "MIT License", "lines": 190, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/lfx/src/lfx/services/auth/exceptions.py
"""Framework-agnostic authentication exceptions for LFX auth service. Shared exception types so that both minimal (LFX) and full (Langflow) auth implementations can raise the same errors. """ from __future__ import annotations class AuthenticationError(Exception): """Base exception for authentication failures."...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/services/auth/exceptions.py", "license": "MIT License", "lines": 35, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/lfx/src/lfx/services/auth/service.py
"""Default auth service for LFX (no database/JWT; use Langflow auth for full auth).""" from __future__ import annotations from collections.abc import Coroutine from typing import Any from uuid import UUID from lfx.log.logger import logger from lfx.services import register_service from lfx.services.auth.base import B...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/services/auth/service.py", "license": "MIT License", "lines": 129, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/tests/unit/components/llm_operations/test_guardrails_component.py
import os from unittest.mock import MagicMock, patch import pytest from lfx.components.llm_operations.guardrails import GuardrailsComponent from lfx.schema import Data from tests.base import ComponentTestBaseWithoutClient class TestGuardrailsComponent(ComponentTestBaseWithoutClient): @pytest.fixture def com...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/components/llm_operations/test_guardrails_component.py", "license": "MIT License", "lines": 541, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/lfx/src/lfx/components/llm_operations/guardrails.py
import re from typing import Any from lfx.base.models.unified_models import ( get_language_model_options, get_llm, update_model_options_in_build_config, ) from lfx.custom import Component from lfx.field_typing.range_spec import RangeSpec from lfx.io import BoolInput, ModelInput, MultilineInput, Multiselect...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/lfx/src/lfx/components/llm_operations/guardrails.py", "license": "MIT License", "lines": 530, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:scripts/ci/langflow_pre_release_tag.py
#!/usr/bin/env python3 import re import sys ARGUMENT_NUMBER = 3 def create_tag(package_version: str, latest_released_version: str | None) -> str: # normalize optional leading 'v' and whitespace pkg = package_version.strip().lstrip("v") latest = None if latest_released_version is not None: lr...
{ "repo_id": "langflow-ai/langflow", "file_path": "scripts/ci/langflow_pre_release_tag.py", "license": "MIT License", "lines": 29, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/base/langflow/agentic/flows/langflow_assistant.py
"""LangflowAssistant - AI-powered Langflow assistant. This flow provides an AI assistant that can both answer questions about Langflow AND generate custom components when explicitly requested. Usage: from langflow.agentic.flows.langflow_assistant import get_graph graph = get_graph(provider="Anthropic", model_...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/agentic/flows/langflow_assistant.py", "license": "MIT License", "lines": 154, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
langflow-ai/langflow:src/backend/base/langflow/agentic/flows/translation_flow.py
"""TranslationFlow - Language Detection, Translation, and Intent Classification. This flow translates user input to English and classifies intent as either 'generate_component' or 'question'. Usage: from langflow.agentic.flows.translation_flow import get_graph graph = await get_graph(provider="OpenAI", model_...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/agentic/flows/translation_flow.py", "license": "MIT License", "lines": 104, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/base/langflow/agentic/services/flow_types.py
"""Flow execution types and constants.""" from dataclasses import dataclass, field from pathlib import Path from typing import Any # Base path for flow files (JSON and Python) FLOWS_BASE_PATH = Path(__file__).parent.parent / "flows" # Streaming configuration STREAMING_QUEUE_MAX_SIZE = 1000 STREAMING_EVENT_TIMEOUT_SE...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/agentic/services/flow_types.py", "license": "MIT License", "lines": 38, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/base/langflow/agentic/services/helpers/event_consumer.py
"""Event consumption utilities for streaming flow execution.""" import asyncio import json from collections.abc import AsyncGenerator, Callable, Coroutine from typing import Any from lfx.log.logger import logger def parse_event_data(event_data: bytes) -> tuple[str | None, dict[str, Any]]: """Parse raw event byt...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/agentic/services/helpers/event_consumer.py", "license": "MIT License", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/base/langflow/agentic/services/helpers/flow_loader.py
"""Flow loading utilities. Supports loading graphs from both Python (.py) and JSON (.json) flow files. When both exist, .py takes priority for gradual migration. """ import importlib.util import inspect import json import sys from contextlib import contextmanager from pathlib import Path from typing import TYPE_CHECK...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/agentic/services/helpers/flow_loader.py", "license": "MIT License", "lines": 172, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
langflow-ai/langflow:src/backend/base/langflow/agentic/services/helpers/intent_classification.py
"""Intent classification for assistant requests.""" import json from lfx.log.logger import logger from langflow.agentic.services.flow_executor import ( execute_flow_file, extract_response_text, ) from langflow.agentic.services.flow_types import ( TRANSLATION_FLOW, IntentResult, ) async def classify...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/base/langflow/agentic/services/helpers/intent_classification.py", "license": "MIT License", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
langflow-ai/langflow:src/backend/tests/unit/agentic/flows/test_langflow_assistant.py
"""Tests for LangflowAssistant flow. Tests the graph construction and model configuration for the assistant flow. """ from unittest.mock import MagicMock, patch from langflow.agentic.flows.langflow_assistant import ( ASSISTANT_PROMPT, _build_model_config, get_graph, ) class TestBuildModelConfig: ""...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/agentic/flows/test_langflow_assistant.py", "license": "MIT License", "lines": 217, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/agentic/flows/test_translation_flow.py
"""Tests for TranslationFlow. Tests the graph construction and model configuration for the translation flow. """ from unittest.mock import MagicMock, patch from langflow.agentic.flows.translation_flow import ( TRANSLATION_PROMPT, _build_model_config, get_graph, ) class TestBuildModelConfig: """Test...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/agentic/flows/test_translation_flow.py", "license": "MIT License", "lines": 212, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/agentic/services/helpers/test_event_consumer.py
"""Tests for event consumer utilities. Tests the streaming event consumption and parsing functionality. """ import asyncio import pytest from langflow.agentic.services.helpers.event_consumer import ( consume_streaming_events, parse_event_data, ) class TestParseEventData: """Tests for parse_event_data f...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/agentic/services/helpers/test_event_consumer.py", "license": "MIT License", "lines": 190, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/agentic/services/helpers/test_flow_loader.py
"""Tests for flow loader utilities. Tests the flow path resolution, path traversal validation, and Python/JSON flow loading functionality. """ import sys from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch import pytest from fastapi import HTTPException from langflow.agentic.services.helpe...
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/agentic/services/helpers/test_flow_loader.py", "license": "MIT License", "lines": 333, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
langflow-ai/langflow:src/backend/tests/unit/agentic/services/helpers/test_intent_classification.py
"""Tests for intent classification helper. Tests the classify_intent function that translates text and classifies user intent as component generation or question. """ from unittest.mock import AsyncMock, patch import pytest from langflow.agentic.services.flow_types import IntentResult from langflow.agentic.services....
{ "repo_id": "langflow-ai/langflow", "file_path": "src/backend/tests/unit/agentic/services/helpers/test_intent_classification.py", "license": "MIT License", "lines": 183, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test