Skip to main content
moss v1.0.1 moss / QueryOptions

Interface: QueryOptions

Optional parameters for MossClient.query().

Properties

PropertyTypeDescription
embeddingOptional[Sequence[float]]Caller-provided query embedding. When supplied, the service/client skips embedding generation.
top_kOptional[int]Number of top results to return.
alphaOptional[float]Weight for hybrid search fusion. 1.0 = pure semantic, 0.0 = pure keyword. Default 0.8.
filterOptional[dict]Metadata filter applied to the query. Only honored on locally loaded indexes — ignored (with a warning) when the query falls back to the cloud API.

Filter shape

The filter value is a dict with either a field condition or a logical composition:
# Field condition
{"field": "city", "condition": {"$eq": "NYC"}}

# Logical composition
{"$and": [filter_a, filter_b, ...]}
{"$or":  [filter_a, filter_b, ...]}
Supported condition operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $near.

Example

from moss import QueryOptions

options = QueryOptions(
    top_k=5,
    alpha=0.6,
    filter={
        "$and": [
            {"field": "category", "condition": {"$eq": "shoes"}},
            {"field": "price",    "condition": {"$lt": 100}},
        ],
    },
)