_expand_include_patterns() — langchain Function Reference
Architecture documentation for the _expand_include_patterns() function in file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ef2e07ee_ee8e_f087_ecc5_334345441c90["_expand_include_patterns()"] 7e138deb_72a0_c3b2_9372_a9429bc90819["file_search.py"] ef2e07ee_ee8e_f087_ecc5_334345441c90 -->|defined in| 7e138deb_72a0_c3b2_9372_a9429bc90819 943f681c_e0cd_4a26_5c61_e9c06d70955a["_is_valid_include_pattern()"] 943f681c_e0cd_4a26_5c61_e9c06d70955a -->|calls| ef2e07ee_ee8e_f087_ecc5_334345441c90 1c214f1e_0644_6913_d2f0_c518eba12d57["_match_include_pattern()"] 1c214f1e_0644_6913_d2f0_c518eba12d57 -->|calls| ef2e07ee_ee8e_f087_ecc5_334345441c90 style ef2e07ee_ee8e_f087_ecc5_334345441c90 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/file_search.py lines 23–54
def _expand_include_patterns(pattern: str) -> list[str] | None:
"""Expand brace patterns like `*.{py,pyi}` into a list of globs."""
if "}" in pattern and "{" not in pattern:
return None
expanded: list[str] = []
def _expand(current: str) -> None:
start = current.find("{")
if start == -1:
expanded.append(current)
return
end = current.find("}", start)
if end == -1:
raise ValueError
prefix = current[:start]
suffix = current[end + 1 :]
inner = current[start + 1 : end]
if not inner:
raise ValueError
for option in inner.split(","):
_expand(prefix + option + suffix)
try:
_expand(pattern)
except ValueError:
return None
return expanded
Domain
Subdomains
Source
Frequently Asked Questions
What does _expand_include_patterns() do?
_expand_include_patterns() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/file_search.py.
Where is _expand_include_patterns() defined?
_expand_include_patterns() is defined in libs/langchain_v1/langchain/agents/middleware/file_search.py at line 23.
What calls _expand_include_patterns()?
_expand_include_patterns() is called by 2 function(s): _is_valid_include_pattern, _match_include_pattern.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free