Native Python API#

__init__.Client(root_dir='.')#
__init__.Client.Create(self, table_name, model_name='HuggingFace')#

Create a new table with the specified embedding model.

Args:

table_name: the creating table name. model_name: the embedding model name, default to “HuggingFace”.

Returns:

True or False, whether creating table success.

__init__.Client.Add(self, doc)#

Add document into the current table, the format of doc is list of dict, each dict denotes a document.

Args:
doc: A list of documents for adding.

Each document denoted a dict, in which the key is a field, the value is a field value.

Returns:

True or False for adding documents.

__init__.Client.Search(self, query, topn, text_in_page_content: str | None = None, meta_filter: dict | None = None, not_include_fields: Set[str] | None = None, **kwargs: Any)#

Search API.

Args:

query: Search request. text or vector is valid. topn: The most topn similar results by searching. test_in_page_content: The filter text in page content, used in langchain. meta_filter: Meta filter, each key-value pair denotes field_name-field_value pair. not_include_fields: The fields not included in the returned search results.

Returns:

Search results, json format output.

__init__.Client.Get(self, ids: List[str] | None = None, text_in_page_content: str | None = None, meta_filter: dict | None = None, not_include_fields: Set[str] | None = None, limit: int | None = None, **kwargs: Any) list#
Get the documents which have the specified ids.

If ids is specified, text_in_page_content, meta_filter, and limit will be invalid.

Args:

ids: The ids of the embedding vectors. text_in_page_content: Filter by the text in page_content of Document in LangChain. meta_filter: Filter by any metadata of the document. not_include_fields: Not pack the specified fields of each document. limit: The number of documents to return. Optional. Defaults to 5.

Returns:

Documents which satisfy the input conditions.

__init__.Client.Delete(self, ids: List[str]) bool#

Delete the documents which have the specified ids.

Args:

ids: The id list of the updating embedding vector.

Returns:

True or False.

__init__.Client.ListAllTables(self) List[str]#

List all created tables.

Returns:

List of created table names.

__init__.Client.GetCurrentTable(self) str#

Get current using table name.

Returns:

The table name of using.

__init__.Client.Load(self, table_name) bool#

Load the specified table.

Args:

table_name: the loading table name.

Returns:

True or False, whether loading the specified table success.

__init__.Client.Use(self, table_name) bool#

Use the specified table engine.

Args:

table_name: the using table name.

Returns:

True or False, whether using the specified table engine success.

__init__.Client.Close(self, table_name: str | None = None)#

Close the specified table engine.

Args:

table_name: the table name of closing, default to None, means current using table engine.

Returns:

True or False, whether close table engine success.