turbopuffer 0.1.0 → 1.2.0
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 +4 -4
- data/.ignore +2 -0
- data/CHANGELOG.md +205 -0
- data/README.md +270 -40
- data/SECURITY.md +27 -0
- data/lib/turbopuffer/client.rb +122 -16
- data/lib/turbopuffer/errors.rb +228 -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 +567 -0
- data/lib/turbopuffer/internal/transport/pooled_net_requester.rb +201 -0
- data/lib/turbopuffer/internal/type/array_of.rb +168 -0
- data/lib/turbopuffer/internal/type/base_model.rb +529 -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 +327 -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 +188 -0
- data/lib/turbopuffer/internal/type/request_parameters.rb +42 -0
- data/lib/turbopuffer/internal/type/union.rb +254 -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/aggregation_group.rb +8 -0
- data/lib/turbopuffer/models/attribute_schema.rb +19 -0
- data/lib/turbopuffer/models/attribute_schema_config.rb +56 -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 +83 -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_explain_query_params.rb +137 -0
- data/lib/turbopuffer/models/namespace_explain_query_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 +43 -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 +58 -0
- data/lib/turbopuffer/models/namespace_query_params.rb +137 -0
- data/lib/turbopuffer/models/namespace_query_response.rb +49 -0
- data/lib/turbopuffer/models/namespace_recall_params.rb +66 -0
- data/lib/turbopuffer/models/namespace_recall_response.rb +68 -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 +81 -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 +46 -0
- data/lib/turbopuffer/models/tokenizer.rb +19 -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 +106 -0
- data/lib/turbopuffer/namespace.rb +14 -50
- data/lib/turbopuffer/request_options.rb +77 -0
- data/lib/turbopuffer/resources/namespaces.rb +366 -0
- data/lib/turbopuffer/version.rb +1 -1
- data/lib/turbopuffer.rb +92 -4
- data/manifest.yaml +15 -0
- data/rbi/turbopuffer/client.rbi +91 -0
- data/rbi/turbopuffer/errors.rbi +205 -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 +297 -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 +216 -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 +128 -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/aggregation_group.rbi +13 -0
- data/rbi/turbopuffer/models/attribute_schema.rbi +17 -0
- data/rbi/turbopuffer/models/attribute_schema_config.rbi +103 -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 +133 -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_explain_query_params.rbi +273 -0
- data/rbi/turbopuffer/models/namespace_explain_query_response.rbi +34 -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 +62 -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 +121 -0
- data/rbi/turbopuffer/models/namespace_query_params.rbi +267 -0
- data/rbi/turbopuffer/models/namespace_query_response.rbi +84 -0
- data/rbi/turbopuffer/models/namespace_recall_params.rbi +106 -0
- data/rbi/turbopuffer/models/namespace_recall_response.rbi +134 -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 +132 -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 +24 -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 +72 -0
- data/rbi/turbopuffer/namespace.rbi +8 -0
- data/rbi/turbopuffer/request_options.rbi +59 -0
- data/rbi/turbopuffer/resources/namespaces.rbi +304 -0
- data/rbi/turbopuffer/version.rbi +5 -0
- data/sig/turbopuffer/client.rbs +41 -0
- data/sig/turbopuffer/errors.rbs +117 -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 +79 -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/aggregation_group.rbs +7 -0
- data/sig/turbopuffer/models/attribute_schema.rbs +11 -0
- data/sig/turbopuffer/models/attribute_schema_config.rbs +52 -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 +75 -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_explain_query_params.rbs +141 -0
- data/sig/turbopuffer/models/namespace_explain_query_response.rbs +15 -0
- data/sig/turbopuffer/models/namespace_hint_cache_warm_params.rbs +25 -0
- data/sig/turbopuffer/models/namespace_hint_cache_warm_response.rbs +18 -0
- data/sig/turbopuffer/models/namespace_metadata.rbs +35 -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 +65 -0
- data/sig/turbopuffer/models/namespace_query_params.rbs +139 -0
- data/sig/turbopuffer/models/namespace_query_response.rbs +48 -0
- data/sig/turbopuffer/models/namespace_recall_params.rbs +63 -0
- data/sig/turbopuffer/models/namespace_recall_response.rbs +61 -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 +75 -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 +16 -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 +65 -0
- data/sig/turbopuffer/namespace.rbs +5 -0
- data/sig/turbopuffer/request_options.rbs +36 -0
- data/sig/turbopuffer/resources/namespaces.rbs +99 -0
- data/sig/turbopuffer/version.rbs +3 -0
- metadata +218 -29
- data/.standard.yml +0 -3
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -10
- data/sig/turbopuffer.rbs +0 -4
@@ -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,56 @@
|
|
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 regex
|
27
|
+
# Whether to enable Regex filters on this attribute.
|
28
|
+
#
|
29
|
+
# @return [Boolean, nil]
|
30
|
+
optional :regex, Turbopuffer::Internal::Type::Boolean
|
31
|
+
|
32
|
+
# @!attribute type
|
33
|
+
# The data type of the attribute. Valid values: string, int, uint, uuid, datetime,
|
34
|
+
# bool, []string, []int, []uint, []uuid, []datetime, [DIMS]f16, [DIMS]f32.
|
35
|
+
#
|
36
|
+
# @return [String, nil]
|
37
|
+
optional :type, String
|
38
|
+
|
39
|
+
# @!method initialize(ann: nil, filterable: nil, full_text_search: nil, regex: nil, type: nil)
|
40
|
+
# Some parameter documentations has been truncated, see
|
41
|
+
# {Turbopuffer::Models::AttributeSchemaConfig} for more details.
|
42
|
+
#
|
43
|
+
# Detailed configuration for an attribute attached to a document.
|
44
|
+
#
|
45
|
+
# @param ann [Boolean] Whether to create an approximate nearest neighbor index for the attribute.
|
46
|
+
#
|
47
|
+
# @param filterable [Boolean] Whether or not the attributes can be used in filters.
|
48
|
+
#
|
49
|
+
# @param full_text_search [Boolean, Turbopuffer::Models::FullTextSearchConfig] Whether this attribute can be used as part of a BM25 full-text search. Requires
|
50
|
+
#
|
51
|
+
# @param regex [Boolean] Whether to enable Regex filters on this attribute.
|
52
|
+
#
|
53
|
+
# @param type [String] The data type of the attribute. Valid values: string, int, uint, uuid, datetime,
|
54
|
+
end
|
55
|
+
end
|
56
|
+
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,83 @@
|
|
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 max_token_length
|
32
|
+
# Maximum length of a token in bytes. Tokens larger than this value during
|
33
|
+
# tokenization will be filtered out. Has to be between `1` and `254` (inclusive).
|
34
|
+
# Defaults to `39`.
|
35
|
+
#
|
36
|
+
# @return [Integer, nil]
|
37
|
+
optional :max_token_length, Integer
|
38
|
+
|
39
|
+
# @!attribute remove_stopwords
|
40
|
+
# Removes common words from the text based on language. Defaults to `true` (i.e.
|
41
|
+
# remove common words).
|
42
|
+
#
|
43
|
+
# @return [Boolean, nil]
|
44
|
+
optional :remove_stopwords, Turbopuffer::Internal::Type::Boolean
|
45
|
+
|
46
|
+
# @!attribute stemming
|
47
|
+
# Language-specific stemming for the text. Defaults to `false` (i.e., do not
|
48
|
+
# stem).
|
49
|
+
#
|
50
|
+
# @return [Boolean, nil]
|
51
|
+
optional :stemming, Turbopuffer::Internal::Type::Boolean
|
52
|
+
|
53
|
+
# @!attribute tokenizer
|
54
|
+
# The tokenizer to use for full-text search on an attribute. Defaults to
|
55
|
+
# `word_v2`.
|
56
|
+
#
|
57
|
+
# @return [Symbol, Turbopuffer::Models::Tokenizer, nil]
|
58
|
+
optional :tokenizer, enum: -> { Turbopuffer::Tokenizer }
|
59
|
+
|
60
|
+
# @!method initialize(b: nil, case_sensitive: nil, k1: nil, language: nil, max_token_length: nil, remove_stopwords: nil, stemming: nil, tokenizer: nil)
|
61
|
+
# Some parameter documentations has been truncated, see
|
62
|
+
# {Turbopuffer::Models::FullTextSearchConfig} for more details.
|
63
|
+
#
|
64
|
+
# Configuration options for full-text search.
|
65
|
+
#
|
66
|
+
# @param b [Float] The `b` document length normalization parameter for BM25. Defaults to `0.75`.
|
67
|
+
#
|
68
|
+
# @param case_sensitive [Boolean] Whether searching is case-sensitive. Defaults to `false` (i.e. case-insensitive)
|
69
|
+
#
|
70
|
+
# @param k1 [Float] The `k1` term saturation parameter for BM25. Defaults to `1.2`.
|
71
|
+
#
|
72
|
+
# @param language [Symbol, Turbopuffer::Models::Language] Describes the language of a text attribute. Defaults to `english`.
|
73
|
+
#
|
74
|
+
# @param max_token_length [Integer] Maximum length of a token in bytes. Tokens larger than this value during tokeniz
|
75
|
+
#
|
76
|
+
# @param remove_stopwords [Boolean] Removes common words from the text based on language. Defaults to `true` (i.e. r
|
77
|
+
#
|
78
|
+
# @param stemming [Boolean] Language-specific stemming for the text. Defaults to `false` (i.e., do not stem)
|
79
|
+
#
|
80
|
+
# @param tokenizer [Symbol, Turbopuffer::Models::Tokenizer] The tokenizer to use for full-text search on an attribute. Defaults to `word_v2`
|
81
|
+
end
|
82
|
+
end
|
83
|
+
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,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#explain_query
|
6
|
+
class NamespaceExplainQueryParams < 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 aggregate_by
|
16
|
+
# Aggregations to compute over all documents in the namespace that match the
|
17
|
+
# filters.
|
18
|
+
#
|
19
|
+
# @return [Hash{Symbol=>Object}, nil]
|
20
|
+
optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
|
21
|
+
|
22
|
+
# @!attribute consistency
|
23
|
+
# The consistency level for a query.
|
24
|
+
#
|
25
|
+
# @return [Turbopuffer::Models::NamespaceExplainQueryParams::Consistency, nil]
|
26
|
+
optional :consistency, -> { Turbopuffer::NamespaceExplainQueryParams::Consistency }
|
27
|
+
|
28
|
+
# @!attribute distance_metric
|
29
|
+
# A function used to calculate vector similarity.
|
30
|
+
#
|
31
|
+
# @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
|
32
|
+
optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
|
33
|
+
|
34
|
+
# @!attribute exclude_attributes
|
35
|
+
# List of attribute names to exclude from the response. All other attributes will
|
36
|
+
# be included in the response.
|
37
|
+
#
|
38
|
+
# @return [Array<String>, nil]
|
39
|
+
optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]
|
40
|
+
|
41
|
+
# @!attribute filters
|
42
|
+
# Exact filters for attributes to refine search results for. Think of it as a SQL
|
43
|
+
# WHERE clause.
|
44
|
+
#
|
45
|
+
# @return [Object, nil]
|
46
|
+
optional :filters, Turbopuffer::Internal::Type::Unknown
|
47
|
+
|
48
|
+
# @!attribute group_by
|
49
|
+
# Groups documents by the specified attributes (the "group key") before computing
|
50
|
+
# aggregates. Aggregates are computed separately for each group.
|
51
|
+
#
|
52
|
+
# @return [Array<String>, nil]
|
53
|
+
optional :group_by, Turbopuffer::Internal::Type::ArrayOf[String]
|
54
|
+
|
55
|
+
# @!attribute include_attributes
|
56
|
+
# Whether to include attributes in the response.
|
57
|
+
#
|
58
|
+
# @return [Boolean, Array<String>, nil]
|
59
|
+
optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }
|
60
|
+
|
61
|
+
# @!attribute rank_by
|
62
|
+
# How to rank the documents in the namespace.
|
63
|
+
#
|
64
|
+
# @return [Object, nil]
|
65
|
+
optional :rank_by, Turbopuffer::Internal::Type::Unknown
|
66
|
+
|
67
|
+
# @!attribute top_k
|
68
|
+
# The number of results to return.
|
69
|
+
#
|
70
|
+
# @return [Integer, nil]
|
71
|
+
optional :top_k, Integer
|
72
|
+
|
73
|
+
# @!attribute vector_encoding
|
74
|
+
# The encoding to use for vectors in the response.
|
75
|
+
#
|
76
|
+
# @return [Symbol, Turbopuffer::Models::VectorEncoding, nil]
|
77
|
+
optional :vector_encoding, enum: -> { Turbopuffer::VectorEncoding }
|
78
|
+
|
79
|
+
# @!method initialize(namespace: nil, aggregate_by: nil, consistency: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil, vector_encoding: nil, request_options: {})
|
80
|
+
# Some parameter documentations has been truncated, see
|
81
|
+
# {Turbopuffer::Models::NamespaceExplainQueryParams} for more details.
|
82
|
+
#
|
83
|
+
# @param namespace [String]
|
84
|
+
#
|
85
|
+
# @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
|
86
|
+
#
|
87
|
+
# @param consistency [Turbopuffer::Models::NamespaceExplainQueryParams::Consistency] The consistency level for a query.
|
88
|
+
#
|
89
|
+
# @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
|
90
|
+
#
|
91
|
+
# @param exclude_attributes [Array<String>] List of attribute names to exclude from the response. All other attributes will
|
92
|
+
#
|
93
|
+
# @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
|
94
|
+
#
|
95
|
+
# @param group_by [Array<String>] Groups documents by the specified attributes (the "group key") before computing
|
96
|
+
#
|
97
|
+
# @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
|
98
|
+
#
|
99
|
+
# @param rank_by [Object] How to rank the documents in the namespace.
|
100
|
+
#
|
101
|
+
# @param top_k [Integer] The number of results to return.
|
102
|
+
#
|
103
|
+
# @param vector_encoding [Symbol, Turbopuffer::Models::VectorEncoding] The encoding to use for vectors in the response.
|
104
|
+
#
|
105
|
+
# @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
|
106
|
+
|
107
|
+
class Consistency < Turbopuffer::Internal::Type::BaseModel
|
108
|
+
# @!attribute level
|
109
|
+
# The query's consistency level.
|
110
|
+
#
|
111
|
+
# @return [Symbol, Turbopuffer::Models::NamespaceExplainQueryParams::Consistency::Level, nil]
|
112
|
+
optional :level, enum: -> { Turbopuffer::NamespaceExplainQueryParams::Consistency::Level }
|
113
|
+
|
114
|
+
# @!method initialize(level: nil)
|
115
|
+
# The consistency level for a query.
|
116
|
+
#
|
117
|
+
# @param level [Symbol, Turbopuffer::Models::NamespaceExplainQueryParams::Consistency::Level] The query's consistency level.
|
118
|
+
|
119
|
+
# The query's consistency level.
|
120
|
+
#
|
121
|
+
# @see Turbopuffer::Models::NamespaceExplainQueryParams::Consistency#level
|
122
|
+
module Level
|
123
|
+
extend Turbopuffer::Internal::Type::Enum
|
124
|
+
|
125
|
+
# Strong consistency. Requires a round-trip to object storage to fetch the latest writes.
|
126
|
+
STRONG = :strong
|
127
|
+
|
128
|
+
# Eventual consistency. Does not require a round-trip to object storage, but may not see the latest writes.
|
129
|
+
EVENTUAL = :eventual
|
130
|
+
|
131
|
+
# @!method self.values
|
132
|
+
# @return [Array<Symbol>]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# @see Turbopuffer::Resources::Namespaces#explain_query
|
6
|
+
class NamespaceExplainQueryResponse < Turbopuffer::Internal::Type::BaseModel
|
7
|
+
# @!attribute plan_text
|
8
|
+
# The textual representation of the query plan.
|
9
|
+
#
|
10
|
+
# @return [String, nil]
|
11
|
+
optional :plan_text, String
|
12
|
+
|
13
|
+
# @!method initialize(plan_text: nil)
|
14
|
+
# The response to a successful query explain.
|
15
|
+
#
|
16
|
+
# @param plan_text [String] The textual representation of the query plan.
|
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, :ACCEPTED]
|
11
|
+
required :status, const: :ACCEPTED
|
12
|
+
|
13
|
+
# @!attribute message
|
14
|
+
#
|
15
|
+
# @return [String, nil]
|
16
|
+
optional :message, String
|
17
|
+
|
18
|
+
# @!method initialize(message: nil, status: :ACCEPTED)
|
19
|
+
# The response to a successful cache warm request.
|
20
|
+
#
|
21
|
+
# @param message [String]
|
22
|
+
#
|
23
|
+
# @param status [Symbol, :ACCEPTED] The status of the request.
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|