Skip to main content
moss v1.0.1 moss / MossClient

MossClient

Semantic search client for vector similarity operations. All mutations and reads go through the Rust ManageClient. Querying uses the local IndexManager when the index is loaded, otherwise falls back to the cloud query API.

Methods

create_index(name, docs, model_id)

Create a new index and populate it with documents. When model_id is omitted, the SDK picks "moss-minilm" when no documents carry pre-computed embeddings and "custom" when every document provides an embedding. Mixed documents are rejected.

Parameters

  • name (str)
  • docs (List[DocumentInfo])
  • model_id (Optional[str] = None)

Returns

MutationResult

add_docs(name, docs, options)

Add or update documents in an index.

Parameters

Returns

MutationResult

delete_docs(name, doc_ids)

Delete documents from an index by their IDs.

Parameters

  • name (str)
  • doc_ids (List[str])

Returns

MutationResult

get_job_status(job_id)

Get the status of a bulk operation job.

Parameters

  • job_id (str)

Returns

JobStatusResponse

get_index(name)

Get information about a specific index.

Parameters

  • name (str)

Returns

IndexInfo

list_indexes()

List all indexes with their information.

Returns

List[IndexInfo]

delete_index(name)

Delete an index and all its data.

Parameters

  • name (str)

Returns

bool

get_docs(name, options)

Retrieve documents from an index.

Parameters

Returns

List[DocumentInfo]

load_index(name, auto_refresh, polling_interval_in_seconds)

Downloads an index from the cloud into memory for fast local querying. Without load_index(), query() falls back to the cloud API (~100-500ms). With load_index(), queries run entirely in-memory (~1-10ms).

Parameters

  • name (str)
  • auto_refresh (bool = False)
  • polling_interval_in_seconds (int = 600)

Returns

str

unload_index(name)

Unload an index from memory.

Parameters

  • name (str)

query(name, query, options)

Perform a semantic similarity search. If the index is loaded locally (via load_index), queries run in-memory. Otherwise, falls back to the cloud query API.

Parameters

  • name (str)
  • query (str)
  • options (Optional[QueryOptions] = None): Query options (top_k, alpha, embedding, filter). Example filter:

Returns

SearchResult