Skip to content

Commit 24935e4

Browse files
authored
chore: FAISS - small changes to improve consistency with the codebase (#2890)
* chore: FAISS - small changes to improve consistency with the codebase * fmt
1 parent 797ddfc commit 24935e4

7 files changed

Lines changed: 18 additions & 23 deletions

File tree

integrations/faiss/README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
# faiss-haystack
22

3-
This package provides a [FAISS](https://github.com/facebookresearch/faiss) document store for [Haystack](https://github.com/deepset-ai/haystack).
3+
[![PyPI - Version](https://img.shields.io/pypi/v/faiss-haystack.svg)](https://pypi.org/project/faiss-haystack)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/faiss-haystack.svg)](https://pypi.org/project/faiss-haystack)
45

5-
## Installation
6+
- [Integration page](https://haystack.deepset.ai/integrations/faiss-documentstore)
7+
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/faiss/CHANGELOG.md)
68

7-
```bash
8-
pip install faiss-haystack
9-
```
9+
---
1010

11-
## Usage
12-
13-
```python
14-
from haystack_integrations.document_stores.faiss import FAISSDocumentStore
15-
16-
document_store = FAISSDocumentStore(index_path="my_index")
17-
```
11+
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).

integrations/faiss/pyproject.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
55
[project]
66
name = "faiss-haystack"
77
dynamic = ["version"]
8-
description = ''
8+
description = 'An integration of FAISS (library for efficient similarity search of dense vectors) with Haystack'
99
readme = "README.md"
1010
requires-python = ">=3.10"
1111
license = "Apache-2.0"
@@ -48,7 +48,7 @@ installer = "uv"
4848
dependencies = ["haystack-pydoc-tools", "ruff"]
4949

5050
[tool.hatch.envs.default.scripts]
51-
docs = ["pydoc-markdown pydoc/config_docusaurus.yml"]
51+
docs = ["haystack-pydoc pydoc/config_docusaurus.yml"]
5252
fmt = "ruff check --fix {args}; ruff format {args}"
5353
fmt-check = "ruff check {args} && ruff format --check {args}"
5454

@@ -59,6 +59,7 @@ dependencies = [
5959
"pytest-rerunfailures",
6060
"mypy",
6161
"pandas",
62+
"pip", # needed for mypy to install type stubs
6263
]
6364

6465
[tool.hatch.envs.test.scripts]
@@ -75,8 +76,12 @@ non_interactive = true
7576
check_untyped_defs = true
7677
disallow_incomplete_defs = true
7778

78-
[tool.hatch.metadata]
79-
allow-direct-references = true
79+
[[tool.mypy.overrides]]
80+
module = [
81+
# faiss does not provide types
82+
"faiss.*",
83+
]
84+
ignore_missing_imports = true
8085

8186
[tool.ruff]
8287
line-length = 120
@@ -156,4 +161,5 @@ exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
156161

157162
[tool.pytest.ini_options]
158163
minversion = "6.0"
164+
addopts = "--strict-markers"
159165
markers = ["integration: integration tests"]

integrations/faiss/src/haystack_integrations/__init__.py

Whitespace-only changes.

integrations/faiss/src/haystack_integrations/components/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

integrations/faiss/src/haystack_integrations/components/retrievers/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

integrations/faiss/src/haystack_integrations/document_stores/__init__.py

Whitespace-only changes.

integrations/faiss/src/haystack_integrations/document_stores/faiss/document_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
from pathlib import Path
1010
from typing import Any
1111

12-
import faiss # type: ignore[import-untyped]
1312
import numpy as np
1413
from haystack import default_from_dict, default_to_dict
1514
from haystack.dataclasses import Document
1615
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
1716
from haystack.document_stores.types import DuplicatePolicy
1817
from haystack.errors import FilterError
1918

19+
import faiss
20+
2021
logger = logging.getLogger(__name__)
2122

2223

0 commit comments

Comments
 (0)