dify/api/providers/vdb/vdb-chroma/tests/integration_tests/test_chroma.py
Yunlu Wen ae898652b2
refactor: move vdb implementations to workspaces (#34900)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: wangxiaolei <fatelei@gmail.com>
2026-04-13 08:56:43 +00:00

33 lines
1.0 KiB
Python

import chromadb
from dify_vdb_chroma.chroma_vector import ChromaConfig, ChromaVector
from core.rag.datasource.vdb.vector_integration_test_support import (
AbstractVectorTest,
get_example_text,
)
class ChromaVectorTest(AbstractVectorTest):
def __init__(self):
super().__init__()
self.vector = ChromaVector(
collection_name=self.collection_name,
config=ChromaConfig(
host="localhost",
port=8000,
tenant=chromadb.DEFAULT_TENANT,
database=chromadb.DEFAULT_DATABASE,
auth_provider="chromadb.auth.token_authn.TokenAuthClientProvider",
auth_credentials="difyai123456",
),
)
def search_by_full_text(self):
# chroma dos not support full text searching
hits_by_full_text = self.vector.search_by_full_text(query=get_example_text())
assert len(hits_by_full_text) == 0
def test_chroma_vector(setup_mock_redis):
ChromaVectorTest().run_all_tests()