embed_query() — langchain Function Reference
Architecture documentation for the embed_query() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD dcdba7e0_a4e9_895f_80dd_67dcdcbaa922["embed_query()"] 4ca44101_1e0d_43e9_f420_35c5afe4173a["HypotheticalDocumentEmbedder"] dcdba7e0_a4e9_895f_80dd_67dcdcbaa922 -->|defined in| 4ca44101_1e0d_43e9_f420_35c5afe4173a 577fb638_b3d2_1be8_d2bd_5fc029666efb["embed_documents()"] dcdba7e0_a4e9_895f_80dd_67dcdcbaa922 -->|calls| 577fb638_b3d2_1be8_d2bd_5fc029666efb 28b658bd_49a9_57f4_afd1_c492036ca171["combine_embeddings()"] dcdba7e0_a4e9_895f_80dd_67dcdcbaa922 -->|calls| 28b658bd_49a9_57f4_afd1_c492036ca171 style dcdba7e0_a4e9_895f_80dd_67dcdcbaa922 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/chains/hyde/base.py lines 78–87
def embed_query(self, text: str) -> list[float]:
"""Generate a hypothetical document and embedded it."""
var_name = self.input_keys[0]
result = self.llm_chain.invoke({var_name: text})
if isinstance(self.llm_chain, LLMChain):
documents = [result[self.output_keys[0]]]
else:
documents = [result]
embeddings = self.embed_documents(documents)
return self.combine_embeddings(embeddings)
Domain
Subdomains
Source
Frequently Asked Questions
What does embed_query() do?
embed_query() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/hyde/base.py.
Where is embed_query() defined?
embed_query() is defined in libs/langchain/langchain_classic/chains/hyde/base.py at line 78.
What does embed_query() call?
embed_query() calls 2 function(s): combine_embeddings, embed_documents.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free