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,106 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class Query < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Turbopuffer::Query, Turbopuffer::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Aggregations to compute over all documents in the namespace that match the
|
12
|
+
# filters.
|
13
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
14
|
+
attr_reader :aggregate_by
|
15
|
+
|
16
|
+
sig { params(aggregate_by: T::Hash[Symbol, T.anything]).void }
|
17
|
+
attr_writer :aggregate_by
|
18
|
+
|
19
|
+
# A function used to calculate vector similarity.
|
20
|
+
sig { returns(T.nilable(Turbopuffer::DistanceMetric::OrSymbol)) }
|
21
|
+
attr_reader :distance_metric
|
22
|
+
|
23
|
+
sig do
|
24
|
+
params(distance_metric: Turbopuffer::DistanceMetric::OrSymbol).void
|
25
|
+
end
|
26
|
+
attr_writer :distance_metric
|
27
|
+
|
28
|
+
# Exact filters for attributes to refine search results for. Think of it as a SQL
|
29
|
+
# WHERE clause.
|
30
|
+
sig { returns(T.nilable(T.anything)) }
|
31
|
+
attr_reader :filters
|
32
|
+
|
33
|
+
sig { params(filters: T.anything).void }
|
34
|
+
attr_writer :filters
|
35
|
+
|
36
|
+
# Whether to include attributes in the response.
|
37
|
+
sig { returns(T.nilable(Turbopuffer::IncludeAttributes::Variants)) }
|
38
|
+
attr_reader :include_attributes
|
39
|
+
|
40
|
+
sig do
|
41
|
+
params(
|
42
|
+
include_attributes: Turbopuffer::IncludeAttributes::Variants
|
43
|
+
).void
|
44
|
+
end
|
45
|
+
attr_writer :include_attributes
|
46
|
+
|
47
|
+
# How to rank the documents in the namespace.
|
48
|
+
sig { returns(T.nilable(T.anything)) }
|
49
|
+
attr_reader :rank_by
|
50
|
+
|
51
|
+
sig { params(rank_by: T.anything).void }
|
52
|
+
attr_writer :rank_by
|
53
|
+
|
54
|
+
# The number of results to return.
|
55
|
+
sig { returns(T.nilable(Integer)) }
|
56
|
+
attr_reader :top_k
|
57
|
+
|
58
|
+
sig { params(top_k: Integer).void }
|
59
|
+
attr_writer :top_k
|
60
|
+
|
61
|
+
# Query, filter, full-text search and vector search documents.
|
62
|
+
sig do
|
63
|
+
params(
|
64
|
+
aggregate_by: T::Hash[Symbol, T.anything],
|
65
|
+
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
66
|
+
filters: T.anything,
|
67
|
+
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
68
|
+
rank_by: T.anything,
|
69
|
+
top_k: Integer
|
70
|
+
).returns(T.attached_class)
|
71
|
+
end
|
72
|
+
def self.new(
|
73
|
+
# Aggregations to compute over all documents in the namespace that match the
|
74
|
+
# filters.
|
75
|
+
aggregate_by: nil,
|
76
|
+
# A function used to calculate vector similarity.
|
77
|
+
distance_metric: nil,
|
78
|
+
# Exact filters for attributes to refine search results for. Think of it as a SQL
|
79
|
+
# WHERE clause.
|
80
|
+
filters: nil,
|
81
|
+
# Whether to include attributes in the response.
|
82
|
+
include_attributes: nil,
|
83
|
+
# How to rank the documents in the namespace.
|
84
|
+
rank_by: nil,
|
85
|
+
# The number of results to return.
|
86
|
+
top_k: nil
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
sig do
|
91
|
+
override.returns(
|
92
|
+
{
|
93
|
+
aggregate_by: T::Hash[Symbol, T.anything],
|
94
|
+
distance_metric: Turbopuffer::DistanceMetric::OrSymbol,
|
95
|
+
filters: T.anything,
|
96
|
+
include_attributes: Turbopuffer::IncludeAttributes::Variants,
|
97
|
+
rank_by: T.anything,
|
98
|
+
top_k: Integer
|
99
|
+
}
|
100
|
+
)
|
101
|
+
end
|
102
|
+
def to_hash
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class QueryBilling < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Turbopuffer::QueryBilling, Turbopuffer::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The number of billable logical bytes queried from the namespace.
|
12
|
+
sig { returns(Integer) }
|
13
|
+
attr_accessor :billable_logical_bytes_queried
|
14
|
+
|
15
|
+
# The number of billable logical bytes returned from the query.
|
16
|
+
sig { returns(Integer) }
|
17
|
+
attr_accessor :billable_logical_bytes_returned
|
18
|
+
|
19
|
+
# The billing information for a query.
|
20
|
+
sig do
|
21
|
+
params(
|
22
|
+
billable_logical_bytes_queried: Integer,
|
23
|
+
billable_logical_bytes_returned: Integer
|
24
|
+
).returns(T.attached_class)
|
25
|
+
end
|
26
|
+
def self.new(
|
27
|
+
# The number of billable logical bytes queried from the namespace.
|
28
|
+
billable_logical_bytes_queried:,
|
29
|
+
# The number of billable logical bytes returned from the query.
|
30
|
+
billable_logical_bytes_returned:
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
sig do
|
35
|
+
override.returns(
|
36
|
+
{
|
37
|
+
billable_logical_bytes_queried: Integer,
|
38
|
+
billable_logical_bytes_returned: Integer
|
39
|
+
}
|
40
|
+
)
|
41
|
+
end
|
42
|
+
def to_hash
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class QueryPerformance < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Turbopuffer::QueryPerformance, Turbopuffer::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# the approximate number of documents in the namespace.
|
12
|
+
sig { returns(Integer) }
|
13
|
+
attr_accessor :approx_namespace_size
|
14
|
+
|
15
|
+
# The ratio of cache hits to total cache lookups.
|
16
|
+
sig { returns(Float) }
|
17
|
+
attr_accessor :cache_hit_ratio
|
18
|
+
|
19
|
+
# A qualitative description of the cache hit ratio (`hot`, `warm`, or `cold`).
|
20
|
+
sig { returns(String) }
|
21
|
+
attr_accessor :cache_temperature
|
22
|
+
|
23
|
+
# The number of unindexed documents processed by the query.
|
24
|
+
sig { returns(Integer) }
|
25
|
+
attr_accessor :exhaustive_search_count
|
26
|
+
|
27
|
+
# Request time measured on the server, excluding time spent waiting due to the
|
28
|
+
# namespace concurrency limit.
|
29
|
+
sig { returns(Integer) }
|
30
|
+
attr_accessor :query_execution_ms
|
31
|
+
|
32
|
+
# Request time measured on the server, including time spent waiting for other
|
33
|
+
# queries to complete if the namespace was at its concurrency limit.
|
34
|
+
sig { returns(Integer) }
|
35
|
+
attr_accessor :server_total_ms
|
36
|
+
|
37
|
+
# The performance information for a query.
|
38
|
+
sig do
|
39
|
+
params(
|
40
|
+
approx_namespace_size: Integer,
|
41
|
+
cache_hit_ratio: Float,
|
42
|
+
cache_temperature: String,
|
43
|
+
exhaustive_search_count: Integer,
|
44
|
+
query_execution_ms: Integer,
|
45
|
+
server_total_ms: Integer
|
46
|
+
).returns(T.attached_class)
|
47
|
+
end
|
48
|
+
def self.new(
|
49
|
+
# the approximate number of documents in the namespace.
|
50
|
+
approx_namespace_size:,
|
51
|
+
# The ratio of cache hits to total cache lookups.
|
52
|
+
cache_hit_ratio:,
|
53
|
+
# A qualitative description of the cache hit ratio (`hot`, `warm`, or `cold`).
|
54
|
+
cache_temperature:,
|
55
|
+
# The number of unindexed documents processed by the query.
|
56
|
+
exhaustive_search_count:,
|
57
|
+
# Request time measured on the server, excluding time spent waiting due to the
|
58
|
+
# namespace concurrency limit.
|
59
|
+
query_execution_ms:,
|
60
|
+
# Request time measured on the server, including time spent waiting for other
|
61
|
+
# queries to complete if the namespace was at its concurrency limit.
|
62
|
+
server_total_ms:
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
sig do
|
67
|
+
override.returns(
|
68
|
+
{
|
69
|
+
approx_namespace_size: Integer,
|
70
|
+
cache_hit_ratio: Float,
|
71
|
+
cache_temperature: String,
|
72
|
+
exhaustive_search_count: Integer,
|
73
|
+
query_execution_ms: Integer,
|
74
|
+
server_total_ms: Integer
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
def to_hash
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class Row < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias { T.any(Turbopuffer::Row, Turbopuffer::Internal::AnyHash) }
|
8
|
+
|
9
|
+
# An identifier for a document.
|
10
|
+
sig { returns(Turbopuffer::ID::Variants) }
|
11
|
+
attr_accessor :id
|
12
|
+
|
13
|
+
# A vector embedding associated with a document.
|
14
|
+
sig { returns(T.nilable(Turbopuffer::Vector::Variants)) }
|
15
|
+
attr_reader :vector
|
16
|
+
|
17
|
+
sig { params(vector: Turbopuffer::Vector::Variants).void }
|
18
|
+
attr_writer :vector
|
19
|
+
|
20
|
+
# A single document, in a row-based format.
|
21
|
+
sig do
|
22
|
+
params(
|
23
|
+
id: Turbopuffer::ID::Variants,
|
24
|
+
vector: Turbopuffer::Vector::Variants
|
25
|
+
).returns(T.attached_class)
|
26
|
+
end
|
27
|
+
def self.new(
|
28
|
+
# An identifier for a document.
|
29
|
+
id:,
|
30
|
+
# A vector embedding associated with a document.
|
31
|
+
vector: nil
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
sig do
|
36
|
+
override.returns(
|
37
|
+
{
|
38
|
+
id: Turbopuffer::ID::Variants,
|
39
|
+
vector: Turbopuffer::Vector::Variants
|
40
|
+
}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
def to_hash
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# The tokenizer to use for full-text search on an attribute.
|
6
|
+
module Tokenizer
|
7
|
+
extend Turbopuffer::Internal::Type::Enum
|
8
|
+
|
9
|
+
TaggedSymbol = T.type_alias { T.all(Symbol, Turbopuffer::Tokenizer) }
|
10
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
11
|
+
|
12
|
+
PRE_TOKENIZED_ARRAY =
|
13
|
+
T.let(:pre_tokenized_array, Turbopuffer::Tokenizer::TaggedSymbol)
|
14
|
+
WORD_V0 = T.let(:word_v0, Turbopuffer::Tokenizer::TaggedSymbol)
|
15
|
+
WORD_V1 = T.let(:word_v1, Turbopuffer::Tokenizer::TaggedSymbol)
|
16
|
+
|
17
|
+
sig { override.returns(T::Array[Turbopuffer::Tokenizer::TaggedSymbol]) }
|
18
|
+
def self.values
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# A vector embedding associated with a document.
|
6
|
+
module Vector
|
7
|
+
extend Turbopuffer::Internal::Type::Union
|
8
|
+
|
9
|
+
Variants = T.type_alias { T.any(T::Array[Float], String) }
|
10
|
+
|
11
|
+
sig { override.returns(T::Array[Turbopuffer::Vector::Variants]) }
|
12
|
+
def self.variants
|
13
|
+
end
|
14
|
+
|
15
|
+
FloatArray =
|
16
|
+
T.let(
|
17
|
+
Turbopuffer::Internal::Type::ArrayOf[Float],
|
18
|
+
Turbopuffer::Internal::Type::Converter
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
# The encoding to use for vectors in the response.
|
6
|
+
module VectorEncoding
|
7
|
+
extend Turbopuffer::Internal::Type::Enum
|
8
|
+
|
9
|
+
TaggedSymbol = T.type_alias { T.all(Symbol, Turbopuffer::VectorEncoding) }
|
10
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
11
|
+
|
12
|
+
FLOAT = T.let(:float, Turbopuffer::VectorEncoding::TaggedSymbol)
|
13
|
+
BASE64 = T.let(:base64, Turbopuffer::VectorEncoding::TaggedSymbol)
|
14
|
+
|
15
|
+
sig do
|
16
|
+
override.returns(T::Array[Turbopuffer::VectorEncoding::TaggedSymbol])
|
17
|
+
end
|
18
|
+
def self.values
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
module Models
|
5
|
+
class WriteBilling < Turbopuffer::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(Turbopuffer::WriteBilling, Turbopuffer::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The number of billable logical bytes written to the namespace.
|
12
|
+
sig { returns(Integer) }
|
13
|
+
attr_accessor :billable_logical_bytes_written
|
14
|
+
|
15
|
+
# The billing information for a query.
|
16
|
+
sig { returns(T.nilable(Turbopuffer::QueryBilling)) }
|
17
|
+
attr_reader :query
|
18
|
+
|
19
|
+
sig { params(query: Turbopuffer::QueryBilling::OrHash).void }
|
20
|
+
attr_writer :query
|
21
|
+
|
22
|
+
# The billing information for a write request.
|
23
|
+
sig do
|
24
|
+
params(
|
25
|
+
billable_logical_bytes_written: Integer,
|
26
|
+
query: Turbopuffer::QueryBilling::OrHash
|
27
|
+
).returns(T.attached_class)
|
28
|
+
end
|
29
|
+
def self.new(
|
30
|
+
# The number of billable logical bytes written to the namespace.
|
31
|
+
billable_logical_bytes_written:,
|
32
|
+
# The billing information for a query.
|
33
|
+
query: nil
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
sig do
|
38
|
+
override.returns(
|
39
|
+
{
|
40
|
+
billable_logical_bytes_written: Integer,
|
41
|
+
query: Turbopuffer::QueryBilling
|
42
|
+
}
|
43
|
+
)
|
44
|
+
end
|
45
|
+
def to_hash
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
AttributeSchema = Turbopuffer::Models::AttributeSchema
|
5
|
+
|
6
|
+
AttributeSchemaConfig = Turbopuffer::Models::AttributeSchemaConfig
|
7
|
+
|
8
|
+
AttributeType = Turbopuffer::Models::AttributeType
|
9
|
+
|
10
|
+
ClientNamespacesParams = Turbopuffer::Models::ClientNamespacesParams
|
11
|
+
|
12
|
+
Columns = Turbopuffer::Models::Columns
|
13
|
+
|
14
|
+
DistanceMetric = Turbopuffer::Models::DistanceMetric
|
15
|
+
|
16
|
+
FullTextSearch = Turbopuffer::Models::FullTextSearch
|
17
|
+
|
18
|
+
FullTextSearchConfig = Turbopuffer::Models::FullTextSearchConfig
|
19
|
+
|
20
|
+
ID = Turbopuffer::Models::ID
|
21
|
+
|
22
|
+
IncludeAttributes = Turbopuffer::Models::IncludeAttributes
|
23
|
+
|
24
|
+
Language = Turbopuffer::Models::Language
|
25
|
+
|
26
|
+
NamespaceDeleteAllParams = Turbopuffer::Models::NamespaceDeleteAllParams
|
27
|
+
|
28
|
+
NamespaceHintCacheWarmParams =
|
29
|
+
Turbopuffer::Models::NamespaceHintCacheWarmParams
|
30
|
+
|
31
|
+
NamespaceMetadata = Turbopuffer::Models::NamespaceMetadata
|
32
|
+
|
33
|
+
NamespaceMetadataParams = Turbopuffer::Models::NamespaceMetadataParams
|
34
|
+
|
35
|
+
NamespaceMultiQueryParams = Turbopuffer::Models::NamespaceMultiQueryParams
|
36
|
+
|
37
|
+
NamespaceQueryParams = Turbopuffer::Models::NamespaceQueryParams
|
38
|
+
|
39
|
+
NamespaceRecallParams = Turbopuffer::Models::NamespaceRecallParams
|
40
|
+
|
41
|
+
NamespaceSchemaParams = Turbopuffer::Models::NamespaceSchemaParams
|
42
|
+
|
43
|
+
NamespaceSummary = Turbopuffer::Models::NamespaceSummary
|
44
|
+
|
45
|
+
NamespaceUpdateSchemaParams = Turbopuffer::Models::NamespaceUpdateSchemaParams
|
46
|
+
|
47
|
+
NamespaceWriteParams = Turbopuffer::Models::NamespaceWriteParams
|
48
|
+
|
49
|
+
Query = Turbopuffer::Models::Query
|
50
|
+
|
51
|
+
QueryBilling = Turbopuffer::Models::QueryBilling
|
52
|
+
|
53
|
+
QueryPerformance = Turbopuffer::Models::QueryPerformance
|
54
|
+
|
55
|
+
Row = Turbopuffer::Models::Row
|
56
|
+
|
57
|
+
Tokenizer = Turbopuffer::Models::Tokenizer
|
58
|
+
|
59
|
+
Vector = Turbopuffer::Models::Vector
|
60
|
+
|
61
|
+
VectorEncoding = Turbopuffer::Models::VectorEncoding
|
62
|
+
|
63
|
+
WriteBilling = Turbopuffer::Models::WriteBilling
|
64
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Turbopuffer
|
4
|
+
# Specify HTTP behaviour to use for a specific request. These options supplement
|
5
|
+
# or override those provided at the client level.
|
6
|
+
#
|
7
|
+
# When making a request, you can pass an actual {RequestOptions} instance, or
|
8
|
+
# simply pass a Hash with symbol keys matching the attributes on this class.
|
9
|
+
class RequestOptions < Turbopuffer::Internal::Type::BaseModel
|
10
|
+
OrHash =
|
11
|
+
T.type_alias do
|
12
|
+
T.any(Turbopuffer::RequestOptions, Turbopuffer::Internal::AnyHash)
|
13
|
+
end
|
14
|
+
|
15
|
+
# @api private
|
16
|
+
sig { params(opts: Turbopuffer::RequestOptions::OrHash).void }
|
17
|
+
def self.validate!(opts)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Idempotency key to send with request and all associated retries. Will only be
|
21
|
+
# sent for write requests.
|
22
|
+
sig { returns(T.nilable(String)) }
|
23
|
+
attr_accessor :idempotency_key
|
24
|
+
|
25
|
+
# Extra query params to send with the request. These are `.merge`’d into any
|
26
|
+
# `query` given at the client level.
|
27
|
+
sig do
|
28
|
+
returns(
|
29
|
+
T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))])
|
30
|
+
)
|
31
|
+
end
|
32
|
+
attr_accessor :extra_query
|
33
|
+
|
34
|
+
# Extra headers to send with the request. These are `.merged`’d into any
|
35
|
+
# `extra_headers` given at the client level.
|
36
|
+
sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) }
|
37
|
+
attr_accessor :extra_headers
|
38
|
+
|
39
|
+
# Extra data to send with the request. These are deep merged into any data
|
40
|
+
# generated as part of the normal request.
|
41
|
+
sig { returns(T.nilable(T.anything)) }
|
42
|
+
attr_accessor :extra_body
|
43
|
+
|
44
|
+
# Maximum number of retries to attempt after a failed initial request.
|
45
|
+
sig { returns(T.nilable(Integer)) }
|
46
|
+
attr_accessor :max_retries
|
47
|
+
|
48
|
+
# Request timeout in seconds.
|
49
|
+
sig { returns(T.nilable(Float)) }
|
50
|
+
attr_accessor :timeout
|
51
|
+
|
52
|
+
# Returns a new instance of RequestOptions.
|
53
|
+
sig do
|
54
|
+
params(values: Turbopuffer::Internal::AnyHash).returns(T.attached_class)
|
55
|
+
end
|
56
|
+
def self.new(values = {})
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|