turbopuffer-ruby 0.2.0.pre.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ignore +2 -0
- data/CHANGELOG.md +60 -0
- data/README.md +291 -0
- data/SECURITY.md +27 -0
- data/lib/turbopuffer/client.rb +130 -0
- data/lib/turbopuffer/errors.rb +214 -0
- data/lib/turbopuffer/file_part.rb +55 -0
- data/lib/turbopuffer/internal/namespace_page.rb +86 -0
- data/lib/turbopuffer/internal/transport/base_client.rb +563 -0
- data/lib/turbopuffer/internal/transport/pooled_net_requester.rb +209 -0
- data/lib/turbopuffer/internal/type/array_of.rb +167 -0
- data/lib/turbopuffer/internal/type/base_model.rb +534 -0
- data/lib/turbopuffer/internal/type/base_page.rb +55 -0
- data/lib/turbopuffer/internal/type/boolean.rb +77 -0
- data/lib/turbopuffer/internal/type/converter.rb +300 -0
- data/lib/turbopuffer/internal/type/enum.rb +152 -0
- data/lib/turbopuffer/internal/type/file_input.rb +108 -0
- data/lib/turbopuffer/internal/type/hash_of.rb +187 -0
- data/lib/turbopuffer/internal/type/request_parameters.rb +42 -0
- data/lib/turbopuffer/internal/type/union.rb +252 -0
- data/lib/turbopuffer/internal/type/unknown.rb +81 -0
- data/lib/turbopuffer/internal/util.rb +914 -0
- data/lib/turbopuffer/internal.rb +20 -0
- data/lib/turbopuffer/models/attribute_schema.rb +19 -0
- data/lib/turbopuffer/models/attribute_schema_config.rb +48 -0
- data/lib/turbopuffer/models/attribute_type.rb +7 -0
- data/lib/turbopuffer/models/client_namespaces_params.rb +38 -0
- data/lib/turbopuffer/models/columns.rb +64 -0
- data/lib/turbopuffer/models/distance_metric.rb +19 -0
- data/lib/turbopuffer/models/full_text_search.rb +20 -0
- data/lib/turbopuffer/models/full_text_search_config.rb +72 -0
- data/lib/turbopuffer/models/id.rb +19 -0
- data/lib/turbopuffer/models/include_attributes.rb +22 -0
- data/lib/turbopuffer/models/language.rb +32 -0
- data/lib/turbopuffer/models/namespace_delete_all_params.rb +20 -0
- data/lib/turbopuffer/models/namespace_delete_all_response.rb +19 -0
- data/lib/turbopuffer/models/namespace_hint_cache_warm_params.rb +20 -0
- data/lib/turbopuffer/models/namespace_hint_cache_warm_response.rb +26 -0
- data/lib/turbopuffer/models/namespace_metadata.rb +35 -0
- data/lib/turbopuffer/models/namespace_metadata_params.rb +20 -0
- data/lib/turbopuffer/models/namespace_multi_query_params.rb +73 -0
- data/lib/turbopuffer/models/namespace_multi_query_response.rb +51 -0
- data/lib/turbopuffer/models/namespace_query_params.rb +119 -0
- data/lib/turbopuffer/models/namespace_query_response.rb +41 -0
- data/lib/turbopuffer/models/namespace_recall_params.rb +57 -0
- data/lib/turbopuffer/models/namespace_recall_response.rb +39 -0
- data/lib/turbopuffer/models/namespace_schema_params.rb +20 -0
- data/lib/turbopuffer/models/namespace_schema_response.rb +8 -0
- data/lib/turbopuffer/models/namespace_summary.rb +19 -0
- data/lib/turbopuffer/models/namespace_update_schema_params.rb +29 -0
- data/lib/turbopuffer/models/namespace_update_schema_response.rb +9 -0
- data/lib/turbopuffer/models/namespace_write_params.rb +158 -0
- data/lib/turbopuffer/models/namespace_write_response.rb +67 -0
- data/lib/turbopuffer/models/query.rb +63 -0
- data/lib/turbopuffer/models/query_billing.rb +26 -0
- data/lib/turbopuffer/models/query_performance.rb +63 -0
- data/lib/turbopuffer/models/row.rb +38 -0
- data/lib/turbopuffer/models/tokenizer.rb +17 -0
- data/lib/turbopuffer/models/vector.rb +22 -0
- data/lib/turbopuffer/models/vector_encoding.rb +16 -0
- data/lib/turbopuffer/models/write_billing.rb +26 -0
- data/lib/turbopuffer/models.rb +101 -0
- data/lib/turbopuffer/namespace.rb +22 -0
- data/lib/turbopuffer/request_options.rb +77 -0
- data/lib/turbopuffer/resources/namespaces.rb +311 -0
- data/lib/turbopuffer/version.rb +5 -0
- data/lib/turbopuffer.rb +94 -0
- data/manifest.yaml +15 -0
- data/rbi/turbopuffer/client.rbi +91 -0
- data/rbi/turbopuffer/errors.rbi +178 -0
- data/rbi/turbopuffer/file_part.rbi +37 -0
- data/rbi/turbopuffer/internal/namespace_page.rbi +22 -0
- data/rbi/turbopuffer/internal/transport/base_client.rbi +298 -0
- data/rbi/turbopuffer/internal/transport/pooled_net_requester.rbi +80 -0
- data/rbi/turbopuffer/internal/type/array_of.rbi +104 -0
- data/rbi/turbopuffer/internal/type/base_model.rbi +304 -0
- data/rbi/turbopuffer/internal/type/base_page.rbi +43 -0
- data/rbi/turbopuffer/internal/type/boolean.rbi +58 -0
- data/rbi/turbopuffer/internal/type/converter.rbi +162 -0
- data/rbi/turbopuffer/internal/type/enum.rbi +82 -0
- data/rbi/turbopuffer/internal/type/file_input.rbi +59 -0
- data/rbi/turbopuffer/internal/type/hash_of.rbi +104 -0
- data/rbi/turbopuffer/internal/type/request_parameters.rbi +31 -0
- data/rbi/turbopuffer/internal/type/union.rbi +121 -0
- data/rbi/turbopuffer/internal/type/unknown.rbi +58 -0
- data/rbi/turbopuffer/internal/util.rbi +487 -0
- data/rbi/turbopuffer/internal.rbi +18 -0
- data/rbi/turbopuffer/models/attribute_schema.rbi +17 -0
- data/rbi/turbopuffer/models/attribute_schema_config.rbi +92 -0
- data/rbi/turbopuffer/models/attribute_type.rbi +7 -0
- data/rbi/turbopuffer/models/client_namespaces_params.rbi +71 -0
- data/rbi/turbopuffer/models/columns.rbi +82 -0
- data/rbi/turbopuffer/models/distance_metric.rbi +27 -0
- data/rbi/turbopuffer/models/full_text_search.rbi +19 -0
- data/rbi/turbopuffer/models/full_text_search_config.rbi +116 -0
- data/rbi/turbopuffer/models/id.rbi +16 -0
- data/rbi/turbopuffer/models/include_attributes.rbi +24 -0
- data/rbi/turbopuffer/models/language.rbi +36 -0
- data/rbi/turbopuffer/models/namespace_delete_all_params.rbi +41 -0
- data/rbi/turbopuffer/models/namespace_delete_all_response.rbi +31 -0
- data/rbi/turbopuffer/models/namespace_hint_cache_warm_params.rbi +41 -0
- data/rbi/turbopuffer/models/namespace_hint_cache_warm_response.rbi +38 -0
- data/rbi/turbopuffer/models/namespace_metadata.rbi +54 -0
- data/rbi/turbopuffer/models/namespace_metadata_params.rbi +41 -0
- data/rbi/turbopuffer/models/namespace_multi_query_params.rbi +175 -0
- data/rbi/turbopuffer/models/namespace_multi_query_response.rbi +111 -0
- data/rbi/turbopuffer/models/namespace_query_params.rbi +241 -0
- data/rbi/turbopuffer/models/namespace_query_response.rbi +73 -0
- data/rbi/turbopuffer/models/namespace_recall_params.rbi +93 -0
- data/rbi/turbopuffer/models/namespace_recall_response.rbi +59 -0
- data/rbi/turbopuffer/models/namespace_schema_params.rbi +41 -0
- data/rbi/turbopuffer/models/namespace_schema_response.rbi +11 -0
- data/rbi/turbopuffer/models/namespace_summary.rbi +28 -0
- data/rbi/turbopuffer/models/namespace_update_schema_params.rbi +80 -0
- data/rbi/turbopuffer/models/namespace_update_schema_response.rbi +11 -0
- data/rbi/turbopuffer/models/namespace_write_params.rbi +290 -0
- data/rbi/turbopuffer/models/namespace_write_response.rbi +101 -0
- data/rbi/turbopuffer/models/query.rbi +106 -0
- data/rbi/turbopuffer/models/query_billing.rbi +46 -0
- data/rbi/turbopuffer/models/query_performance.rbi +82 -0
- data/rbi/turbopuffer/models/row.rbi +47 -0
- data/rbi/turbopuffer/models/tokenizer.rbi +22 -0
- data/rbi/turbopuffer/models/vector.rbi +22 -0
- data/rbi/turbopuffer/models/vector_encoding.rbi +22 -0
- data/rbi/turbopuffer/models/write_billing.rbi +49 -0
- data/rbi/turbopuffer/models.rbi +64 -0
- data/rbi/turbopuffer/namespace.rbi +8 -0
- data/rbi/turbopuffer/request_options.rbi +59 -0
- data/rbi/turbopuffer/resources/namespaces.rbi +243 -0
- data/rbi/turbopuffer/version.rbi +5 -0
- data/sig/turbopuffer/client.rbs +41 -0
- data/sig/turbopuffer/errors.rbs +110 -0
- data/sig/turbopuffer/file_part.rbs +21 -0
- data/sig/turbopuffer/internal/namespace_page.rbs +13 -0
- data/sig/turbopuffer/internal/transport/base_client.rbs +131 -0
- data/sig/turbopuffer/internal/transport/pooled_net_requester.rbs +45 -0
- data/sig/turbopuffer/internal/type/array_of.rbs +48 -0
- data/sig/turbopuffer/internal/type/base_model.rbs +102 -0
- data/sig/turbopuffer/internal/type/base_page.rbs +24 -0
- data/sig/turbopuffer/internal/type/boolean.rbs +26 -0
- data/sig/turbopuffer/internal/type/converter.rbs +62 -0
- data/sig/turbopuffer/internal/type/enum.rbs +32 -0
- data/sig/turbopuffer/internal/type/file_input.rbs +25 -0
- data/sig/turbopuffer/internal/type/hash_of.rbs +48 -0
- data/sig/turbopuffer/internal/type/request_parameters.rbs +19 -0
- data/sig/turbopuffer/internal/type/union.rbs +52 -0
- data/sig/turbopuffer/internal/type/unknown.rbs +26 -0
- data/sig/turbopuffer/internal/util.rbs +185 -0
- data/sig/turbopuffer/internal.rbs +9 -0
- data/sig/turbopuffer/models/attribute_schema.rbs +11 -0
- data/sig/turbopuffer/models/attribute_schema_config.rbs +45 -0
- data/sig/turbopuffer/models/attribute_type.rbs +5 -0
- data/sig/turbopuffer/models/client_namespaces_params.rbs +38 -0
- data/sig/turbopuffer/models/columns.rbs +42 -0
- data/sig/turbopuffer/models/distance_metric.rbs +17 -0
- data/sig/turbopuffer/models/full_text_search.rbs +11 -0
- data/sig/turbopuffer/models/full_text_search_config.rbs +68 -0
- data/sig/turbopuffer/models/id.rbs +11 -0
- data/sig/turbopuffer/models/include_attributes.rbs +13 -0
- data/sig/turbopuffer/models/language.rbs +48 -0
- data/sig/turbopuffer/models/namespace_delete_all_params.rbs +25 -0
- data/sig/turbopuffer/models/namespace_delete_all_response.rbs +13 -0
- data/sig/turbopuffer/models/namespace_hint_cache_warm_params.rbs +25 -0
- data/sig/turbopuffer/models/namespace_hint_cache_warm_response.rbs +17 -0
- data/sig/turbopuffer/models/namespace_metadata.rbs +30 -0
- data/sig/turbopuffer/models/namespace_metadata_params.rbs +25 -0
- data/sig/turbopuffer/models/namespace_multi_query_params.rbs +86 -0
- data/sig/turbopuffer/models/namespace_multi_query_response.rbs +53 -0
- data/sig/turbopuffer/models/namespace_query_params.rbs +125 -0
- data/sig/turbopuffer/models/namespace_query_response.rbs +39 -0
- data/sig/turbopuffer/models/namespace_recall_params.rbs +56 -0
- data/sig/turbopuffer/models/namespace_recall_response.rbs +26 -0
- data/sig/turbopuffer/models/namespace_schema_params.rbs +25 -0
- data/sig/turbopuffer/models/namespace_schema_response.rbs +8 -0
- data/sig/turbopuffer/models/namespace_summary.rbs +13 -0
- data/sig/turbopuffer/models/namespace_update_schema_params.rbs +37 -0
- data/sig/turbopuffer/models/namespace_update_schema_response.rbs +8 -0
- data/sig/turbopuffer/models/namespace_write_params.rbs +156 -0
- data/sig/turbopuffer/models/namespace_write_response.rbs +56 -0
- data/sig/turbopuffer/models/query.rbs +61 -0
- data/sig/turbopuffer/models/query_billing.rbs +25 -0
- data/sig/turbopuffer/models/query_performance.rbs +45 -0
- data/sig/turbopuffer/models/row.rbs +24 -0
- data/sig/turbopuffer/models/tokenizer.rbs +15 -0
- data/sig/turbopuffer/models/vector.rbs +13 -0
- data/sig/turbopuffer/models/vector_encoding.rbs +14 -0
- data/sig/turbopuffer/models/write_billing.rbs +27 -0
- data/sig/turbopuffer/models.rbs +61 -0
- data/sig/turbopuffer/namespace.rbs +5 -0
- data/sig/turbopuffer/request_options.rbs +36 -0
- data/sig/turbopuffer/resources/namespaces.rbs +81 -0
- data/sig/turbopuffer/version.rbs +3 -0
- metadata +251 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Internal
|
5
|
+
extend Turbopuffer::Internal::Util::SorbetRuntimeSupport
|
6
|
+
|
7
|
+
OMIT =
|
8
|
+
Object.new.tap do
|
9
|
+
_1.define_singleton_method(:inspect) { "#<#{Turbopuffer::Internal}::OMIT>" }
|
10
|
+
end
|
11
|
+
.freeze
|
12
|
+
|
13
|
+
define_sorbet_constant!(:AnyHash) do
|
14
|
+
T.type_alias { T::Hash[Symbol, T.anything] }
|
15
|
+
end
|
16
|
+
define_sorbet_constant!(:FileInput) do
|
17
|
+
T.type_alias { T.any(Pathname, StringIO, IO, String, Turbopuffer::FilePart) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# The schema for an attribute attached to a document.
|
6
|
+
module AttributeSchema
|
7
|
+
extend Turbopuffer::Internal::Type::Union
|
8
|
+
|
9
|
+
# The data type of the attribute. Valid values: string, int, uint, uuid, datetime, bool, []string, []int, []uint, []uuid, []datetime, [DIMS]f16, [DIMS]f32.
|
10
|
+
variant -> { Turbopuffer::AttributeType }
|
11
|
+
|
12
|
+
# Detailed configuration for an attribute attached to a document.
|
13
|
+
variant -> { Turbopuffer::AttributeSchemaConfig }
|
14
|
+
|
15
|
+
# @!method self.variants
|
16
|
+
# @return [Array(String, Turbopuffer::Models::AttributeSchemaConfig)]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class AttributeSchemaConfig < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
# @!attribute ann
|
7
|
+
# Whether to create an approximate nearest neighbor index for the attribute.
|
8
|
+
#
|
9
|
+
# @return [Boolean, nil]
|
10
|
+
optional :ann, Turbopuffer::Internal::Type::Boolean
|
11
|
+
|
12
|
+
# @!attribute filterable
|
13
|
+
# Whether or not the attributes can be used in filters.
|
14
|
+
#
|
15
|
+
# @return [Boolean, nil]
|
16
|
+
optional :filterable, Turbopuffer::Internal::Type::Boolean
|
17
|
+
|
18
|
+
# @!attribute full_text_search
|
19
|
+
# Whether this attribute can be used as part of a BM25 full-text search. Requires
|
20
|
+
# the `string` or `[]string` type, and by default, BM25-enabled attributes are not
|
21
|
+
# filterable. You can override this by setting `filterable: true`.
|
22
|
+
#
|
23
|
+
# @return [Boolean, Turbopuffer::Models::FullTextSearchConfig, nil]
|
24
|
+
optional :full_text_search, union: -> { Turbopuffer::FullTextSearch }
|
25
|
+
|
26
|
+
# @!attribute type
|
27
|
+
# The data type of the attribute. Valid values: string, int, uint, uuid, datetime,
|
28
|
+
# bool, []string, []int, []uint, []uuid, []datetime, [DIMS]f16, [DIMS]f32.
|
29
|
+
#
|
30
|
+
# @return [String, nil]
|
31
|
+
optional :type, String
|
32
|
+
|
33
|
+
# @!method initialize(ann: nil, filterable: nil, full_text_search: nil, type: nil)
|
34
|
+
# Some parameter documentations has been truncated, see
|
35
|
+
# {Turbopuffer::Models::AttributeSchemaConfig} for more details.
|
36
|
+
#
|
37
|
+
# Detailed configuration for an attribute attached to a document.
|
38
|
+
#
|
39
|
+
# @param ann [Boolean] Whether to create an approximate nearest neighbor index for the attribute.
|
40
|
+
#
|
41
|
+
# @param filterable [Boolean] Whether or not the attributes can be used in filters.
|
42
|
+
#
|
43
|
+
# @param full_text_search [Boolean, Turbopuffer::Models::FullTextSearchConfig] Whether this attribute can be used as part of a BM25 full-text search. Requires
|
44
|
+
#
|
45
|
+
# @param type [String] The data type of the attribute. Valid values: string, int, uint, uuid, datetime,
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Client#namespaces
|
6
|
+
class ClientNamespacesParams < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
8
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute cursor
|
11
|
+
# Retrieve the next page of results.
|
12
|
+
#
|
13
|
+
# @return [String, nil]
|
14
|
+
optional :cursor, String
|
15
|
+
|
16
|
+
# @!attribute page_size
|
17
|
+
# Limit the number of results per page.
|
18
|
+
#
|
19
|
+
# @return [Integer, nil]
|
20
|
+
optional :page_size, Integer
|
21
|
+
|
22
|
+
# @!attribute prefix
|
23
|
+
# Retrieve only the namespaces that match the prefix.
|
24
|
+
#
|
25
|
+
# @return [String, nil]
|
26
|
+
optional :prefix, String
|
27
|
+
|
28
|
+
# @!method initialize(cursor: nil, page_size: nil, prefix: nil, request_options: {})
|
29
|
+
# @param cursor [String] Retrieve the next page of results.
|
30
|
+
#
|
31
|
+
# @param page_size [Integer] Limit the number of results per page.
|
32
|
+
#
|
33
|
+
# @param prefix [String] Retrieve only the namespaces that match the prefix.
|
34
|
+
#
|
35
|
+
# @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class Columns < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
# @!attribute id
|
7
|
+
# The IDs of the documents.
|
8
|
+
#
|
9
|
+
# @return [Array<String, Integer>]
|
10
|
+
required :id, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }
|
11
|
+
|
12
|
+
# @!attribute vector
|
13
|
+
# The vector embeddings of the documents.
|
14
|
+
#
|
15
|
+
# @return [Array<Array<Float>, String>, Array<Float>, String, nil]
|
16
|
+
optional :vector, union: -> { Turbopuffer::Columns::Vector }
|
17
|
+
|
18
|
+
# @!method initialize(id:, vector: nil)
|
19
|
+
# A list of documents in columnar format. Each key is a column name, mapped to an
|
20
|
+
# array of values for that column.
|
21
|
+
#
|
22
|
+
# @param id [Array<String, Integer>] The IDs of the documents.
|
23
|
+
#
|
24
|
+
# @param vector [Array<Array<Float>, String>, Array<Float>, String] The vector embeddings of the documents.
|
25
|
+
|
26
|
+
# The vector embeddings of the documents.
|
27
|
+
#
|
28
|
+
# @see Turbopuffer::Models::Columns#vector
|
29
|
+
module Vector
|
30
|
+
extend Turbopuffer::Internal::Type::Union
|
31
|
+
|
32
|
+
# The vector embeddings of the documents.
|
33
|
+
variant -> { Turbopuffer::Models::Columns::Vector::VectorArray }
|
34
|
+
|
35
|
+
# A dense vector encoded as an array of floats.
|
36
|
+
variant -> { Turbopuffer::Models::Columns::Vector::FloatArray }
|
37
|
+
|
38
|
+
# A dense vector encoded as a base64 string.
|
39
|
+
variant String
|
40
|
+
|
41
|
+
# @!method self.variants
|
42
|
+
# @return [Array(Array<Array<Float>, String>, Array<Float>, String)]
|
43
|
+
|
44
|
+
# @type [Turbopuffer::Internal::Type::Converter]
|
45
|
+
VectorArray = Turbopuffer::Internal::Type::ArrayOf[union: -> { Turbopuffer::Vector }]
|
46
|
+
|
47
|
+
# @type [Turbopuffer::Internal::Type::Converter]
|
48
|
+
FloatArray = Turbopuffer::Internal::Type::ArrayOf[Float]
|
49
|
+
end
|
50
|
+
|
51
|
+
def method_missing(name, *args, &block)
|
52
|
+
if @data.key?(name)
|
53
|
+
@data[name]
|
54
|
+
else
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def respond_to_missing?(name, include_private = false)
|
60
|
+
@data.key?(name) || super
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# A function used to calculate vector similarity.
|
6
|
+
module DistanceMetric
|
7
|
+
extend Turbopuffer::Internal::Type::Enum
|
8
|
+
|
9
|
+
# Defined as `1 - cosine_similarity` and ranges from 0 to 2. Lower is better.
|
10
|
+
COSINE_DISTANCE = :cosine_distance
|
11
|
+
|
12
|
+
# Defined as `sum((x - y)^2)`. Lower is better.
|
13
|
+
EUCLIDEAN_SQUARED = :euclidean_squared
|
14
|
+
|
15
|
+
# @!method self.values
|
16
|
+
# @return [Array<Symbol>]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# Whether this attribute can be used as part of a BM25 full-text search. Requires
|
6
|
+
# the `string` or `[]string` type, and by default, BM25-enabled attributes are not
|
7
|
+
# filterable. You can override this by setting `filterable: true`.
|
8
|
+
module FullTextSearch
|
9
|
+
extend Turbopuffer::Internal::Type::Union
|
10
|
+
|
11
|
+
variant Turbopuffer::Internal::Type::Boolean
|
12
|
+
|
13
|
+
# Configuration options for full-text search.
|
14
|
+
variant -> { Turbopuffer::FullTextSearchConfig }
|
15
|
+
|
16
|
+
# @!method self.variants
|
17
|
+
# @return [Array(Boolean, Turbopuffer::Models::FullTextSearchConfig)]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class FullTextSearchConfig < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
# @!attribute b
|
7
|
+
# The `b` document length normalization parameter for BM25. Defaults to `0.75`.
|
8
|
+
#
|
9
|
+
# @return [Float, nil]
|
10
|
+
optional :b, Float
|
11
|
+
|
12
|
+
# @!attribute case_sensitive
|
13
|
+
# Whether searching is case-sensitive. Defaults to `false` (i.e.
|
14
|
+
# case-insensitive).
|
15
|
+
#
|
16
|
+
# @return [Boolean, nil]
|
17
|
+
optional :case_sensitive, Turbopuffer::Internal::Type::Boolean
|
18
|
+
|
19
|
+
# @!attribute k1
|
20
|
+
# The `k1` term saturation parameter for BM25. Defaults to `1.2`.
|
21
|
+
#
|
22
|
+
# @return [Float, nil]
|
23
|
+
optional :k1, Float
|
24
|
+
|
25
|
+
# @!attribute language
|
26
|
+
# Describes the language of a text attribute. Defaults to `english`.
|
27
|
+
#
|
28
|
+
# @return [Symbol, Turbopuffer::Models::Language, nil]
|
29
|
+
optional :language, enum: -> { Turbopuffer::Language }
|
30
|
+
|
31
|
+
# @!attribute remove_stopwords
|
32
|
+
# Removes common words from the text based on language. Defaults to `true` (i.e.
|
33
|
+
# remove common words).
|
34
|
+
#
|
35
|
+
# @return [Boolean, nil]
|
36
|
+
optional :remove_stopwords, Turbopuffer::Internal::Type::Boolean
|
37
|
+
|
38
|
+
# @!attribute stemming
|
39
|
+
# Language-specific stemming for the text. Defaults to `false` (i.e., do not
|
40
|
+
# stem).
|
41
|
+
#
|
42
|
+
# @return [Boolean, nil]
|
43
|
+
optional :stemming, Turbopuffer::Internal::Type::Boolean
|
44
|
+
|
45
|
+
# @!attribute tokenizer
|
46
|
+
# The tokenizer to use for full-text search on an attribute.
|
47
|
+
#
|
48
|
+
# @return [Symbol, Turbopuffer::Models::Tokenizer, nil]
|
49
|
+
optional :tokenizer, enum: -> { Turbopuffer::Tokenizer }
|
50
|
+
|
51
|
+
# @!method initialize(b: nil, case_sensitive: nil, k1: nil, language: nil, remove_stopwords: nil, stemming: nil, tokenizer: nil)
|
52
|
+
# Some parameter documentations has been truncated, see
|
53
|
+
# {Turbopuffer::Models::FullTextSearchConfig} for more details.
|
54
|
+
#
|
55
|
+
# Configuration options for full-text search.
|
56
|
+
#
|
57
|
+
# @param b [Float] The `b` document length normalization parameter for BM25. Defaults to `0.75`.
|
58
|
+
#
|
59
|
+
# @param case_sensitive [Boolean] Whether searching is case-sensitive. Defaults to `false` (i.e. case-insensitive)
|
60
|
+
#
|
61
|
+
# @param k1 [Float] The `k1` term saturation parameter for BM25. Defaults to `1.2`.
|
62
|
+
#
|
63
|
+
# @param language [Symbol, Turbopuffer::Models::Language] Describes the language of a text attribute. Defaults to `english`.
|
64
|
+
#
|
65
|
+
# @param remove_stopwords [Boolean] Removes common words from the text based on language. Defaults to `true` (i.e. r
|
66
|
+
#
|
67
|
+
# @param stemming [Boolean] Language-specific stemming for the text. Defaults to `false` (i.e., do not stem)
|
68
|
+
#
|
69
|
+
# @param tokenizer [Symbol, Turbopuffer::Models::Tokenizer] The tokenizer to use for full-text search on an attribute.
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# An identifier for a document.
|
6
|
+
module ID
|
7
|
+
extend Turbopuffer::Internal::Type::Union
|
8
|
+
|
9
|
+
# A UUID.
|
10
|
+
variant String
|
11
|
+
|
12
|
+
# An integer ID.
|
13
|
+
variant Integer
|
14
|
+
|
15
|
+
# @!method self.variants
|
16
|
+
# @return [Array(String, Integer)]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# Whether to include attributes in the response.
|
6
|
+
module IncludeAttributes
|
7
|
+
extend Turbopuffer::Internal::Type::Union
|
8
|
+
|
9
|
+
# When `true`, include all attributes in the response. When `false`, include no attributes in the response.
|
10
|
+
variant Turbopuffer::Internal::Type::Boolean
|
11
|
+
|
12
|
+
# Include exactly the specified attributes in the response.
|
13
|
+
variant -> { Turbopuffer::Models::IncludeAttributes::StringArray }
|
14
|
+
|
15
|
+
# @!method self.variants
|
16
|
+
# @return [Array(Boolean, Array<String>)]
|
17
|
+
|
18
|
+
# @type [Turbopuffer::Internal::Type::Converter]
|
19
|
+
StringArray = Turbopuffer::Internal::Type::ArrayOf[String]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# Describes the language of a text attribute. Defaults to `english`.
|
6
|
+
module Language
|
7
|
+
extend Turbopuffer::Internal::Type::Enum
|
8
|
+
|
9
|
+
ARABIC = :arabic
|
10
|
+
DANISH = :danish
|
11
|
+
DUTCH = :dutch
|
12
|
+
ENGLISH = :english
|
13
|
+
FINNISH = :finnish
|
14
|
+
FRENCH = :french
|
15
|
+
GERMAN = :german
|
16
|
+
GREEK = :greek
|
17
|
+
HUNGARIAN = :hungarian
|
18
|
+
ITALIAN = :italian
|
19
|
+
NORWEGIAN = :norwegian
|
20
|
+
PORTUGUESE = :portuguese
|
21
|
+
ROMANIAN = :romanian
|
22
|
+
RUSSIAN = :russian
|
23
|
+
SPANISH = :spanish
|
24
|
+
SWEDISH = :swedish
|
25
|
+
TAMIL = :tamil
|
26
|
+
TURKISH = :turkish
|
27
|
+
|
28
|
+
# @!method self.values
|
29
|
+
# @return [Array<Symbol>]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#delete_all
|
6
|
+
class NamespaceDeleteAllParams < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
8
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute namespace
|
11
|
+
#
|
12
|
+
# @return [String, nil]
|
13
|
+
optional :namespace, String
|
14
|
+
|
15
|
+
# @!method initialize(namespace: nil, request_options: {})
|
16
|
+
# @param namespace [String]
|
17
|
+
# @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#delete_all
|
6
|
+
class NamespaceDeleteAllResponse < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
# @!attribute status
|
8
|
+
# The status of the request.
|
9
|
+
#
|
10
|
+
# @return [Symbol, :OK]
|
11
|
+
required :status, const: :OK
|
12
|
+
|
13
|
+
# @!method initialize(status: :OK)
|
14
|
+
# The response to a successful namespace deletion request.
|
15
|
+
#
|
16
|
+
# @param status [Symbol, :OK] The status of the request.
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#hint_cache_warm
|
6
|
+
class NamespaceHintCacheWarmParams < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
8
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute namespace
|
11
|
+
#
|
12
|
+
# @return [String, nil]
|
13
|
+
optional :namespace, String
|
14
|
+
|
15
|
+
# @!method initialize(namespace: nil, request_options: {})
|
16
|
+
# @param namespace [String]
|
17
|
+
# @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#hint_cache_warm
|
6
|
+
class NamespaceHintCacheWarmResponse < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
# @!attribute status
|
8
|
+
# The status of the request.
|
9
|
+
#
|
10
|
+
# @return [Symbol, :OK]
|
11
|
+
required :status, const: :OK
|
12
|
+
|
13
|
+
# @!attribute message
|
14
|
+
#
|
15
|
+
# @return [String, nil]
|
16
|
+
optional :message, String
|
17
|
+
|
18
|
+
# @!method initialize(message: nil, status: :OK)
|
19
|
+
# The response to a successful cache warm request.
|
20
|
+
#
|
21
|
+
# @param message [String]
|
22
|
+
#
|
23
|
+
# @param status [Symbol, :OK] The status of the request.
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#metadata
|
6
|
+
class NamespaceMetadata < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
# @!attribute approx_logical_bytes
|
8
|
+
# The approximate number of logical bytes in the namespace.
|
9
|
+
#
|
10
|
+
# @return [Integer]
|
11
|
+
required :approx_logical_bytes, Integer
|
12
|
+
|
13
|
+
# @!attribute created_at
|
14
|
+
# The timestamp when the namespace was created.
|
15
|
+
#
|
16
|
+
# @return [Time]
|
17
|
+
required :created_at, Time
|
18
|
+
|
19
|
+
# @!attribute schema
|
20
|
+
# The schema of the namespace.
|
21
|
+
#
|
22
|
+
# @return [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}]
|
23
|
+
required :schema, -> { Turbopuffer::Internal::Type::HashOf[Turbopuffer::AttributeSchemaConfig] }
|
24
|
+
|
25
|
+
# @!method initialize(approx_logical_bytes:, created_at:, schema:)
|
26
|
+
# Metadata about a namespace.
|
27
|
+
#
|
28
|
+
# @param approx_logical_bytes [Integer] The approximate number of logical bytes in the namespace.
|
29
|
+
#
|
30
|
+
# @param created_at [Time] The timestamp when the namespace was created.
|
31
|
+
#
|
32
|
+
# @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#metadata
|
6
|
+
class NamespaceMetadataParams < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
8
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute namespace
|
11
|
+
#
|
12
|
+
# @return [String, nil]
|
13
|
+
optional :namespace, String
|
14
|
+
|
15
|
+
# @!method initialize(namespace: nil, request_options: {})
|
16
|
+
# @param namespace [String]
|
17
|
+
# @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#multi_query
|
6
|
+
class NamespaceMultiQueryParams < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
8
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute namespace
|
11
|
+
#
|
12
|
+
# @return [String, nil]
|
13
|
+
optional :namespace, String
|
14
|
+
|
15
|
+
# @!attribute queries
|
16
|
+
#
|
17
|
+
# @return [Array<Turbopuffer::Models::Query>]
|
18
|
+
required :queries, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Query] }
|
19
|
+
|
20
|
+
# @!attribute consistency
|
21
|
+
# The consistency level for a query.
|
22
|
+
#
|
23
|
+
# @return [Turbopuffer::Models::NamespaceMultiQueryParams::Consistency, nil]
|
24
|
+
optional :consistency, -> { Turbopuffer::NamespaceMultiQueryParams::Consistency }
|
25
|
+
|
26
|
+
# @!attribute vector_encoding
|
27
|
+
# The encoding to use for vectors in the response.
|
28
|
+
#
|
29
|
+
# @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
|
30
|
+
optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
|
31
|
+
|
32
|
+
# @!method initialize(queries:, namespace: nil, consistency: nil, vector_encoding: nil, request_options: {})
|
33
|
+
# @param queries [Array<Turbopuffer::Models::Query>]
|
34
|
+
#
|
35
|
+
# @param namespace [String]
|
36
|
+
#
|
37
|
+
# @param consistency [Turbopuffer::Models::NamespaceMultiQueryParams::Consistency] The consistency level for a query.
|
38
|
+
#
|
39
|
+
# @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] The encoding to use for vectors in the response.
|
40
|
+
#
|
41
|
+
# @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
|
42
|
+
|
43
|
+
class Consistency < Turbopuffer::Internal::Type::BaseModel
|
44
|
+
# @!attribute level
|
45
|
+
# The query's consistency level.
|
46
|
+
#
|
47
|
+
# @return [Symbol, Turbopuffer::Models::NamespaceMultiQueryParams::Consistency::Level, nil]
|
48
|
+
optional :level, enum: -> { Turbopuffer::NamespaceMultiQueryParams::Consistency::Level }
|
49
|
+
|
50
|
+
# @!method initialize(level: nil)
|
51
|
+
# The consistency level for a query.
|
52
|
+
#
|
53
|
+
# @param level [Symbol, Turbopuffer::Models::NamespaceMultiQueryParams::Consistency::Level] The query's consistency level.
|
54
|
+
|
55
|
+
# The query's consistency level.
|
56
|
+
#
|
57
|
+
# @see Turbopuffer::Models::NamespaceMultiQueryParams::Consistency#level
|
58
|
+
module Level
|
59
|
+
extend Turbopuffer::Internal::Type::Enum
|
60
|
+
|
61
|
+
# Strong consistency. Requires a round-trip to object storage to fetch the latest writes.
|
62
|
+
STRONG = :strong
|
63
|
+
|
64
|
+
# Eventual consistency. Does not require a round-trip to object storage, but may not see the latest writes.
|
65
|
+
EVENTUAL = :eventual
|
66
|
+
|
67
|
+
# @!method self.values
|
68
|
+
# @return [Array<Symbol>]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#multi_query
|
6
|
+
class NamespaceMultiQueryResponse < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
# @!attribute billing
|
8
|
+
# The billing information for a query.
|
9
|
+
#
|
10
|
+
# @return [Turbopuffer::Models::QueryBilling]
|
11
|
+
required :billing, -> { Turbopuffer::QueryBilling }
|
12
|
+
|
13
|
+
# @!attribute performance
|
14
|
+
# The performance information for a query.
|
15
|
+
#
|
16
|
+
# @return [Turbopuffer::Models::QueryPerformance]
|
17
|
+
required :performance, -> { Turbopuffer::QueryPerformance }
|
18
|
+
|
19
|
+
# @!attribute results
|
20
|
+
#
|
21
|
+
# @return [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>]
|
22
|
+
required :results,
|
23
|
+
-> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Models::NamespaceMultiQueryResponse::Result] }
|
24
|
+
|
25
|
+
# @!method initialize(billing:, performance:, results:)
|
26
|
+
# The result of a multi-query.
|
27
|
+
#
|
28
|
+
# @param billing [Turbopuffer::Models::QueryBilling] The billing information for a query.
|
29
|
+
#
|
30
|
+
# @param performance [Turbopuffer::Models::QueryPerformance] The performance information for a query.
|
31
|
+
#
|
32
|
+
# @param results [Array<Turbopuffer::Models::NamespaceMultiQueryResponse::Result>]
|
33
|
+
|
34
|
+
class Result < Turbopuffer::Internal::Type::BaseModel
|
35
|
+
# @!attribute aggregations
|
36
|
+
#
|
37
|
+
# @return [Hash{Symbol=>Object}, nil]
|
38
|
+
optional :aggregations, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
|
39
|
+
|
40
|
+
# @!attribute rows
|
41
|
+
#
|
42
|
+
# @return [Array<Turbopuffer::Models::Row>, nil]
|
43
|
+
optional :rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
|
44
|
+
|
45
|
+
# @!method initialize(aggregations: nil, rows: nil)
|
46
|
+
# @param aggregations [Hash{Symbol=>Object}]
|
47
|
+
# @param rows [Array<Turbopuffer::Models::Row>]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|