Skip to content

Commit

Permalink
Merge #1020
Browse files Browse the repository at this point in the history
1020: Fix tests by passing embedders r=sanders41 a=dureuill

# Pull Request

## Related issue
Fixes #1019 

## What does this PR do?
- Change comment stating the default model for OpenAI
- Add `document_template_max_bytes` to models
- Fix tests



Co-authored-by: Louis Dureuil <[email protected]>
  • Loading branch information
meili-bors[bot] and dureuill authored Sep 30, 2024
2 parents e948e72 + 22102f7 commit c264013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit c264013

Please sign in to comment.