Format code with ruff
This commit is contained in:
@@ -314,7 +314,9 @@ class WeChatHistoryReader(BaseReader):
|
|||||||
|
|
||||||
return concatenated_groups
|
return concatenated_groups
|
||||||
|
|
||||||
def _create_concatenated_content(self, message_group: dict, contact_name: str) -> tuple[str, str]:
|
def _create_concatenated_content(
|
||||||
|
self, message_group: dict, contact_name: str
|
||||||
|
) -> tuple[str, str]:
|
||||||
"""
|
"""
|
||||||
Create concatenated content from a group of messages.
|
Create concatenated content from a group of messages.
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ def load_vidore_v2_data(
|
|||||||
# Try to get a sample to see actual language values
|
# Try to get a sample to see actual language values
|
||||||
try:
|
try:
|
||||||
sample_ds = cast(
|
sample_ds = cast(
|
||||||
Dataset, load_dataset(dataset_path, "queries", split=split, revision=revision)
|
Dataset,
|
||||||
|
load_dataset(dataset_path, "queries", split=split, revision=revision),
|
||||||
)
|
)
|
||||||
if len(sample_ds) > 0 and "language" in sample_ds.column_names:
|
if len(sample_ds) > 0 and "language" in sample_ds.column_names:
|
||||||
sample_langs = set(sample_ds["language"])
|
sample_langs = set(sample_ds["language"])
|
||||||
|
|||||||
@@ -581,7 +581,18 @@ class TestQueryTemplateApplicationInComputeEmbedding:
|
|||||||
|
|
||||||
# Create a concrete implementation for testing
|
# Create a concrete implementation for testing
|
||||||
class TestSearcher(BaseSearcher):
|
class TestSearcher(BaseSearcher):
|
||||||
def search(self, query, top_k, complexity=64, beam_width=1, prune_ratio=0.0, recompute_embeddings=False, pruning_strategy="global", zmq_port=None, **kwargs):
|
def search(
|
||||||
|
self,
|
||||||
|
query,
|
||||||
|
top_k,
|
||||||
|
complexity=64,
|
||||||
|
beam_width=1,
|
||||||
|
prune_ratio=0.0,
|
||||||
|
recompute_embeddings=False,
|
||||||
|
pruning_strategy="global",
|
||||||
|
zmq_port=None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
return {"labels": [], "distances": []}
|
return {"labels": [], "distances": []}
|
||||||
|
|
||||||
searcher = object.__new__(TestSearcher)
|
searcher = object.__new__(TestSearcher)
|
||||||
@@ -625,7 +636,18 @@ class TestQueryTemplateApplicationInComputeEmbedding:
|
|||||||
|
|
||||||
# Create a concrete implementation for testing
|
# Create a concrete implementation for testing
|
||||||
class TestSearcher(BaseSearcher):
|
class TestSearcher(BaseSearcher):
|
||||||
def search(self, query, top_k, complexity=64, beam_width=1, prune_ratio=0.0, recompute_embeddings=False, pruning_strategy="global", zmq_port=None, **kwargs):
|
def search(
|
||||||
|
self,
|
||||||
|
query,
|
||||||
|
top_k,
|
||||||
|
complexity=64,
|
||||||
|
beam_width=1,
|
||||||
|
prune_ratio=0.0,
|
||||||
|
recompute_embeddings=False,
|
||||||
|
pruning_strategy="global",
|
||||||
|
zmq_port=None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
return {"labels": [], "distances": []}
|
return {"labels": [], "distances": []}
|
||||||
|
|
||||||
searcher = object.__new__(TestSearcher)
|
searcher = object.__new__(TestSearcher)
|
||||||
@@ -671,7 +693,18 @@ class TestQueryTemplateApplicationInComputeEmbedding:
|
|||||||
from leann.searcher_base import BaseSearcher
|
from leann.searcher_base import BaseSearcher
|
||||||
|
|
||||||
class TestSearcher(BaseSearcher):
|
class TestSearcher(BaseSearcher):
|
||||||
def search(self, query, top_k, complexity=64, beam_width=1, prune_ratio=0.0, recompute_embeddings=False, pruning_strategy="global", zmq_port=None, **kwargs):
|
def search(
|
||||||
|
self,
|
||||||
|
query,
|
||||||
|
top_k,
|
||||||
|
complexity=64,
|
||||||
|
beam_width=1,
|
||||||
|
prune_ratio=0.0,
|
||||||
|
recompute_embeddings=False,
|
||||||
|
pruning_strategy="global",
|
||||||
|
zmq_port=None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
return {"labels": [], "distances": []}
|
return {"labels": [], "distances": []}
|
||||||
|
|
||||||
searcher = object.__new__(TestSearcher)
|
searcher = object.__new__(TestSearcher)
|
||||||
@@ -710,7 +743,18 @@ class TestQueryTemplateApplicationInComputeEmbedding:
|
|||||||
from leann.searcher_base import BaseSearcher
|
from leann.searcher_base import BaseSearcher
|
||||||
|
|
||||||
class TestSearcher(BaseSearcher):
|
class TestSearcher(BaseSearcher):
|
||||||
def search(self, query, top_k, complexity=64, beam_width=1, prune_ratio=0.0, recompute_embeddings=False, pruning_strategy="global", zmq_port=None, **kwargs):
|
def search(
|
||||||
|
self,
|
||||||
|
query,
|
||||||
|
top_k,
|
||||||
|
complexity=64,
|
||||||
|
beam_width=1,
|
||||||
|
prune_ratio=0.0,
|
||||||
|
recompute_embeddings=False,
|
||||||
|
pruning_strategy="global",
|
||||||
|
zmq_port=None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
return {"labels": [], "distances": []}
|
return {"labels": [], "distances": []}
|
||||||
|
|
||||||
searcher = object.__new__(TestSearcher)
|
searcher = object.__new__(TestSearcher)
|
||||||
@@ -774,7 +818,18 @@ class TestQueryTemplateApplicationInComputeEmbedding:
|
|||||||
from leann.searcher_base import BaseSearcher
|
from leann.searcher_base import BaseSearcher
|
||||||
|
|
||||||
class TestSearcher(BaseSearcher):
|
class TestSearcher(BaseSearcher):
|
||||||
def search(self, query, top_k, complexity=64, beam_width=1, prune_ratio=0.0, recompute_embeddings=False, pruning_strategy="global", zmq_port=None, **kwargs):
|
def search(
|
||||||
|
self,
|
||||||
|
query,
|
||||||
|
top_k,
|
||||||
|
complexity=64,
|
||||||
|
beam_width=1,
|
||||||
|
prune_ratio=0.0,
|
||||||
|
recompute_embeddings=False,
|
||||||
|
pruning_strategy="global",
|
||||||
|
zmq_port=None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
return {"labels": [], "distances": []}
|
return {"labels": [], "distances": []}
|
||||||
|
|
||||||
searcher = object.__new__(TestSearcher)
|
searcher = object.__new__(TestSearcher)
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ def test_backend_options():
|
|||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
# Use smaller model in CI to avoid memory issues
|
# Use smaller model in CI to avoid memory issues
|
||||||
is_ci = os.environ.get("CI") == "true"
|
is_ci = os.environ.get("CI") == "true"
|
||||||
embedding_model = "sentence-transformers/all-MiniLM-L6-v2" if is_ci else "facebook/contriever"
|
embedding_model = (
|
||||||
|
"sentence-transformers/all-MiniLM-L6-v2" if is_ci else "facebook/contriever"
|
||||||
|
)
|
||||||
dimensions = 384 if is_ci else None
|
dimensions = 384 if is_ci else None
|
||||||
|
|
||||||
# Test HNSW backend (as shown in README)
|
# Test HNSW backend (as shown in README)
|
||||||
|
|||||||
Reference in New Issue
Block a user