sample_id stringlengths 21 196 | text stringlengths 105 936k | metadata dict | category stringclasses 6
values |
|---|---|---|---|
langflow-ai/langflow:src/backend/tests/unit/test_simple_agent_in_lfx_run.py | """Tests for the simple agent workflow that can be executed via `lfx run`.
This module tests the agent workflow by:
1. Creating and validating the agent script
2. Testing component instantiation and configuration
3. Testing direct graph execution without CLI
4. Verifying the workflow works with langflow's dependencies... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/backend/tests/unit/test_simple_agent_in_lfx_run.py",
"license": "MIT License",
"lines": 299,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/src/lfx/__main__.py | """LFX CLI entry point."""
import typer
app = typer.Typer(
name="lfx",
help="lfx - Langflow Executor",
add_completion=False,
)
@app.command(name="serve", help="Serve a flow as an API", no_args_is_help=True)
def serve_command_wrapper(
script_path: str | None = typer.Argument(
None,
he... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/__main__.py",
"license": "MIT License",
"lines": 140,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/base/data/utils.py | import contextlib
import tempfile
import unicodedata
from collections.abc import Callable
from concurrent import futures
from io import BytesIO
from pathlib import Path
import chardet
import orjson
import yaml
from defusedxml import ElementTree
from pypdf import PdfReader
from lfx.base.data.storage_utils import read_... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/base/data/utils.py",
"license": "MIT License",
"lines": 277,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/base/io/chat.py | from lfx.custom.custom_component.component import Component
def _extract_model_name(value):
"""Extract model name from ModelInput format (list of dicts with 'name' key)."""
if isinstance(value, str):
return value
if isinstance(value, list) and value and isinstance(value[0], dict):
return v... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/base/io/chat.py",
"license": "MIT License",
"lines": 31,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/base/io/text.py | from lfx.custom.custom_component.component import Component
class TextComponent(Component):
display_name = "Text Component"
description = "Used to pass text to the next component."
def build_config(self):
return {
"input_value": {
"display_name": "Value",
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/base/io/text.py",
"license": "MIT License",
"lines": 19,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/base/models/openai_constants.py | from .model_metadata import create_model_metadata
# Unified model metadata - single source of truth
OPENAI_MODELS_DETAILED = [
# GPT-5 Series
create_model_metadata(
provider="OpenAI",
name="gpt-5.2",
icon="OpenAI",
tool_calling=True,
reasoning=True,
),
create_mod... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/base/models/openai_constants.py",
"license": "MIT License",
"lines": 141,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/base/prompts/api_utils.py | from collections import defaultdict
from typing import Any
from fastapi import HTTPException
from langchain_core.prompts import PromptTemplate
from langchain_core.prompts.string import mustache_template_vars
from lfx.inputs.inputs import DefaultPromptField
from lfx.interface.utils import extract_input_variables_from_... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/base/prompts/api_utils.py",
"license": "MIT License",
"lines": 208,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/cli/commands.py | """CLI commands for LFX."""
from __future__ import annotations
import json
import os
import sys
import tempfile
from functools import partial
from pathlib import Path
import typer
import uvicorn
from asyncer import syncify
from dotenv import load_dotenv
from rich.console import Console
from rich.panel import Panel
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/cli/commands.py",
"license": "MIT License",
"lines": 281,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/cli/run.py | """CLI wrapper for the run command."""
import json
from functools import partial
from pathlib import Path
import typer
from asyncer import syncify
from lfx.run.base import RunError, run_flow
# Verbosity level constants
VERBOSITY_DETAILED = 2
VERBOSITY_FULL = 3
def _check_langchain_version_compatibility(error_mess... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/cli/run.py",
"license": "MIT License",
"lines": 146,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/cli/script_loader.py | """Script loading utilities for LFX CLI.
This module provides functionality to load and validate Python scripts
containing LFX graph variables.
"""
import ast
import importlib.util
import inspect
import json
import sys
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING, An... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/cli/script_loader.py",
"license": "MIT License",
"lines": 249,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/cli/serve_app.py | """FastAPI application factory for serving **multiple** LFX graphs at once.
This module is used by the CLI *serve* command when the provided path is a
folder containing multiple ``*.json`` flow files. Each flow is exposed under
its own router prefix::
/flows/{flow_id}/run - POST - execute the flow
/flows/{f... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/cli/serve_app.py",
"license": "MIT License",
"lines": 447,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/cli/validation.py | """Validation utilities for CLI commands."""
import re
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from lfx.graph.graph.base import Graph
def is_valid_env_var_name(name: str) -> bool:
"""Check if a string is a valid environment variable name.
Environment variable names should:
- Start with a... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/cli/validation.py",
"license": "MIT License",
"lines": 53,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/components/composio/slack_composio.py | from lfx.base.composio.composio_base import ComposioBaseComponent
class ComposioSlackAPIComponent(ComposioBaseComponent):
display_name: str = "Slack"
icon = "SlackComposio"
documentation: str = "https://docs.composio.dev"
app_name = "slack"
def set_default_tools(self):
"""Set the default ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/components/composio/slack_composio.py",
"license": "MIT License",
"lines": 8,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/components/datastax/astradb_graph.py | import orjson
from lfx.base.datastax.astradb_base import AstraDBBaseComponent
from lfx.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store
from lfx.helpers.data import docs_to_data
from lfx.inputs.inputs import (
DictInput,
DropdownInput,
FloatInput,
IntInput,
StrInput,... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/components/datastax/astradb_graph.py",
"license": "MIT License",
"lines": 189,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/components/processing/converter.py | import json
from typing import Any
from lfx.custom import Component
from lfx.io import BoolInput, HandleInput, Output, TabInput
from lfx.schema import Data, DataFrame, Message
MIN_CSV_LINES = 2
def convert_to_message(v) -> Message:
"""Convert input to Message type.
Args:
v: Input to convert (Messag... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/components/processing/converter.py",
"license": "MIT License",
"lines": 195,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/components/weaviate/weaviate.py | import weaviate
from langchain_community.vectorstores import Weaviate
from lfx.base.vectorstores.model import LCVectorStoreComponent, check_cached_vector_store
from lfx.helpers.data import docs_to_data
from lfx.io import BoolInput, HandleInput, IntInput, SecretStrInput, StrInput
from lfx.schema.data import Data
clas... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/components/weaviate/weaviate.py",
"license": "MIT License",
"lines": 76,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/custom/custom_component/component.py | from __future__ import annotations
import ast
import asyncio
import inspect
from collections.abc import AsyncIterator, Iterator
from copy import deepcopy
from textwrap import dedent
from typing import TYPE_CHECKING, Any, ClassVar, NamedTuple, get_type_hints
from uuid import UUID
import nanoid
import pandas as pd
impo... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/custom/custom_component/component.py",
"license": "MIT License",
"lines": 1711,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/custom/custom_component/component_with_cache.py | from lfx.custom.custom_component.component import Component
from lfx.services.deps import get_shared_component_cache_service
class ComponentWithCache(Component):
def __init__(self, **data) -> None:
super().__init__(**data)
self._shared_component_cache = get_shared_component_cache_service()
| {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/custom/custom_component/component_with_cache.py",
"license": "MIT License",
"lines": 6,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/custom/custom_component/custom_component.py | from __future__ import annotations
import uuid
from collections.abc import Callable, Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar
import yaml
from cachetools import TTLCache
from langchain_core.documents import Document
from pydantic import BaseModel
from lfx.custom import valida... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/custom/custom_component/custom_component.py",
"license": "MIT License",
"lines": 540,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/custom/validate.py | import ast
import contextlib
import importlib
import warnings
from types import FunctionType
from typing import Optional, Union
from langchain_core._api.deprecation import LangChainDeprecationWarning
from pydantic import ValidationError
from lfx.field_typing.constants import CUSTOM_COMPONENT_SUPPORTED_TYPES, DEFAULT_... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/custom/validate.py",
"license": "MIT License",
"lines": 404,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/events/event_manager.py | from __future__ import annotations
import inspect
import json
import time
import uuid
from functools import partial
from typing import TYPE_CHECKING
from fastapi.encoders import jsonable_encoder
from typing_extensions import Protocol
from lfx.log.logger import logger
if TYPE_CHECKING:
# Lightweight type stub fo... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/events/event_manager.py",
"license": "MIT License",
"lines": 95,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/exceptions/component.py | from lfx.schema.properties import Source
class ComponentBuildError(Exception):
def __init__(self, message: str, formatted_traceback: str):
self.message = message
self.formatted_traceback = formatted_traceback
super().__init__(message)
class StreamingError(Exception):
def __init__(sel... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/exceptions/component.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/lfx/src/lfx/field_typing/constants.py | """Constants for field typing used throughout lfx package."""
import importlib.util
from collections.abc import Callable
from typing import Text, TypeAlias, TypeVar
# Safe imports that don't create circular dependencies
try:
from langchain.agents.agent import AgentExecutor
from langchain.chains.base import Ch... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/field_typing/constants.py",
"license": "MIT License",
"lines": 176,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/graph/utils.py | from __future__ import annotations
from collections.abc import Generator
from enum import Enum
from typing import TYPE_CHECKING, Any
from uuid import UUID
from lfx.interface.utils import extract_input_variables_from_prompt
from lfx.log.logger import logger
from lfx.schema.data import Data
from lfx.schema.message impo... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/graph/utils.py",
"license": "MIT License",
"lines": 332,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/helpers/base_model.py | from typing import Any, TypedDict
from pydantic import BaseModel as PydanticBaseModel
from pydantic import ConfigDict, Field, create_model
TRUE_VALUES = ["true", "1", "t", "y", "yes"]
class SchemaField(TypedDict):
name: str
type: str
description: str
multiple: bool
class BaseModel(PydanticBaseMode... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/helpers/base_model.py",
"license": "MIT License",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/helpers/custom.py | from typing import Any
def format_type(type_: Any) -> str:
if type_ is str:
type_ = "Text"
elif hasattr(type_, "__name__"):
type_ = type_.__name__
elif hasattr(type_, "__class__"):
type_ = type_.__class__.__name__
else:
type_ = str(type_)
return type_
| {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/helpers/custom.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/lfx/src/lfx/helpers/data.py | import re
from collections import defaultdict
from typing import Any
import orjson
from fastapi.encoders import jsonable_encoder
from langchain_core.documents import Document
from lfx.schema.data import Data
from lfx.schema.dataframe import DataFrame
from lfx.schema.message import Message
def docs_to_data(documents... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/helpers/data.py",
"license": "MIT License",
"lines": 126,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/helpers/flow.py | """Flow helper functions for lfx package."""
from __future__ import annotations
from typing import TYPE_CHECKING
from uuid import UUID
from pydantic import BaseModel, Field, create_model
from lfx.log.logger import logger
from lfx.schema.schema import INPUT_FIELD_NAME
if TYPE_CHECKING:
from lfx.graph.graph.base... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/helpers/flow.py",
"license": "MIT License",
"lines": 243,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/inputs/input_mixin.py | from enum import Enum
from typing import Annotated, Any
from pydantic import (
BaseModel,
ConfigDict,
Field,
PlainSerializer,
field_validator,
model_serializer,
)
from lfx.field_typing.range_spec import RangeSpec
from lfx.inputs.validators import CoalesceBool
from lfx.schema.cross_module impor... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/inputs/input_mixin.py",
"license": "MIT License",
"lines": 317,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/inputs/inputs.py | import warnings
from collections.abc import AsyncIterator, Iterator
from typing import Any, TypeAlias, get_args
from pandas import DataFrame
from pydantic import Field, field_validator, model_validator
from lfx.inputs.validators import CoalesceBool
from lfx.schema.data import Data
from lfx.schema.message import Messa... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/inputs/inputs.py",
"license": "MIT License",
"lines": 708,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/inputs/validators.py | from typing import Annotated
from pydantic import PlainValidator
def validate_boolean(value: bool) -> bool: # noqa: FBT001
valid_trues = ["True", "true", "1", "yes"]
valid_falses = ["False", "false", "0", "no"]
if value in valid_trues:
return True
if value in valid_falses:
return Fal... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/inputs/validators.py",
"license": "MIT License",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/interface/components.py | import asyncio
import hashlib
import importlib
import inspect
import json
import os
import pkgutil
import time
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional
import orjson
from lfx.constants import BASE_COMPONENTS_PATH
from lfx.custom.utils import abuild_custom_components, create_component_t... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/interface/components.py",
"license": "MIT License",
"lines": 732,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/interface/importing/utils.py | # This module is used to import any langchain class by name.
import importlib
from typing import Any
def import_module(module_path: str) -> Any:
"""Import module from module path."""
if "from" not in module_path:
# Import the module using the module path
import warnings
with warnings... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/interface/importing/utils.py",
"license": "MIT License",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/interface/initialize/loading.py | from __future__ import annotations
import inspect
import os
import warnings
from typing import TYPE_CHECKING, Any
import orjson
from pydantic import PydanticDeprecatedSince20
from lfx.custom.eval import eval_custom_component_code
from lfx.log.logger import logger
from lfx.schema.artifact import get_artifact_type, po... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/interface/initialize/loading.py",
"license": "MIT License",
"lines": 292,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/interface/listing.py | from typing_extensions import override
from lfx.services.deps import get_settings_service
from lfx.utils.lazy_load import LazyLoadDictBase
class AllTypesDict(LazyLoadDictBase):
def __init__(self) -> None:
self._all_types_dict = None
def _build_dict(self):
langchain_types_dict = self.get_type... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/interface/listing.py",
"license": "MIT License",
"lines": 18,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/interface/run.py | def get_memory_key(langchain_object):
"""Get the memory key from the LangChain object's memory attribute.
Given a LangChain object, this function retrieves the current memory key from the object's memory attribute.
It then checks if the key exists in a dictionary of known memory keys and returns the corres... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/interface/run.py",
"license": "MIT License",
"lines": 15,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/interface/utils.py | import base64
import json
import os
from io import BytesIO
from pathlib import Path
from string import Formatter
import yaml
from langchain_core.language_models import BaseLanguageModel
from PIL.Image import Image
from lfx.log.logger import logger
from lfx.services.chat.config import ChatConfig
from lfx.services.deps... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/interface/utils.py",
"license": "MIT License",
"lines": 88,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/io/schema.py | from types import UnionType
from typing import Any, Literal, Union, get_args, get_origin
from pydantic import BaseModel, Field, create_model
from lfx.inputs.input_mixin import FieldTypes
from lfx.inputs.inputs import (
BoolInput,
DictInput,
DropdownInput,
FloatInput,
InputTypes,
IntInput,
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/io/schema.py",
"license": "MIT License",
"lines": 268,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/memory/stubs.py | """Memory management functions for lfx package.
This module provides message storage and retrieval functionality adapted for lfx's
service-based architecture. It mirrors the langflow.memory API but works with
lfx's Message model and service interfaces.
"""
from uuid import UUID
from lfx.log.logger import logger
from... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/memory/stubs.py",
"license": "MIT License",
"lines": 242,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/processing/process.py | from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any, cast
from json_repair import repair_json
from pydantic import BaseModel
from lfx.graph.vertex.base import Vertex
from lfx.log.logger import logger
from lfx.schema.graph import InputValue, Tweaks
from lfx.schema.schema import INPUT_... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/processing/process.py",
"license": "MIT License",
"lines": 216,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/artifact.py | from collections.abc import Generator
from enum import Enum
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel
from lfx.log.logger import logger
from lfx.schema.data import Data
from lfx.schema.dataframe import DataFrame
from lfx.schema.encoders import CUSTOM_ENCODERS
from lfx.schema.message... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/artifact.py",
"license": "MIT License",
"lines": 68,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/schema/content_block.py | from typing import Annotated
from pydantic import BaseModel, Discriminator, Field, Tag, field_serializer, field_validator
from typing_extensions import TypedDict
from .content_types import CodeContent, ErrorContent, JSONContent, MediaContent, TextContent, ToolContent
def _get_type(d: dict | BaseModel) -> str | None... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/content_block.py",
"license": "MIT License",
"lines": 48,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/schema/content_types.py | from typing import Any, Literal
from fastapi.encoders import jsonable_encoder
from pydantic import BaseModel, ConfigDict, Field, model_serializer
from typing_extensions import TypedDict
from lfx.schema.encoders import CUSTOM_ENCODERS
class HeaderDict(TypedDict, total=False):
title: str | None
icon: str | No... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/content_types.py",
"license": "MIT License",
"lines": 62,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/schema/data.py | """Lightweight Data class for lfx package - contains only methods with no langflow dependencies."""
from __future__ import annotations
import copy
import json
from datetime import datetime, timezone
from decimal import Decimal
from typing import TYPE_CHECKING, cast
from uuid import UUID
from langchain_core.documents... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/data.py",
"license": "MIT License",
"lines": 250,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/dataframe.py | from typing import TYPE_CHECKING, cast
import pandas as pd
from langchain_core.documents import Document
from pandas import DataFrame as pandas_DataFrame
from lfx.schema.data import Data
if TYPE_CHECKING:
from lfx.schema.message import Message
class DataFrame(pandas_DataFrame):
"""A pandas DataFrame subcla... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/dataframe.py",
"license": "MIT License",
"lines": 201,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/dotdict.py | """Dot-notation dictionary implementation copied from langflow for lfx package."""
class dotdict(dict): # noqa: N801
"""dotdict allows accessing dictionary elements using dot notation (e.g., dict.key instead of dict['key']).
It automatically converts nested dictionaries into dotdict instances, enabling dot ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/dotdict.py",
"license": "MIT License",
"lines": 58,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/schema/encoders.py | from collections.abc import Callable
from datetime import datetime
def encode_callable(obj: Callable):
return obj.__name__ if hasattr(obj, "__name__") else str(obj)
def encode_datetime(obj: datetime):
return obj.strftime("%Y-%m-%d %H:%M:%S %Z")
CUSTOM_ENCODERS = {Callable: encode_callable, datetime: encod... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/encoders.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/lfx/src/lfx/schema/graph.py | from typing import Any
from pydantic import BaseModel, Field, RootModel
from lfx.schema.schema import InputType
class InputValue(BaseModel):
components: list[str] | None = []
input_value: str | None = None
type: InputType | None = Field(
"any",
description="Defines on which components th... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/graph.py",
"license": "MIT License",
"lines": 37,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/schema/image.py | import base64
from pathlib import Path
import aiofiles
from PIL import Image as PILImage
from platformdirs import user_cache_dir
from pydantic import BaseModel
from lfx.services.deps import get_storage_service
from lfx.utils.image import create_image_content_dict
IMAGE_ENDPOINT = "/files/images/"
def is_image_file... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/image.py",
"license": "MIT License",
"lines": 155,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/json_schema.py | """JSON Schema utilities for LFX."""
from typing import Any
from pydantic import AliasChoices, BaseModel, Field, create_model
from lfx.log.logger import logger
NULLABLE_TYPE_LENGTH = 2 # Number of types in a nullable union (the type itself + null)
def _snake_to_camel(name: str) -> str:
"""Convert snake_case ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/json_schema.py",
"license": "MIT License",
"lines": 151,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/log.py | """Log schema and types for lfx package."""
from typing import Any, Literal, TypeAlias
from pydantic import BaseModel, field_serializer
from pydantic_core import PydanticSerializationError
from typing_extensions import Protocol
from lfx.schema.message import ContentBlock, Message
from lfx.serialization.serialization... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/log.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/lfx/src/lfx/schema/message.py | from __future__ import annotations
import asyncio
import json
import re
import traceback
from collections.abc import AsyncIterator, Iterator
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Annotated, Any, Literal
from uuid import UUID
from fastapi.encoders import jsonable_encoder
from langch... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/message.py",
"license": "MIT License",
"lines": 507,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/properties.py | """Properties and Source schema classes copied from langflow for lfx package."""
from typing import Literal
from pydantic import BaseModel, Field, field_serializer, field_validator
class Source(BaseModel):
id: str | None = Field(default=None, description="The id of the source component.")
display_name: str ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/properties.py",
"license": "MIT License",
"lines": 40,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/schema/schema.py | from collections.abc import Generator
from enum import Enum
from typing import TYPE_CHECKING, Literal
from pandas import Series
from pydantic import BaseModel, ConfigDict, Field
from typing_extensions import TypedDict
if TYPE_CHECKING:
from lfx.custom.custom_component.component import Component
INPUT_FIELD_NAME ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/schema.py",
"license": "MIT License",
"lines": 137,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/table.py | from enum import Enum
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
VALID_TYPES = [
"date",
"number",
"text",
"json",
"integer",
"int",
"float",
"str",
"string",
"boolean",
]
class FormatterType(str, Enum):
date = "date"
text = "t... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/table.py",
"license": "MIT License",
"lines": 121,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/schema/validators.py | from datetime import datetime, timezone
from uuid import UUID
from pydantic import BeforeValidator
def timestamp_to_str(timestamp: datetime | str) -> str:
"""Convert timestamp to standardized string format.
Handles multiple input formats and ensures consistent UTC timezone output.
Args:
timesta... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/schema/validators.py",
"license": "MIT License",
"lines": 99,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/serialization/serialization.py | from collections.abc import AsyncIterator, Generator, Iterator
from datetime import datetime, timezone
from decimal import Decimal
from typing import Any, cast
from uuid import UUID
import numpy as np
import pandas as pd
from langchain_core.documents import Document
from pydantic import BaseModel
from pydantic.v1 impo... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/serialization/serialization.py",
"license": "MIT License",
"lines": 248,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/base.py | """Base service classes for lfx package."""
from abc import ABC, abstractmethod
class Service(ABC):
"""Base service class."""
def __init__(self):
self._ready = False
@property
@abstractmethod
def name(self) -> str:
"""Service name."""
def set_ready(self) -> None:
""... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/base.py",
"license": "MIT License",
"lines": 20,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/cache/base.py | import abc
import asyncio
import threading
from typing import Generic, TypeVar
from lfx.services.interfaces import CacheServiceProtocol
LockType = TypeVar("LockType", bound=threading.Lock)
AsyncLockType = TypeVar("AsyncLockType", bound=asyncio.Lock)
class CacheService(CacheServiceProtocol, Generic[LockType]):
"... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/cache/base.py",
"license": "MIT License",
"lines": 135,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/services/cache/service.py | """Cache service implementations for lfx."""
import pickle
import threading
import time
from collections import OrderedDict
from typing import Generic, Union
from lfx.services.cache.base import CacheService, LockType
from lfx.services.cache.utils import CACHE_MISS
class ThreadingInMemoryCache(CacheService, Generic[... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/cache/service.py",
"license": "MIT License",
"lines": 130,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/services/cache/utils.py | import base64
import contextlib
import hashlib
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING, Any
from fastapi import UploadFile
from platformdirs import user_cache_dir
if TYPE_CHECKING:
from lfx.schema.schema import BuildStatus
CACHE: dict[str, Any] = {}
CACHE_DIR = user_cache_dir("... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/cache/utils.py",
"license": "MIT License",
"lines": 124,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/chat/schema.py | import asyncio
from typing import Any, Protocol
class GetCache(Protocol):
async def __call__(self, key: str, lock: asyncio.Lock | None = None) -> Any: ...
class SetCache(Protocol):
async def __call__(self, key: str, data: Any, lock: asyncio.Lock | None = None) -> bool: ...
| {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/chat/schema.py",
"license": "MIT License",
"lines": 6,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/deps.py | """Service dependency functions for lfx package."""
from __future__ import annotations
from contextlib import asynccontextmanager, suppress
from typing import TYPE_CHECKING
from fastapi import HTTPException
from sqlalchemy.exc import InvalidRequestError
from lfx.log.logger import logger
from lfx.services.schema imp... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/deps.py",
"license": "MIT License",
"lines": 152,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/factory.py | """Base service factory classes for lfx package."""
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from lfx.services.base import Service
class ServiceFactory(ABC):
"""Base service factory class."""
def __init__(self):
self.service_class = None
sel... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/factory.py",
"license": "MIT License",
"lines": 13,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/initialize.py | """Initialize services for lfx package."""
from lfx.services.settings.factory import SettingsServiceFactory
def initialize_services():
"""Initialize required services for lfx."""
from lfx.services.manager import get_service_manager
# Register the settings service factory
service_manager = get_servic... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/initialize.py",
"license": "MIT License",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/interfaces.py | """Service interface protocols for lfx package."""
from __future__ import annotations
from abc import abstractmethod
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
if TYPE_CHECKING:
import asyncio
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from lfx.ser... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/interfaces.py",
"license": "MIT License",
"lines": 155,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/manager.py | """ServiceManager with pluggable service discovery.
Supports multiple discovery mechanisms:
1. Decorator-based registration (@register_service)
2. Config file (lfx.toml / pyproject.toml)
3. Entry points (Python packages)
4. Fallback to noop/minimal implementations
"""
from __future__ import annotations
import asynci... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/manager.py",
"license": "MIT License",
"lines": 389,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/schema.py | """Service schema definitions for lfx package."""
from enum import Enum
class ServiceType(str, Enum):
AUTH_SERVICE = "auth_service"
DATABASE_SERVICE = "database_service"
STORAGE_SERVICE = "storage_service"
SETTINGS_SERVICE = "settings_service"
VARIABLE_SERVICE = "variable_service"
CACHE_SERVI... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/schema.py",
"license": "MIT License",
"lines": 20,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/session.py | """Lightweight session implementations for lfx package."""
class NoopSession:
"""No-operation session that implements the database session interface.
This provides a complete database session API but all operations are no-ops.
Perfect for testing or when no real database is available.
"""
class ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/session.py",
"license": "MIT License",
"lines": 62,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/settings/base.py | import asyncio
import contextlib
import json
import os
from pathlib import Path
from shutil import copy2
from typing import Any, Literal
import orjson
import yaml
from aiofile import async_open
from pydantic import Field, field_validator
from pydantic.fields import FieldInfo
from pydantic_settings import BaseSettings,... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/settings/base.py",
"license": "MIT License",
"lines": 565,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/settings/factory.py | from typing_extensions import override
from lfx.services.factory import ServiceFactory
from lfx.services.settings.service import SettingsService
class SettingsServiceFactory(ServiceFactory):
_instance = None
def __new__(cls):
if cls._instance is None:
cls._instance = super().__new__(cls)... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/settings/factory.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/lfx/src/lfx/services/settings/feature_flags.py | from pydantic_settings import BaseSettings
class FeatureFlags(BaseSettings):
mvp_components: bool = False
class Config:
env_prefix = "LANGFLOW_FEATURE_"
FEATURE_FLAGS = FeatureFlags()
| {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/settings/feature_flags.py",
"license": "MIT License",
"lines": 6,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/settings/service.py | from __future__ import annotations
from lfx.services.base import Service
from lfx.services.settings.auth import AuthSettings
from lfx.services.settings.base import Settings
class SettingsService(Service):
name = "settings_service"
def __init__(self, settings: Settings, auth_settings: AuthSettings):
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/settings/service.py",
"license": "MIT License",
"lines": 26,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/services/shared_component_cache/factory.py | """Factory for creating shared component cache service."""
from typing import TYPE_CHECKING
from lfx.services.factory import ServiceFactory
from lfx.services.shared_component_cache.service import SharedComponentCacheService
if TYPE_CHECKING:
from lfx.services.base import Service
class SharedComponentCacheServi... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/shared_component_cache/factory.py",
"license": "MIT License",
"lines": 21,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/services/shared_component_cache/service.py | """Shared component cache service implementation."""
from lfx.services.cache.service import ThreadingInMemoryCache
class SharedComponentCacheService(ThreadingInMemoryCache):
"""A caching service shared across components."""
name = "shared_component_cache_service"
| {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/shared_component_cache/service.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/lfx/src/lfx/services/storage/local.py | """Local file-based storage service for lfx package."""
from __future__ import annotations
from typing import TYPE_CHECKING
import aiofiles
from lfx.log.logger import logger
from lfx.services.base import Service
from lfx.services.storage.service import StorageService
if TYPE_CHECKING:
from langflow.services.se... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/storage/local.py",
"license": "MIT License",
"lines": 176,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/services/storage/service.py | from __future__ import annotations
from abc import abstractmethod
from typing import TYPE_CHECKING
import anyio
from lfx.services.base import Service
if TYPE_CHECKING:
from collections.abc import AsyncIterator
from lfx.services.settings.service import SettingsService
class StorageService(Service):
""... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/storage/service.py",
"license": "MIT License",
"lines": 145,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/services/tracing/service.py | """Lightweight tracing service for LFX package."""
# ruff: noqa: ARG002
from __future__ import annotations
from contextlib import asynccontextmanager
from typing import TYPE_CHECKING, Any
from lfx.log.logger import logger
from lfx.services.tracing.base import BaseTracingService
if TYPE_CHECKING:
from uuid impor... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/services/tracing/service.py",
"license": "MIT License",
"lines": 107,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/template/field/base.py | from collections.abc import Callable
from enum import Enum
from typing import ( # type: ignore[attr-defined]
Any,
GenericAlias, # type: ignore[attr-defined]
_GenericAlias, # type: ignore[attr-defined]
_UnionGenericAlias, # type: ignore[attr-defined]
)
from pydantic import (
BaseModel,
Confi... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/template/field/base.py",
"license": "MIT License",
"lines": 199,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/template/field/prompt.py | # This file provides backwards compatibility for prompt field constants
from lfx.template.field.base import Input
# Default input types for prompt fields
DEFAULT_PROMPT_INTUT_TYPES = ["Message"]
class DefaultPromptField(Input):
"""Default prompt field for backwards compatibility."""
field_type: str = "str"
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/template/field/prompt.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/lfx/src/lfx/template/utils.py | # mypy: ignore-errors
from pathlib import Path
from platformdirs import user_cache_dir
from lfx.schema.data import Data
def raw_frontend_data_is_valid(raw_frontend_data):
"""Check if the raw frontend data is valid for processing."""
return "template" in raw_frontend_data and "display_name" in raw_frontend_... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/template/utils.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/lfx/src/lfx/utils/component_utils.py | from collections.abc import Callable
from typing import Any
from lfx.schema.dotdict import dotdict
DEFAULT_FIELDS = ["code", "_type"]
def update_fields(build_config: dotdict, fields: dict[str, Any]) -> dotdict:
"""Update specified fields in build_config with new values."""
for key, value in fields.items():
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/component_utils.py",
"license": "MIT License",
"lines": 126,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/utils/connection_string_parser.py | """Connection string parser utilities for lfx package."""
from urllib.parse import quote
def transform_connection_string(connection_string) -> str:
"""Transform connection string by encoding the password part."""
auth_part, db_url_name = connection_string.rsplit("@", 1)
protocol_user, password_string = a... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/connection_string_parser.py",
"license": "MIT License",
"lines": 8,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/utils/constants.py | from typing import Any
OPENAI_MODELS = [
"text-davinci-003",
"text-davinci-002",
"text-curie-001",
"text-babbage-001",
"text-ada-001",
]
CHAT_OPENAI_MODELS = [
"gpt-4o",
"gpt-4o-mini",
"gpt-4-turbo-preview",
"gpt-4-0125-preview",
"gpt-4-1106-preview",
"gpt-4-vision-preview",... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/constants.py",
"license": "MIT License",
"lines": 225,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/utils/data_structure.py | import json
from collections import Counter
from typing import Any
from lfx.schema.data import Data
def infer_list_type(items: list, max_samples: int = 5) -> str:
"""Infer the type of a list by sampling its items.
Handles mixed types and provides more detailed type information.
"""
if not items:
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/data_structure.py",
"license": "MIT License",
"lines": 182,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/utils/helpers.py | """Helper utility functions for lfx package."""
from __future__ import annotations
import mimetypes
from typing import TYPE_CHECKING
from lfx.utils.constants import EXTENSION_TO_CONTENT_TYPE
if TYPE_CHECKING:
from pathlib import Path
def get_mime_type(file_path: str | Path) -> str:
"""Get the MIME type of... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/helpers.py",
"license": "MIT License",
"lines": 23,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/utils/image.py | """Image utility functions for lfx package."""
from __future__ import annotations
import base64
from functools import lru_cache
from pathlib import Path
from lfx.log import logger
from lfx.services.deps import get_storage_service
from lfx.utils.async_helpers import run_until_complete
from lfx.utils.helpers import ge... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/image.py",
"license": "MIT License",
"lines": 72,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/src/lfx/utils/lazy_load.py | class LazyLoadDictBase:
def __init__(self) -> None:
self._all_types_dict = None
@property
def all_types_dict(self):
if self._all_types_dict is None:
self._all_types_dict = self._build_dict()
return self._all_types_dict
def _build_dict(self):
raise NotImpleme... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/lazy_load.py",
"license": "MIT License",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/utils/request_utils.py | from lfx.services.deps import get_settings_service
DEFAULT_USER_AGENT = "Langflow"
def get_user_agent():
"""Get user agent with fallback."""
try:
settings_service = get_settings_service()
if (
settings_service
and hasattr(settings_service, "settings")
and h... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/request_utils.py",
"license": "MIT License",
"lines": 15,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
langflow-ai/langflow:src/lfx/src/lfx/utils/schemas.py | import enum
from langchain_core.messages import BaseMessage
from pydantic import BaseModel, field_validator, model_validator
from typing_extensions import TypedDict
from .constants import MESSAGE_SENDER_AI, MESSAGE_SENDER_NAME_AI
# File types moved from lfx.base.data.utils
TEXT_FILE_TYPES = [
"txt",
"md",
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/schemas.py",
"license": "MIT License",
"lines": 116,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
langflow-ai/langflow:src/lfx/src/lfx/utils/version.py | """Version utilities for lfx package."""
def get_version_info():
"""Get version information for compatibility.
This is a stub implementation for lfx package.
"""
return {"version": "0.1.0", "package": "lfx"}
def is_pre_release(version: str) -> bool:
"""Check if a version is a pre-release.
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/src/lfx/utils/version.py",
"license": "MIT License",
"lines": 17,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
langflow-ai/langflow:src/lfx/tests/data/complex_chat_flow.py | """A complex chat flow example with multiple chained components.
This script demonstrates a more complex conversational flow using multiple
components chained together.
Features:
- ChatInput -> TextInput -> TextOutput -> ChatOutput chain
- Tests graph loading with multiple component types
- Verifies chained connectio... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/complex_chat_flow.py",
"license": "MIT License",
"lines": 23,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/data/component.py | import random
from lfx.custom import CustomComponent
class TestComponent(CustomComponent):
def refresh_values(self):
# This is a function that will be called every time the component is updated
# and should return a list of random strings
return [f"Random {random.randint(1, 100)}" for _ i... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/component.py",
"license": "MIT License",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/data/component_multiple_outputs.py | from lfx.custom import Component
from lfx.inputs.inputs import IntInput, MessageTextInput
from lfx.template.field.base import Output
class MultipleOutputsComponent(Component):
inputs = [
MessageTextInput(display_name="Input", name="input"),
IntInput(display_name="Number", name="number"),
]
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/component_multiple_outputs.py",
"license": "MIT License",
"lines": 16,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/data/component_nested_call.py | from random import randint
from lfx.custom import Component
from lfx.inputs.inputs import IntInput, MessageTextInput
from lfx.template.field.base import Output
class MultipleOutputsComponent(Component):
inputs = [
MessageTextInput(display_name="Input", name="input"),
IntInput(display_name="Number... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/component_nested_call.py",
"license": "MIT License",
"lines": 17,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/data/component_with_templatefield.py | import random
from lfx.custom import CustomComponent
from lfx.field_typing import Input
class TestComponent(CustomComponent):
def refresh_values(self):
# This is a function that will be called every time the component is updated
# and should return a list of random strings
return [f"Rando... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/component_with_templatefield.py",
"license": "MIT License",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/data/dynamic_output_component.py | from typing import Any
from lfx.custom import Component
from lfx.io import BoolInput, MessageTextInput, Output
from lfx.schema import Data
class DynamicOutputComponent(Component):
display_name = "Dynamic Output Component"
description = "Use as a template to create your own component."
documentation: str ... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/dynamic_output_component.py",
"license": "MIT License",
"lines": 33,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/data/simple_chat_no_llm.py | """A simple chat flow example for Langflow.
This script demonstrates how to set up a basic conversational flow using Langflow's ChatInput and ChatOutput components.
Features:
- Configures logging to 'langflow.log' at INFO level
- Connects ChatInput to ChatOutput
- Builds a Graph object for the flow
Usage:
python... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/data/simple_chat_no_llm.py",
"license": "MIT License",
"lines": 21,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/unit/cli/test_common.py | """Unit tests for LFX CLI common utilities."""
import os
import socket
import sys
import uuid
from pathlib import Path
from unittest.mock import MagicMock, Mock, patch
import pytest
import typer
from lfx.cli.common import (
create_verbose_printer,
execute_graph_with_capture,
extract_result_data,
flow_... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/unit/cli/test_common.py",
"license": "MIT License",
"lines": 275,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
langflow-ai/langflow:src/lfx/tests/unit/cli/test_run_command.py | """Unit tests for the run command functionality."""
import contextlib
import json
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
import typer
from lfx.cli.run import run
class TestRunCommand:
"""Unit tests for run command internal functionality."""
@pytest.fixture
... | {
"repo_id": "langflow-ai/langflow",
"file_path": "src/lfx/tests/unit/cli/test_run_command.py",
"license": "MIT License",
"lines": 415,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.