Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests by passing embedder #1020

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion meilisearch/models/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ class ProximityPrecision(str, Enum):

class OpenAiEmbedder(CamelBase):
source: str = "openAi"
model: Optional[str] = None # Defaults to text-embedding-ada-002
model: Optional[str] = None # Defaults to text-embedding-3-small
dimensions: Optional[int] = None # Uses the model default
api_key: Optional[str] = None # Can be provided through a CLI option or environment variable
document_template: Optional[str] = None
document_template_max_bytes: Optional[int] = None # Default to 400


class HuggingFaceEmbedder(CamelBase):
source: str = "huggingFace"
model: Optional[str] = None # Defaults to BAAI/bge-base-en-v1.5
revision: Optional[str] = None
document_template: Optional[str] = None
document_template_max_bytes: Optional[int] = None # Default to 400


class UserProvidedEmbedder(CamelBase):
Expand Down
3 changes: 2 additions & 1 deletion tests/index/test_index_search_meilisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ def test_show_ranking_score(index_with_documents):
@pytest.mark.usefixtures("enable_vector_search")
def test_vector_search(index_with_documents_and_vectors):
response = index_with_documents_and_vectors().search(
"", opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0}}
"",
opt_params={"vector": [0.1, 0.2], "hybrid": {"semanticRatio": 1.0, "embedder": "default"}},
)
assert len(response["hits"]) > 0

Expand Down