Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: cmuhao <[email protected]>
  • Loading branch information
HaoXuAI committed Sep 28, 2024
1 parent 245bc36 commit c1da697
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions sdk/python/feast/infra/online_stores/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _get_conn(self, config: RepoConfig):
if not self._conn:
db_path = self._get_db_path(config)
self._conn = _initialize_conn(db_path)
if sys.version_info[0:2] == (3, 10) and config.online_store.vec_enabled:
if sys.version_info[0:2] == (3, 10) and config.online_store.vector_enabled:
import sqlite_vec # noqa: F401

self._conn.enable_load_extension(True) # type: ignore
Expand Down Expand Up @@ -116,7 +116,7 @@ def online_write_batch(

table_name = _table_id(project, table)
for feature_name, val in values.items():
if config.online_store.vec_enabled:
if config.online_store.vector_enabled:
vector_bin = serialize_f32(
val.float_list_val.val, config.online_store.vector_len
) # type: ignore
Expand Down Expand Up @@ -316,7 +316,7 @@ def retrieve_online_documents(
"""
project = config.project

if not config.online_store.vec_enabled:
if not config.online_store.vector_enabled:
raise ValueError("sqlite-vss is not enabled in the online store config")

conn = self._get_conn(config)
Expand Down
6 changes: 4 additions & 2 deletions sdk/python/feast/infra/online_stores/vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@


class VectorStoreConfig:
# Whether to enable the vector for vector similarity search,
# Whether to enable the online store for vector similarity search,
# This is only applicable for online store.
vector_enabled: Optional[bool] = False

# If vector is enabled, the length of the vector field
vector_len: Optional[int] = 512

# The vector similarity metric to use in KNN search
# more details: https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html
# It is helpful for vector database that does not support config at retrieval runtime
# E.g. Elasticsearch dense_vector field at
# https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html
similarity: Optional[str] = "cosine"
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def test_sqlite_get_online_documents() -> None:
with runner.local_repo(
get_example_repo("example_feature_repo_1.py"), "file"
) as store:
store.config.online_store.vec_enabled = True
store.config.online_store.vector_enabled = True
store.config.online_store.vector_len = vector_length
# Write some data to two tables
document_embeddings_fv = store.get_feature_view(name="document_embeddings")
Expand Down

0 comments on commit c1da697

Please sign in to comment.