MyScaleVectorStore#

class llama_index.vector_stores.MyScaleVectorStore(myscale_client: Optional[Any] = None, table: str = 'llama_index', database: str = 'default', index_type: str = 'MSTG', metric: str = 'cosine', batch_size: int = 32, index_params: Optional[dict] = None, search_params: Optional[dict] = None, service_context: Optional[ServiceContext] = None, **kwargs: Any)#

Bases: VectorStore

MyScale Vector Store.

In this vector store, embeddings and docs are stored within an existing MyScale cluster.

During query time, the index uses MyScale to query for the top k most similar nodes.

Parameters
  • myscale_client (httpclient) – clickhouse-connect httpclient of an existing MyScale cluster.

  • table (str, optional) – The name of the MyScale table where data will be stored. Defaults to “llama_index”.

  • database (str, optional) – The name of the MyScale database where data will be stored. Defaults to “default”.

  • index_type (str, optional) – The type of the MyScale vector index. Defaults to “IVFFLAT”.

  • metric (str, optional) – The metric type of the MyScale vector index. Defaults to “cosine”.

  • batch_size (int, optional) – the size of documents to insert. Defaults to 32.

  • index_params (dict, optional) – The index parameters for MyScale. Defaults to None.

  • search_params (dict, optional) – The search parameters for a MyScale query. Defaults to None.

  • service_context (ServiceContext, optional) – Vector store service context. Defaults to None

Attributes Summary

Methods Summary

add(nodes, **add_kwargs)

Add nodes to index.

delete(ref_doc_id, **delete_kwargs)

Delete nodes using with ref_doc_id.

drop()

Drop MyScale Index and table.

query(query, **kwargs)

Query index for top k most similar nodes.

Attributes Documentation

AMPLIFY_RATIO_GT5 = 20#
AMPLIFY_RATIO_GT50 = 10#
AMPLIFY_RATIO_LE5 = 100#
client#

Get client.

metadata_column: str = 'metadata'#
stores_text: bool = True#

Methods Documentation

add(nodes: List[BaseNode], **add_kwargs: Any) List[str]#

Add nodes to index.

Parameters

nodes – List[BaseNode]: list of nodes with embeddings

delete(ref_doc_id: str, **delete_kwargs: Any) None#

Delete nodes using with ref_doc_id.

Parameters

ref_doc_id (str) – The doc_id of the document to delete.

drop() None#

Drop MyScale Index and table.

query(query: VectorStoreQuery, **kwargs: Any) VectorStoreQueryResult#

Query index for top k most similar nodes.

Parameters

query (VectorStoreQuery) – query