Skip to content

Commit

Permalink
adding repo config
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Javier Arceo <[email protected]>
  • Loading branch information
franciscojavierarceo committed Nov 20, 2024
1 parent 3eab8d9 commit a714f85
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OnlineStore class names must end with the OnlineStore suffix!

### Contrib online stores

New online stores go in `sdk/python/feast/infra/online_stores/contrib/`.
New online stores go in `sdk/python/feast/infra/online_stores/`.

#### What is a contrib plugin?

Expand Down
37 changes: 13 additions & 24 deletions sdk/python/feast/infra/online_stores/milvus_online_store/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,19 @@


class MilvusOnlineStoreConfig(FeastConfigBaseModel, VectorStoreConfig):
"""Online store config for Milvus vector database"""

type: Literal["milvus", "feast.infra.online_stores.milvus.MilvusOnlineStore"] = (
"milvus"
)
"""Online store type selector"""

host: StrictStr = "localhost"
"""Hostname for Milvus server"""

port: int = 19530
"""Port for Milvus server"""

index_type: str = "IVF_FLAT"
"""Index type for Milvus collection"""

metric_type: str = "L2"
"""Distance metric type"""
"""
Configuration for the Milvus online store.
NOTE: The class *must* end with the `OnlineStoreConfig` suffix.
"""

embedding_dim: int = 128
"""Dimension of the embedding vectors"""
type: Literal["milvus"] = "milvus"

vector_enabled: bool = True
"""Flag to enable vector search"""
host: Optional[StrictStr] = "localhost"
port: Optional[int] = 19530
index_type: Optional[str] = "IVF_FLAT"
metric_type: Optional[str] = "L2"
embedding_dim: Optional[int] = 128
vector_enabled: Optional[bool] = True


class MilvusOnlineStore(OnlineStore):
Expand All @@ -69,7 +58,7 @@ class MilvusOnlineStore(OnlineStore):

def _connect(self, config: RepoConfig):
connections.connect(
alias="default",
alias="feast",
host=config.online_store.host,
port=str(config.online_store.port),
)
Expand Down Expand Up @@ -350,7 +339,7 @@ def __init__(self, host: str, port: int, name: str):
self._connect()

def _connect(self):
connections.connect(alias="default", host=self.host, port=str(self.port))
return connections.connect(alias="default", host=self.host, port=str(self.port))

def to_infra_object_proto(self) -> InfraObjectProto:
# Implement serialization if needed
Expand Down
1 change: 1 addition & 0 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"singlestore": "feast.infra.online_stores.singlestore_online_store.singlestore.SingleStoreOnlineStore",
"qdrant": "feast.infra.online_stores.cqdrant.QdrantOnlineStore",
"couchbase": "feast.infra.online_stores.couchbase_online_store.couchbase.CouchbaseOnlineStore",
"milvus": "feast.infra.online_stores.milvus_online_store.milvus.MilvusOnlineStore",
**LEGACY_ONLINE_STORE_CLASS_FOR_TYPE,
}

Expand Down

0 comments on commit a714f85

Please sign in to comment.