Docker Python API#
- awadb_client.client.Awa(server_addr: str | None = None)#
Interface implemented by AwaDB service client
- awadb_client.client.Awa.__init__(self, server_addr: str | None = None)#
Initialize the AwaDB client.
- Args:
server_addr: AwaDB sever ip:port. Default to 0.0.0.0:50005.
- Returns:
None.
- awadb_client.client.Awa.add(self, table_name: str, docs, db_name: str = 'default') bool #
- Add documents into the specified table.
If table not existed, it will be created automatically.
- Args:
table_name: The specified table for search and storage.
- docs: The adding documents which can be described as dict or list of dicts.
Each key-value pair in dict is a field of document.
db_name: Database name, default to DEFAULT_DB_NAME.
- Returns:
Success or failure of adding the documents into the specified table.
- awadb_client.client.Awa.search(self, table_name: str, query, db_name: str = 'default', topn: int = 10, filters: dict | None = None, include_fields: Set[str] | None = None, brute_force_search: bool = False, metric_type: MetricType = MetricType.L2, mul_vec_weight: Dict[str, float] | None = None, **kwargs: Any)#
Vector search in the specified table.
- Args:
table_name: The specified table for search.
query: Input query, including vector or text. now just support vector query.
db_name: Database name, default to DEFAULT_DB_NAME.
topn: The topn nearest neighborhood documents to return.
filters (Optional[dict]): Filter by filters. Defaults to None.
E.g. {“color” : “red”, “price”: 4.20}. Optional.
E.g. {“max_price” : 15.66, “min_price”: 4.20}
price is the metadata field, means range filter(4.20<’price’<15.66).
E.g. {“maxe_price” : 15.66, “mine_price”: 4.20}
price is the metadata field, means range filter(4.20<=’price’<=15.66).
include_fields: The fields whether included in the search results.
- brute_force_search: Brute force search or not. Default to not.
If vectors not indexed, automatically to use brute force search.
metric_type: The distance type of computing vectors. Default to L2.
mul_vec_weight: Multiple vector field search weights. Default to None.
E.g. {‘f1’: 2.0, ‘f2’: 1.0} vector field f1 weight is 2.0, vector field f2 weight is 1.0.
Notice that field f1 and f2 should have the same dimension compared to query.
kwargs: Any possible extended parameters.
- Returns:
Results of searching.
- awadb_client.client.Awa.get(self, table_name: str, db_name: str = 'default', ids: list | None = None, filters: dict | None = None, include_fields: Set[str] | None = None, limit: int | None = None, **kwargs: Any)#
Get documents of the primary keys in the the specified table.
- Args:
table_name: The specified table for search and storage.
db_name: Database name, default to DEFAULT_DB_NAME.
ids: The primary keys of the queried documents.
filters: Filter by fields. Defaults to None.
E.g. {“color” : “red”, “price”: 4.20}. Optional.
E.g. {“max_price” : 15.66, “min_price”: 4.20}
price is the metadata field, means range filter(4.20<’price’<15.66).
E.g. {“maxe_price” : 15.66, “mine_price”: 4.20}
price is the metadata field, means range filter(4.20<=’price’<=15.66).
include_fields: The fields whether included in the get results.
limit: The limited return results.
- Returns:
The detailed information of the queried documents.
- awadb_client.client.Awa.delete(self, table_name: str, db_name: str = 'default', ids: list | None = None, filters: dict | None = None, **kwargs: Any) bool #
Delete docs in the specified table.
- Args:
table_name: The specified table for deleting.
db_name: Database name, default to DEFAULT_DB_NAME.
ids: The primary keys of the deleted documents.
filters: Filter by fields. Defaults to None.
E.g. {“color” : “red”, “price”: 4.20}. Optional.
E.g. {“max_price” : 15.66, “min_price”: 4.20}
price is the metadata field, means range filter(4.20<’price’<15.66).
E.g. {“maxe_price” : 15.66, “mine_price”: 4.20}
price is the metadata field, means range filter(4.20<=’price’<=15.66).
- Returns:
True of False of the deleting operation.
- awadb_client.client.Awa.close(self)#
Close the connection of AwaDB client and server.
Args: None.
Returns: None.