Activeloopai runtime arg (#9961)

This commit is contained in:
Bagatur 2023-08-29 15:01:46 -07:00 committed by GitHub
commit c70bb0ec28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,7 @@ class DeepLake(VectorStore):
num_workers: int = 0, num_workers: int = 0,
verbose: bool = True, verbose: bool = True,
exec_option: Optional[str] = None, exec_option: Optional[str] = None,
runtime: Optional[Dict] = None,
**kwargs: Any, **kwargs: Any,
) -> None: ) -> None:
"""Creates an empty DeepLakeVectorStore or loads an existing one. """Creates an empty DeepLakeVectorStore or loads an existing one.
@ -77,7 +78,7 @@ class DeepLake(VectorStore):
>>> # Create a vector store in the Deep Lake Managed Tensor Database >>> # Create a vector store in the Deep Lake Managed Tensor Database
>>> data = DeepLake( >>> data = DeepLake(
... path = "hub://org_id/dataset_name", ... path = "hub://org_id/dataset_name",
... exec_option = "tensor_db", ... runtime = {"tensor_db": True},
... ) ... )
Args: Args:
@ -114,6 +115,10 @@ class DeepLake(VectorStore):
responsible for storage and query execution. Only for data stored in responsible for storage and query execution. Only for data stored in
the Deep Lake Managed Database. Use runtime = {"db_engine": True} the Deep Lake Managed Database. Use runtime = {"db_engine": True}
during dataset creation. during dataset creation.
runtime (Dict, optional): Parameters for creating the Vector Store in
Deep Lake's Managed Tensor Database. Not applicable when loading an
existing Vector Store. To create a Vector Store in the Managed Tensor
Database, set `runtime = {"tensor_db": True}`.
**kwargs: Other optional keyword arguments. **kwargs: Other optional keyword arguments.
Raises: Raises:
@ -131,11 +136,12 @@ class DeepLake(VectorStore):
) )
if ( if (
kwargs.get("runtime") == {"tensor_db": True} runtime == {"tensor_db": True}
and version_compare(deeplake.__version__, "3.6.7") == -1 and version_compare(deeplake.__version__, "3.6.7") == -1
): ):
raise ImportError( raise ImportError(
"To use tensor_db option you need to update deeplake to `3.6.7`. " "To use tensor_db option you need to update deeplake to `3.6.7` or "
"higher. "
f"Currently installed deeplake version is {deeplake.__version__}. " f"Currently installed deeplake version is {deeplake.__version__}. "
) )
@ -154,6 +160,7 @@ class DeepLake(VectorStore):
token=token, token=token,
exec_option=exec_option, exec_option=exec_option,
verbose=verbose, verbose=verbose,
runtime=runtime,
**kwargs, **kwargs,
) )