mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-17 23:41:46 +00:00
community[patch]: deprecate langchain_community Chroma in favor of langchain_chroma (#24474)
This commit is contained in:
@@ -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"
|
||||
|
Reference in New Issue
Block a user