parser.py — langchain Source File
Architecture documentation for parser.py, a python file in the langchain codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1ae7993b_d5cf_8ebd_a7db_4833692784eb["parser.py"] c0b5feef_1759_3f2b_62d3_f376e06b863f["datetime"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> c0b5feef_1759_3f2b_62d3_f376e06b863f f3365e3c_fb7a_bb9a_bc79_059b06cb7024["warnings"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> f3365e3c_fb7a_bb9a_bc79_059b06cb7024 2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> 2bf6d401_816d_d011_3b05_a6114f55ff58 feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> feec1ec4_6917_867b_d228_b134d0ff8099 bd035cf2_5933_bc0f_65e9_0dfe57627ca3["langchain_core.utils"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> bd035cf2_5933_bc0f_65e9_0dfe57627ca3 f85fae70_1011_eaec_151c_4083140ae9e5["typing_extensions"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> f85fae70_1011_eaec_151c_4083140ae9e5 5619f221_a580_f72e_3e32_071432cc276c["lark"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> 5619f221_a580_f72e_3e32_071432cc276c c39a1380_2ee7_581e_4839_31617170612b["langchain_core.structured_query"] 1ae7993b_d5cf_8ebd_a7db_4833692784eb --> c39a1380_2ee7_581e_4839_31617170612b style 1ae7993b_d5cf_8ebd_a7db_4833692784eb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import datetime
import warnings
from collections.abc import Sequence
from typing import Any, Literal
from langchain_core.utils import check_package_version
from typing_extensions import TypedDict
try:
check_package_version("lark", gte_version="1.1.5")
from lark import Lark, Transformer, v_args
_HAS_LARK = True
except ImportError:
def v_args(*_: Any, **__: Any) -> Any: # type: ignore[misc]
"""Dummy decorator for when lark is not installed."""
return lambda _: None
Transformer = object # type: ignore[assignment,misc]
Lark = object # type: ignore[assignment,misc]
_HAS_LARK = False
from langchain_core.structured_query import (
Comparator,
Comparison,
FilterDirective,
Operation,
Operator,
)
GRAMMAR = r"""
?program: func_call
?expr: func_call
| value
func_call: CNAME "(" [args] ")"
?value: SIGNED_INT -> int
| SIGNED_FLOAT -> float
| DATE -> date
| DATETIME -> datetime
| list
| string
| ("false" | "False" | "FALSE") -> false
| ("true" | "True" | "TRUE") -> true
args: expr ("," expr)*
DATE.2: /["']?(\d{4}-[01]\d-[0-3]\d)["']?/
DATETIME.2: /["']?\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d[Zz]?["']?/
string: /'[^']*'/ | ESCAPED_STRING
list: "[" [args] "]"
%import common.CNAME
%import common.ESCAPED_STRING
%import common.SIGNED_FLOAT
%import common.SIGNED_INT
%import common.WS
%ignore WS
"""
// ... (221 more lines)
Domain
Subdomains
Dependencies
- collections.abc
- datetime
- langchain_core.structured_query
- langchain_core.utils
- lark
- typing
- typing_extensions
- warnings
Source
Frequently Asked Questions
What does parser.py do?
parser.py is a source file in the langchain codebase, written in python. It belongs to the AgentOrchestration domain, ClassicChains subdomain.
What functions are defined in parser.py?
parser.py defines 3 function(s): check_package_version, get_parser, v_args.
What does parser.py depend on?
parser.py imports 8 module(s): collections.abc, datetime, langchain_core.structured_query, langchain_core.utils, lark, typing, typing_extensions, warnings.
Where is parser.py in the architecture?
parser.py is located at libs/langchain/langchain_classic/chains/query_constructor/parser.py (domain: AgentOrchestration, subdomain: ClassicChains, directory: libs/langchain/langchain_classic/chains/query_constructor).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free