community[patch]: deprecate langchain_community Chroma in favor of langchain_chroma (#24474)

This commit is contained in:
ccurme
2024-07-22 11:00:13 -04:00
committed by GitHub
parent 0f7569ddbc
commit dcba7df2fe
67 changed files with 108 additions and 102 deletions

View File

@@ -1,10 +1,11 @@
# flake8: noqa
"""Test sentence_transformer embeddings."""
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_community.embeddings.sentence_transformer import (
SentenceTransformerEmbeddings,
)
from langchain_community.vectorstores import Chroma
def test_sentence_transformer_embedding_documents() -> None:
@@ -34,7 +35,7 @@ def test_sentence_transformer_db_query() -> None:
query = "what the foo is a bar?"
query_vector = embedding.embed_query(query)
assert len(query_vector) == 384
db = Chroma(embedding_function=embedding)
db = InMemoryVectorStore(embedding=embedding)
db.add_texts(texts)
docs = db.similarity_search_by_vector(query_vector, k=2)
assert docs[0].page_content == "we will foo your bar until you can't foo any more"