mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
core[patch]: mmr util (#25689)
This commit is contained in:
parent
ba89933c2c
commit
b28bc252c4
@ -21,9 +21,7 @@ from langchain_core.embeddings import Embeddings
|
||||
from langchain_core.load import dumpd, load
|
||||
from langchain_core.vectorstores import VectorStore
|
||||
from langchain_core.vectorstores.utils import _cosine_similarity as cosine_similarity
|
||||
from langchain_core.vectorstores.utils import (
|
||||
_maximal_marginal_relevance as maximal_marginal_relevance,
|
||||
)
|
||||
from langchain_core.vectorstores.utils import maximal_marginal_relevance
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langchain_core.indexing import UpsertResponse
|
||||
|
@ -71,7 +71,7 @@ def _cosine_similarity(X: Matrix, Y: Matrix) -> np.ndarray:
|
||||
return similarity
|
||||
|
||||
|
||||
def _maximal_marginal_relevance(
|
||||
def maximal_marginal_relevance(
|
||||
query_embedding: np.ndarray,
|
||||
embedding_list: list,
|
||||
lambda_mult: float = 0.5,
|
||||
|
Loading…
Reference in New Issue
Block a user