Home / Function/ _is_valid_include_pattern() — langchain Function Reference

_is_valid_include_pattern() — langchain Function Reference

Architecture documentation for the _is_valid_include_pattern() function in file_search.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  60184a91_fab8_982f_769b_44d51b7e4b97["_is_valid_include_pattern()"]
  2be37047_277b_5443_dc33_7aebad3faaa4["file_search.py"]
  60184a91_fab8_982f_769b_44d51b7e4b97 -->|defined in| 2be37047_277b_5443_dc33_7aebad3faaa4
  9c9a2eda_be6c_5f6f_9a0a_3f3e5575dc2e["_handle_grep_search()"]
  9c9a2eda_be6c_5f6f_9a0a_3f3e5575dc2e -->|calls| 60184a91_fab8_982f_769b_44d51b7e4b97
  fea81925_aad2_dbab_3ab4_96f18a5cb4c7["_expand_include_patterns()"]
  60184a91_fab8_982f_769b_44d51b7e4b97 -->|calls| fea81925_aad2_dbab_3ab4_96f18a5cb4c7
  style 60184a91_fab8_982f_769b_44d51b7e4b97 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/file_search.py lines 57–75

def _is_valid_include_pattern(pattern: str) -> bool:
    """Validate glob pattern used for include filters."""
    if not pattern:
        return False

    if any(char in pattern for char in ("\x00", "\n", "\r")):
        return False

    expanded = _expand_include_patterns(pattern)
    if expanded is None:
        return False

    try:
        for candidate in expanded:
            re.compile(fnmatch.translate(candidate))
    except re.error:
        return False

    return True

Domain

Subdomains

Frequently Asked Questions

What does _is_valid_include_pattern() do?
_is_valid_include_pattern() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/middleware/file_search.py.
Where is _is_valid_include_pattern() defined?
_is_valid_include_pattern() is defined in libs/partners/anthropic/langchain_anthropic/middleware/file_search.py at line 57.
What does _is_valid_include_pattern() call?
_is_valid_include_pattern() calls 1 function(s): _expand_include_patterns.
What calls _is_valid_include_pattern()?
_is_valid_include_pattern() is called by 1 function(s): _handle_grep_search.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free