turbopuffer 0.1.0 → 1.3.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 +218 -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/bm25_clause_params.rb +18 -0
- data/lib/turbopuffer/models/client_namespaces_params.rb +38 -0
- data/lib/turbopuffer/models/columns.rb +64 -0
- data/lib/turbopuffer/models/contains_all_tokens_filter_params.rb +18 -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 +110 -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 +94 -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/bm25_clause_params.rbi +31 -0
- data/rbi/turbopuffer/models/client_namespaces_params.rbi +71 -0
- data/rbi/turbopuffer/models/columns.rbi +82 -0
- data/rbi/turbopuffer/models/contains_all_tokens_filter_params.rbi +34 -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 +77 -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/bm25_clause_params.rbs +15 -0
- data/sig/turbopuffer/models/client_namespaces_params.rbs +38 -0
- data/sig/turbopuffer/models/columns.rbs +42 -0
- data/sig/turbopuffer/models/contains_all_tokens_filter_params.rbs +15 -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 +69 -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 +224 -29
- data/.standard.yml +0 -3
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -10
- data/sig/turbopuffer.rbs +0 -4
@@ -0,0 +1,71 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class ClientNamespacesParams < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
7
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Turbopuffer::ClientNamespacesParams,
|
13
|
+
Turbopuffer::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Retrieve the next page of results.
|
18
|
+
sig { returns(T.nilable(String)) }
|
19
|
+
attr_reader :cursor
|
20
|
+
|
21
|
+
sig { params(cursor: String).void }
|
22
|
+
attr_writer :cursor
|
23
|
+
|
24
|
+
# Limit the number of results per page.
|
25
|
+
sig { returns(T.nilable(Integer)) }
|
26
|
+
attr_reader :page_size
|
27
|
+
|
28
|
+
sig { params(page_size: Integer).void }
|
29
|
+
attr_writer :page_size
|
30
|
+
|
31
|
+
# Retrieve only the namespaces that match the prefix.
|
32
|
+
sig { returns(T.nilable(String)) }
|
33
|
+
attr_reader :prefix
|
34
|
+
|
35
|
+
sig { params(prefix: String).void }
|
36
|
+
attr_writer :prefix
|
37
|
+
|
38
|
+
sig do
|
39
|
+
params(
|
40
|
+
cursor: String,
|
41
|
+
page_size: Integer,
|
42
|
+
prefix: String,
|
43
|
+
request_options: Turbopuffer::RequestOptions::OrHash
|
44
|
+
).returns(T.attached_class)
|
45
|
+
end
|
46
|
+
def self.new(
|
47
|
+
# Retrieve the next page of results.
|
48
|
+
cursor: nil,
|
49
|
+
# Limit the number of results per page.
|
50
|
+
page_size: nil,
|
51
|
+
# Retrieve only the namespaces that match the prefix.
|
52
|
+
prefix: nil,
|
53
|
+
request_options: {}
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
sig do
|
58
|
+
override.returns(
|
59
|
+
{
|
60
|
+
cursor: String,
|
61
|
+
page_size: Integer,
|
62
|
+
prefix: String,
|
63
|
+
request_options: Turbopuffer::RequestOptions
|
64
|
+
}
|
65
|
+
)
|
66
|
+
end
|
67
|
+
def to_hash
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class Columns < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Turbopuffer::Columns, Turbopuffer::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The IDs of the documents.
|
12
|
+
sig { returns(T::Array[Turbopuffer::ID::Variants]) }
|
13
|
+
attr_accessor :id
|
14
|
+
|
15
|
+
# The vector embeddings of the documents.
|
16
|
+
sig { returns(T.nilable(Turbopuffer::Columns::Vector::Variants)) }
|
17
|
+
attr_reader :vector
|
18
|
+
|
19
|
+
sig { params(vector: Turbopuffer::Columns::Vector::Variants).void }
|
20
|
+
attr_writer :vector
|
21
|
+
|
22
|
+
# A list of documents in columnar format. Each key is a column name, mapped to an
|
23
|
+
# array of values for that column.
|
24
|
+
sig do
|
25
|
+
params(
|
26
|
+
id: T::Array[Turbopuffer::ID::Variants],
|
27
|
+
vector: Turbopuffer::Columns::Vector::Variants
|
28
|
+
).returns(T.attached_class)
|
29
|
+
end
|
30
|
+
def self.new(
|
31
|
+
# The IDs of the documents.
|
32
|
+
id:,
|
33
|
+
# The vector embeddings of the documents.
|
34
|
+
vector: nil
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
sig do
|
39
|
+
override.returns(
|
40
|
+
{
|
41
|
+
id: T::Array[Turbopuffer::ID::Variants],
|
42
|
+
vector: Turbopuffer::Columns::Vector::Variants
|
43
|
+
}
|
44
|
+
)
|
45
|
+
end
|
46
|
+
def to_hash
|
47
|
+
end
|
48
|
+
|
49
|
+
# The vector embeddings of the documents.
|
50
|
+
module Vector
|
51
|
+
extend Turbopuffer::Internal::Type::Union
|
52
|
+
|
53
|
+
Variants =
|
54
|
+
T.type_alias do
|
55
|
+
T.any(
|
56
|
+
T::Array[Turbopuffer::Vector::Variants],
|
57
|
+
T::Array[Float],
|
58
|
+
String
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
sig do
|
63
|
+
override.returns(T::Array[Turbopuffer::Columns::Vector::Variants])
|
64
|
+
end
|
65
|
+
def self.variants
|
66
|
+
end
|
67
|
+
|
68
|
+
VectorArray =
|
69
|
+
T.let(
|
70
|
+
Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::Vector],
|
71
|
+
Turbopuffer::Internal::Type::Converter
|
72
|
+
)
|
73
|
+
|
74
|
+
FloatArray =
|
75
|
+
T.let(
|
76
|
+
Turbopuffer::Internal::Type::ArrayOf[Float],
|
77
|
+
Turbopuffer::Internal::Type::Converter
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class ContainsAllTokensFilterParams < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(
|
9
|
+
Turbopuffer::ContainsAllTokensFilterParams,
|
10
|
+
Turbopuffer::Internal::AnyHash
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Whether to treat the last token in the query input as a literal prefix.
|
15
|
+
sig { returns(T.nilable(T::Boolean)) }
|
16
|
+
attr_reader :last_as_prefix
|
17
|
+
|
18
|
+
sig { params(last_as_prefix: T::Boolean).void }
|
19
|
+
attr_writer :last_as_prefix
|
20
|
+
|
21
|
+
# Additional (optional) parameters for the ContainsAllTokens filter.
|
22
|
+
sig { params(last_as_prefix: T::Boolean).returns(T.attached_class) }
|
23
|
+
def self.new(
|
24
|
+
# Whether to treat the last token in the query input as a literal prefix.
|
25
|
+
last_as_prefix: nil
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
sig { override.returns({ last_as_prefix: T::Boolean }) }
|
30
|
+
def to_hash
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# typed: strong
|
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
|
+
TaggedSymbol = T.type_alias { T.all(Symbol, Turbopuffer::DistanceMetric) }
|
10
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
11
|
+
|
12
|
+
# Defined as `1 - cosine_similarity` and ranges from 0 to 2. Lower is better.
|
13
|
+
COSINE_DISTANCE =
|
14
|
+
T.let(:cosine_distance, Turbopuffer::DistanceMetric::TaggedSymbol)
|
15
|
+
|
16
|
+
# Defined as `sum((x - y)^2)`. Lower is better.
|
17
|
+
EUCLIDEAN_SQUARED =
|
18
|
+
T.let(:euclidean_squared, Turbopuffer::DistanceMetric::TaggedSymbol)
|
19
|
+
|
20
|
+
sig do
|
21
|
+
override.returns(T::Array[Turbopuffer::DistanceMetric::TaggedSymbol])
|
22
|
+
end
|
23
|
+
def self.values
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# typed: strong
|
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
|
+
Variants =
|
12
|
+
T.type_alias { T.any(T::Boolean, Turbopuffer::FullTextSearchConfig) }
|
13
|
+
|
14
|
+
sig { override.returns(T::Array[Turbopuffer::FullTextSearch::Variants]) }
|
15
|
+
def self.variants
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class FullTextSearchConfig < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(
|
9
|
+
Turbopuffer::FullTextSearchConfig,
|
10
|
+
Turbopuffer::Internal::AnyHash
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
# The `b` document length normalization parameter for BM25. Defaults to `0.75`.
|
15
|
+
sig { returns(T.nilable(Float)) }
|
16
|
+
attr_reader :b
|
17
|
+
|
18
|
+
sig { params(b: Float).void }
|
19
|
+
attr_writer :b
|
20
|
+
|
21
|
+
# Whether searching is case-sensitive. Defaults to `false` (i.e.
|
22
|
+
# case-insensitive).
|
23
|
+
sig { returns(T.nilable(T::Boolean)) }
|
24
|
+
attr_reader :case_sensitive
|
25
|
+
|
26
|
+
sig { params(case_sensitive: T::Boolean).void }
|
27
|
+
attr_writer :case_sensitive
|
28
|
+
|
29
|
+
# The `k1` term saturation parameter for BM25. Defaults to `1.2`.
|
30
|
+
sig { returns(T.nilable(Float)) }
|
31
|
+
attr_reader :k1
|
32
|
+
|
33
|
+
sig { params(k1: Float).void }
|
34
|
+
attr_writer :k1
|
35
|
+
|
36
|
+
# Describes the language of a text attribute. Defaults to `english`.
|
37
|
+
sig { returns(T.nilable(Turbopuffer::Language::OrSymbol)) }
|
38
|
+
attr_reader :language
|
39
|
+
|
40
|
+
sig { params(language: Turbopuffer::Language::OrSymbol).void }
|
41
|
+
attr_writer :language
|
42
|
+
|
43
|
+
# Maximum length of a token in bytes. Tokens larger than this value during
|
44
|
+
# tokenization will be filtered out. Has to be between `1` and `254` (inclusive).
|
45
|
+
# Defaults to `39`.
|
46
|
+
sig { returns(T.nilable(Integer)) }
|
47
|
+
attr_reader :max_token_length
|
48
|
+
|
49
|
+
sig { params(max_token_length: Integer).void }
|
50
|
+
attr_writer :max_token_length
|
51
|
+
|
52
|
+
# Removes common words from the text based on language. Defaults to `true` (i.e.
|
53
|
+
# remove common words).
|
54
|
+
sig { returns(T.nilable(T::Boolean)) }
|
55
|
+
attr_reader :remove_stopwords
|
56
|
+
|
57
|
+
sig { params(remove_stopwords: T::Boolean).void }
|
58
|
+
attr_writer :remove_stopwords
|
59
|
+
|
60
|
+
# Language-specific stemming for the text. Defaults to `false` (i.e., do not
|
61
|
+
# stem).
|
62
|
+
sig { returns(T.nilable(T::Boolean)) }
|
63
|
+
attr_reader :stemming
|
64
|
+
|
65
|
+
sig { params(stemming: T::Boolean).void }
|
66
|
+
attr_writer :stemming
|
67
|
+
|
68
|
+
# The tokenizer to use for full-text search on an attribute. Defaults to
|
69
|
+
# `word_v2`.
|
70
|
+
sig { returns(T.nilable(Turbopuffer::Tokenizer::OrSymbol)) }
|
71
|
+
attr_reader :tokenizer
|
72
|
+
|
73
|
+
sig { params(tokenizer: Turbopuffer::Tokenizer::OrSymbol).void }
|
74
|
+
attr_writer :tokenizer
|
75
|
+
|
76
|
+
# Configuration options for full-text search.
|
77
|
+
sig do
|
78
|
+
params(
|
79
|
+
b: Float,
|
80
|
+
case_sensitive: T::Boolean,
|
81
|
+
k1: Float,
|
82
|
+
language: Turbopuffer::Language::OrSymbol,
|
83
|
+
max_token_length: Integer,
|
84
|
+
remove_stopwords: T::Boolean,
|
85
|
+
stemming: T::Boolean,
|
86
|
+
tokenizer: Turbopuffer::Tokenizer::OrSymbol
|
87
|
+
).returns(T.attached_class)
|
88
|
+
end
|
89
|
+
def self.new(
|
90
|
+
# The `b` document length normalization parameter for BM25. Defaults to `0.75`.
|
91
|
+
b: nil,
|
92
|
+
# Whether searching is case-sensitive. Defaults to `false` (i.e.
|
93
|
+
# case-insensitive).
|
94
|
+
case_sensitive: nil,
|
95
|
+
# The `k1` term saturation parameter for BM25. Defaults to `1.2`.
|
96
|
+
k1: nil,
|
97
|
+
# Describes the language of a text attribute. Defaults to `english`.
|
98
|
+
language: nil,
|
99
|
+
# Maximum length of a token in bytes. Tokens larger than this value during
|
100
|
+
# tokenization will be filtered out. Has to be between `1` and `254` (inclusive).
|
101
|
+
# Defaults to `39`.
|
102
|
+
max_token_length: nil,
|
103
|
+
# Removes common words from the text based on language. Defaults to `true` (i.e.
|
104
|
+
# remove common words).
|
105
|
+
remove_stopwords: nil,
|
106
|
+
# Language-specific stemming for the text. Defaults to `false` (i.e., do not
|
107
|
+
# stem).
|
108
|
+
stemming: nil,
|
109
|
+
# The tokenizer to use for full-text search on an attribute. Defaults to
|
110
|
+
# `word_v2`.
|
111
|
+
tokenizer: nil
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
sig do
|
116
|
+
override.returns(
|
117
|
+
{
|
118
|
+
b: Float,
|
119
|
+
case_sensitive: T::Boolean,
|
120
|
+
k1: Float,
|
121
|
+
language: Turbopuffer::Language::OrSymbol,
|
122
|
+
max_token_length: Integer,
|
123
|
+
remove_stopwords: T::Boolean,
|
124
|
+
stemming: T::Boolean,
|
125
|
+
tokenizer: Turbopuffer::Tokenizer::OrSymbol
|
126
|
+
}
|
127
|
+
)
|
128
|
+
end
|
129
|
+
def to_hash
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# An identifier for a document.
|
6
|
+
module ID
|
7
|
+
extend Turbopuffer::Internal::Type::Union
|
8
|
+
|
9
|
+
Variants = T.type_alias { T.any(String, Integer) }
|
10
|
+
|
11
|
+
sig { override.returns(T::Array[Turbopuffer::ID::Variants]) }
|
12
|
+
def self.variants
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# typed: strong
|
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
|
+
Variants = T.type_alias { T.any(T::Boolean, T::Array[String]) }
|
10
|
+
|
11
|
+
sig do
|
12
|
+
override.returns(T::Array[Turbopuffer::IncludeAttributes::Variants])
|
13
|
+
end
|
14
|
+
def self.variants
|
15
|
+
end
|
16
|
+
|
17
|
+
StringArray =
|
18
|
+
T.let(
|
19
|
+
Turbopuffer::Internal::Type::ArrayOf[String],
|
20
|
+
Turbopuffer::Internal::Type::Converter
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# typed: strong
|
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
|
+
TaggedSymbol = T.type_alias { T.all(Symbol, Turbopuffer::Language) }
|
10
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
11
|
+
|
12
|
+
ARABIC = T.let(:arabic, Turbopuffer::Language::TaggedSymbol)
|
13
|
+
DANISH = T.let(:danish, Turbopuffer::Language::TaggedSymbol)
|
14
|
+
DUTCH = T.let(:dutch, Turbopuffer::Language::TaggedSymbol)
|
15
|
+
ENGLISH = T.let(:english, Turbopuffer::Language::TaggedSymbol)
|
16
|
+
FINNISH = T.let(:finnish, Turbopuffer::Language::TaggedSymbol)
|
17
|
+
FRENCH = T.let(:french, Turbopuffer::Language::TaggedSymbol)
|
18
|
+
GERMAN = T.let(:german, Turbopuffer::Language::TaggedSymbol)
|
19
|
+
GREEK = T.let(:greek, Turbopuffer::Language::TaggedSymbol)
|
20
|
+
HUNGARIAN = T.let(:hungarian, Turbopuffer::Language::TaggedSymbol)
|
21
|
+
ITALIAN = T.let(:italian, Turbopuffer::Language::TaggedSymbol)
|
22
|
+
NORWEGIAN = T.let(:norwegian, Turbopuffer::Language::TaggedSymbol)
|
23
|
+
PORTUGUESE = T.let(:portuguese, Turbopuffer::Language::TaggedSymbol)
|
24
|
+
ROMANIAN = T.let(:romanian, Turbopuffer::Language::TaggedSymbol)
|
25
|
+
RUSSIAN = T.let(:russian, Turbopuffer::Language::TaggedSymbol)
|
26
|
+
SPANISH = T.let(:spanish, Turbopuffer::Language::TaggedSymbol)
|
27
|
+
SWEDISH = T.let(:swedish, Turbopuffer::Language::TaggedSymbol)
|
28
|
+
TAMIL = T.let(:tamil, Turbopuffer::Language::TaggedSymbol)
|
29
|
+
TURKISH = T.let(:turkish, Turbopuffer::Language::TaggedSymbol)
|
30
|
+
|
31
|
+
sig { override.returns(T::Array[Turbopuffer::Language::TaggedSymbol]) }
|
32
|
+
def self.values
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class NamespaceDeleteAllParams < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
extend Turbopuffer::Internal::Type::RequestParameters::Converter
|
7
|
+
include Turbopuffer::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
OrHash =
|
10
|
+
T.type_alias do
|
11
|
+
T.any(
|
12
|
+
Turbopuffer::NamespaceDeleteAllParams,
|
13
|
+
Turbopuffer::Internal::AnyHash
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
sig { returns(T.nilable(String)) }
|
18
|
+
attr_reader :namespace
|
19
|
+
|
20
|
+
sig { params(namespace: String).void }
|
21
|
+
attr_writer :namespace
|
22
|
+
|
23
|
+
sig do
|
24
|
+
params(
|
25
|
+
namespace: String,
|
26
|
+
request_options: Turbopuffer::RequestOptions::OrHash
|
27
|
+
).returns(T.attached_class)
|
28
|
+
end
|
29
|
+
def self.new(namespace: nil, request_options: {})
|
30
|
+
end
|
31
|
+
|
32
|
+
sig do
|
33
|
+
override.returns(
|
34
|
+
{ namespace: String, request_options: Turbopuffer::RequestOptions }
|
35
|
+
)
|
36
|
+
end
|
37
|
+
def to_hash
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class NamespaceDeleteAllResponse < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(
|
9
|
+
Turbopuffer::Models::NamespaceDeleteAllResponse,
|
10
|
+
Turbopuffer::Internal::AnyHash
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
# The status of the request.
|
15
|
+
sig { returns(Symbol) }
|
16
|
+
attr_accessor :status
|
17
|
+
|
18
|
+
# The response to a successful namespace deletion request.
|
19
|
+
sig { params(status: Symbol).returns(T.attached_class) }
|
20
|
+
def self.new(
|
21
|
+
# The status of the request.
|
22
|
+
status: :OK
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
sig { override.returns({ status: Symbol }) }
|
27
|
+
def to_hash
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|