Class: Turbopuffer::Models::NamespaceMultiQueryParams::Query

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/turbopuffer/models/namespace_multi_query_params.rb,
sig/turbopuffer/models/namespace_multi_query_params.rbs

Defined Under Namespace

Modules: Limit

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(aggregate_by: nil, compute_attributes: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, offset: nil, rank_by: nil, top_k: nil) ⇒ Object

Some parameter documentations has been truncated, see Turbopuffer::Models::NamespaceMultiQueryParams::Query for more details.

Query, filter, full-text search and vector search documents.

Parameters:

  • aggregate_by (Hash{Symbol=>Object}) (defaults to: nil)

    Aggregations to compute over all documents in the namespace that match the filte

  • compute_attributes (Hash{Symbol=>Object}) (defaults to: nil)

    Computes additional values on documents returned by a query. Each key is the nam

  • distance_metric (Symbol, Turbopuffer::Models::DistanceMetric) (defaults to: nil)

    A function used to calculate vector similarity.

  • exclude_attributes (Array<String>) (defaults to: nil)

    List of attribute names to exclude from the response. All other attributes will

  • filters (Object) (defaults to: nil)

    Exact filters for attributes to refine search results for. Think of it as a SQL

  • group_by (Array<Object>) (defaults to: nil)

    Groups documents by the specified attributes (the "group key") before computing

  • include_attributes (Boolean, Array<String>) (defaults to: nil)

    Whether to include attributes in the response.

  • limit (Integer, Turbopuffer::Models::Limit) (defaults to: nil)

    Limits the documents returned by a query.

  • offset (Integer) (defaults to: nil)

    Number of documents to skip before returning results. Supported only in v2 queri

  • rank_by (Object) (defaults to: nil)

    How to rank the documents in the namespace.

  • top_k (Integer) (defaults to: nil)

    The number of results to return.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 73

class Query < Turbopuffer::Internal::Type::BaseModel
  # @!attribute aggregate_by
  #   Aggregations to compute over all documents in the namespace that match the
  #   filters.
  #
  #   @return [Hash{Symbol=>Object}, nil]
  optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]

  # @!attribute compute_attributes
  #   Computes additional values on documents returned by a query. Each key is the
  #   name of the computed attribute; each value is an expression describing how to
  #   compute it.
  #
  #   @return [Hash{Symbol=>Object}, nil]
  optional :compute_attributes, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]

  # @!attribute distance_metric
  #   A function used to calculate vector similarity.
  #
  #   @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
  optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }

  # @!attribute exclude_attributes
  #   List of attribute names to exclude from the response. All other attributes will
  #   be included in the response.
  #
  #   @return [Array<String>, nil]
  optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]

  # @!attribute filters
  #   Exact filters for attributes to refine search results for. Think of it as a SQL
  #   WHERE clause.
  #
  #   @return [Object, nil]
  optional :filters, Turbopuffer::Internal::Type::Unknown

  # @!attribute group_by
  #   Groups documents by the specified attributes (the "group key") before computing
  #   aggregates. Aggregates are computed separately for each group.
  #
  #   @return [Array<Object>, nil]
  optional :group_by, Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Internal::Type::Unknown]

  # @!attribute include_attributes
  #   Whether to include attributes in the response.
  #
  #   @return [Boolean, Array<String>, nil]
  optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }

  # @!attribute limit
  #   Limits the documents returned by a query.
  #
  #   @return [Integer, Turbopuffer::Models::Limit, nil]
  optional :limit, union: -> { Turbopuffer::NamespaceMultiQueryParams::Query::Limit }

  # @!attribute offset
  #   Number of documents to skip before returning results. Supported only in v2
  #   queries with an explicit `rank_by` and `top_k` or `limit`.
  #
  #   @return [Integer, nil]
  optional :offset, Integer

  # @!attribute rank_by
  #   How to rank the documents in the namespace.
  #
  #   @return [Object, nil]
  optional :rank_by, Turbopuffer::Internal::Type::Unknown

  # @!attribute top_k
  #   The number of results to return.
  #
  #   @return [Integer, nil]
  optional :top_k, Integer

  # @!method initialize(aggregate_by: nil, compute_attributes: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, offset: nil, rank_by: nil, top_k: nil)
  #   Some parameter documentations has been truncated, see
  #   {Turbopuffer::Models::NamespaceMultiQueryParams::Query} for more details.
  #
  #   Query, filter, full-text search and vector search documents.
  #
  #   @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
  #
  #   @param compute_attributes [Hash{Symbol=>Object}] Computes additional values on documents returned by a query. Each key is the nam
  #
  #   @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
  #
  #   @param exclude_attributes [Array<String>] List of attribute names to exclude from the response. All other attributes will
  #
  #   @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
  #
  #   @param group_by [Array<Object>] Groups documents by the specified attributes (the "group key") before computing
  #
  #   @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
  #
  #   @param limit [Integer, Turbopuffer::Models::Limit] Limits the documents returned by a query.
  #
  #   @param offset [Integer] Number of documents to skip before returning results. Supported only in v2 queri
  #
  #   @param rank_by [Object] How to rank the documents in the namespace.
  #
  #   @param top_k [Integer] The number of results to return.

  # Limits the documents returned by a query.
  #
  # @see Turbopuffer::Models::NamespaceMultiQueryParams::Query#limit
  module Limit
    extend Turbopuffer::Internal::Type::Union

    variant Integer

    # Limits the documents returned by a query.
    variant -> { Turbopuffer::Limit }

    # @!method self.variants
    #   @return [Array(Integer, Turbopuffer::Models::Limit)]
  end
end

Instance Attribute Details

#aggregate_byHash{Symbol=>Object}?

Aggregations to compute over all documents in the namespace that match the filters.

Parameters:

  • (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object}, nil)


79
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 79

optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]

#compute_attributesHash{Symbol=>Object}?

Computes additional values on documents returned by a query. Each key is the name of the computed attribute; each value is an expression describing how to compute it.

Parameters:

  • (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object}, nil)


87
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 87

optional :compute_attributes, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]

#distance_metricSymbol, ...

A function used to calculate vector similarity.

Returns:



93
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 93

optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }

#exclude_attributesArray<String>?

List of attribute names to exclude from the response. All other attributes will be included in the response.

Parameters:

  • (::Array[String])

Returns:

  • (Array<String>, nil)


100
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 100

optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]

#filtersObject?

Exact filters for attributes to refine search results for. Think of it as a SQL WHERE clause.

Parameters:

  • (top)

Returns:

  • (Object, nil)


107
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 107

optional :filters, Turbopuffer::Internal::Type::Unknown

#group_byArray<Object>?

Groups documents by the specified attributes (the "group key") before computing aggregates. Aggregates are computed separately for each group.

Parameters:

  • (::Array[top])

Returns:

  • (Array<Object>, nil)


114
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 114

optional :group_by, Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Internal::Type::Unknown]

#include_attributesBoolean, ...

Whether to include attributes in the response.

Returns:

  • (Boolean, Array<String>, nil)


120
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 120

optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }

#limitInteger, ...

Limits the documents returned by a query.

Returns:



126
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 126

optional :limit, union: -> { Turbopuffer::NamespaceMultiQueryParams::Query::Limit }

#offsetInteger?

Number of documents to skip before returning results. Supported only in v2 queries with an explicit rank_by and top_k or limit.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


133
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 133

optional :offset, Integer

#rank_byObject?

How to rank the documents in the namespace.

Parameters:

  • (top)

Returns:

  • (Object, nil)


139
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 139

optional :rank_by, Turbopuffer::Internal::Type::Unknown

#top_kInteger?

The number of results to return.

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


145
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 145

optional :top_k, Integer

Instance Method Details

#to_hash{

Returns:

  • ({)


153
# File 'sig/turbopuffer/models/namespace_multi_query_params.rbs', line 153

def to_hash: -> {