_ensure_sync_client_available() — langchain Function Reference
Architecture documentation for the _ensure_sync_client_available() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 852243b7_32dc_46e6_5d5f_62e271437d8d["_ensure_sync_client_available()"] 2f237d29_e276_c4ef_3a56_7139ce49b50e["OpenAIEmbeddings"] 852243b7_32dc_46e6_5d5f_62e271437d8d -->|defined in| 2f237d29_e276_c4ef_3a56_7139ce49b50e 64f4fa06_4784_3e51_9655_1c4667c3f612["embed_documents()"] 64f4fa06_4784_3e51_9655_1c4667c3f612 -->|calls| 852243b7_32dc_46e6_5d5f_62e271437d8d e468f110_acc6_1477_1d24_c998730b0bf4["embed_query()"] e468f110_acc6_1477_1d24_c998730b0bf4 -->|calls| 852243b7_32dc_46e6_5d5f_62e271437d8d style 852243b7_32dc_46e6_5d5f_62e271437d8d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/langchain_openai/embeddings/base.py lines 419–427
def _ensure_sync_client_available(self) -> None:
"""Check that sync client is available, raise error if not."""
if self.client is None:
msg = (
"Sync client is not available. This happens when an async callable "
"was provided for the API key. Use async methods (ainvoke, astream) "
"instead, or provide a string or sync callable for the API key."
)
raise ValueError(msg)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _ensure_sync_client_available() do?
_ensure_sync_client_available() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/embeddings/base.py.
Where is _ensure_sync_client_available() defined?
_ensure_sync_client_available() is defined in libs/partners/openai/langchain_openai/embeddings/base.py at line 419.
What calls _ensure_sync_client_available()?
_ensure_sync_client_available() is called by 2 function(s): embed_documents, embed_query.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free