|
|
|
@ -17,7 +17,8 @@ if TYPE_CHECKING:
|
|
|
|
|
import chromadb
|
|
|
|
|
import chromadb.config
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
logger = logging.getLogger()
|
|
|
|
|
DEFAULT_K = 4 # Number of Documents to return.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _results_to_docs(results: Any) -> List[Document]:
|
|
|
|
@ -164,7 +165,7 @@ class Chroma(VectorStore):
|
|
|
|
|
def similarity_search(
|
|
|
|
|
self,
|
|
|
|
|
query: str,
|
|
|
|
|
k: int = 4,
|
|
|
|
|
k: int = DEFAULT_K,
|
|
|
|
|
filter: Optional[Dict[str, str]] = None,
|
|
|
|
|
**kwargs: Any,
|
|
|
|
|
) -> List[Document]:
|
|
|
|
@ -184,7 +185,7 @@ class Chroma(VectorStore):
|
|
|
|
|
def similarity_search_by_vector(
|
|
|
|
|
self,
|
|
|
|
|
embedding: List[float],
|
|
|
|
|
k: int = 4,
|
|
|
|
|
k: int = DEFAULT_K,
|
|
|
|
|
filter: Optional[Dict[str, str]] = None,
|
|
|
|
|
**kwargs: Any,
|
|
|
|
|
) -> List[Document]:
|
|
|
|
@ -204,7 +205,7 @@ class Chroma(VectorStore):
|
|
|
|
|
def similarity_search_with_score(
|
|
|
|
|
self,
|
|
|
|
|
query: str,
|
|
|
|
|
k: int = 4,
|
|
|
|
|
k: int = DEFAULT_K,
|
|
|
|
|
filter: Optional[Dict[str, str]] = None,
|
|
|
|
|
**kwargs: Any,
|
|
|
|
|
) -> List[Tuple[Document, float]]:
|
|
|
|
@ -234,7 +235,7 @@ class Chroma(VectorStore):
|
|
|
|
|
def max_marginal_relevance_search_by_vector(
|
|
|
|
|
self,
|
|
|
|
|
embedding: List[float],
|
|
|
|
|
k: int = 4,
|
|
|
|
|
k: int = DEFAULT_K,
|
|
|
|
|
fetch_k: int = 20,
|
|
|
|
|
lambda_mult: float = 0.5,
|
|
|
|
|
filter: Optional[Dict[str, str]] = None,
|
|
|
|
@ -277,7 +278,7 @@ class Chroma(VectorStore):
|
|
|
|
|
def max_marginal_relevance_search(
|
|
|
|
|
self,
|
|
|
|
|
query: str,
|
|
|
|
|
k: int = 4,
|
|
|
|
|
k: int = DEFAULT_K,
|
|
|
|
|
fetch_k: int = 20,
|
|
|
|
|
lambda_mult: float = 0.5,
|
|
|
|
|
filter: Optional[Dict[str, str]] = None,
|
|
|
|
|