Skip to main content

MossClient

Semantic search client for vector similarity operations.

Methods

create_index()

create_index(index_name: str, docs: List[DocumentInfo], model_id: str) -> bool
Create a new index populated with documents. Parameters
NameTypeRequiredDescription
index_namestrYesName of the index to create.
docsList[DocumentInfo]YesDocuments to ingest into the index.
model_idstrYesIdentifier for the embedding model.
Returns bool - True if the creation request succeeded.

get_index()

get_index(index_name: str) -> IndexInfo
Retrieve metadata for a single index. Parameters
NameTypeRequiredDescription
index_namestrYesName of the index to inspect.
Returns IndexInfo - Metadata describing the requested index.

list_indexes()

list_indexes() -> List[IndexInfo]
List all indexes in the current project. Returns List[IndexInfo] - Collection of index metadata objects.

delete_index()

delete_index(index_name: str) -> bool
Delete an index and all associated documents. Parameters
NameTypeRequiredDescription
index_namestrYesName of the index to delete.
Returns bool - True if the deletion request succeeded.

load_index()

load_index(index_name: str) -> str
Load an index from persistent storage. Parameters
NameTypeRequiredDescription
index_namestrYesName of the index to load.
Returns str - Identifier or status describing the loaded index.

add_docs()

add_docs(index_name: str, docs: List[DocumentInfo], options: Optional[AddDocumentsOptions]) -> Dict[str, int]
Insert or update documents in an index. Parameters
NameTypeRequiredDescription
index_namestrYesTarget index name.
docsList[DocumentInfo]YesDocuments to add or upsert.
optionsOptional[AddDocumentsOptions]NoUpsert behavior overrides.
Returns Dict[str, int] - Mutation counts such as inserted or updated totals.

delete_docs()

delete_docs(index_name: str, doc_ids: List[str]) -> Dict[str, int]
Remove documents by identifier. Parameters
NameTypeRequiredDescription
index_namestrYesTarget index name.
doc_idsList[str]YesIdentifiers of documents to delete.
Returns Dict[str, int] - Summary counts for deleted documents.

get_docs()

get_docs(index_name: str, options: Optional[GetDocumentsOptions]) -> List[DocumentInfo]
Fetch documents stored in an index. Parameters
NameTypeRequiredDescription
index_namestrYesTarget index name.
optionsOptional[GetDocumentsOptions]NoRetrieval filters.
Returns List[DocumentInfo] - Documents that satisfy the filters.

query()

query(index_name: str, query: str, top_k: int, alpha: Optional[float]) -> SearchResult
Execute a semantic similarity search. Parameters
NameTypeRequiredDescription
index_namestrYesTarget index name.
querystrYesNatural language query string.
top_kintYesMaximum number of documents to return.
alphaOptional[float]NoHybrid weighting value.
Returns SearchResult - Ranked documents and metadata for the query.