Home / Function/ sync_call_fallback() — langchain Function Reference

sync_call_fallback() — langchain Function Reference

Architecture documentation for the sync_call_fallback() function in vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  e2d0d104_b847_8e58_b1a4_a33bb7c458fa["sync_call_fallback()"]
  cf5060bb_3c9f_3c4e_d3a7_03999abcf544["vectorstores.py"]
  e2d0d104_b847_8e58_b1a4_a33bb7c458fa -->|defined in| cf5060bb_3c9f_3c4e_d3a7_03999abcf544
  style e2d0d104_b847_8e58_b1a4_a33bb7c458fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/qdrant/langchain_qdrant/vectorstores.py lines 35–56

def sync_call_fallback(method: Callable) -> Callable:
    """Call the synchronous method if the async method is not implemented.

    This decorator should only be used for methods that are defined as async in the
    class.

    """

    @functools.wraps(method)
    async def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
        try:
            return await method(self, *args, **kwargs)
        except NotImplementedError:
            # If the async method is not implemented, call the synchronous method
            # by removing the first letter from the method name. For example,
            # if the async method is called `aadd_texts`, the synchronous method
            # will be called `aad_texts`.
            return await run_in_executor(
                None, getattr(self, method.__name__[1:]), *args, **kwargs
            )

    return wrapper

Subdomains

Frequently Asked Questions

What does sync_call_fallback() do?
sync_call_fallback() is a function in the langchain codebase, defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py.
Where is sync_call_fallback() defined?
sync_call_fallback() is defined in libs/partners/qdrant/langchain_qdrant/vectorstores.py at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free