prepare_query_for_vector_search#
- langchain_mongodb.utils.prepare_query_for_vector_search(query: str, embedding: Any) tuple[str | list[float], bool][source]#
Prepare a query for vector search based on the embedding type.
This function checks if the embedding is an AutoEmbeddings instance. If it is, the query is returned as-is (string) for server-side embedding. Otherwise, the query is embedded using the embedding modelβs embed_query method.
- Parameters:
query (str) β The search query string.
embedding (Any) β The embedding model instance (either AutoEmbeddings or a standard Embeddings).
- Returns:
query_input: Either the original query string (for AutoEmbeddings) or the embedded query vector (for standard embeddings)
is_autoembedding: Boolean indicating whether AutoEmbeddings is being used
- Return type:
A tuple containing