class Turbopuffer::Resources::Namespaces
def query(params = {})
- See: Turbopuffer::Models::NamespaceQueryParams -
Returns:
-
(Turbopuffer::Models::NamespaceQueryResponse)
-
Parameters:
-
request_options
(Turbopuffer::RequestOptions, Hash{Symbol=>Object}, nil
) -- -
vector_encoding
(Symbol, Turbopuffer::Models::VectorEncoding
) -- Body param: The encoding to use for vectors in the response. -
top_k
(Integer
) -- Body param: The number of results to return. -
rank_by
(Object
) -- Body param: How to rank the documents in the namespace. -
include_attributes
(Boolean, Array
) -- Body param: Whether to include attributes in the response. -
filters
(Object
) -- Body param: Exact filters for attributes to refine search results for. Think of -
distance_metric
(Symbol, Turbopuffer::Models::DistanceMetric
) -- Body param: A function used to calculate vector similarity. -
consistency
(Turbopuffer::Models::NamespaceQueryParams::Consistency
) -- Body param: The consistency level for a query. -
aggregate_by
(Hash{Symbol=>Object}
) -- Body param: Aggregations to compute over all documents in the namespace that mat -
namespace
(String
) -- Path param: The name of the namespace.
Overloads:
-
query(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, filters: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
def query(params = {}) parsed, options = Turbopuffer::NamespaceQueryParams.dump_request(params) namespace = parsed.delete(:namespace) do @client.default_namespace end @client.request( method: :post, path: ["v2/namespaces/%1$s/query", namespace], body: parsed, model: Turbopuffer::Models::NamespaceQueryResponse, options: options ) end