telnyx 5.130.1 → 5.131.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/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/telnyx/client.rb +0 -1
- data/lib/telnyx/models/ai_search_conversation_histories_params.rb +171 -0
- data/lib/telnyx/models/ai_search_conversation_histories_response.rb +233 -0
- data/lib/telnyx/models.rb +2 -0
- data/lib/telnyx/resources/ai.rb +112 -1
- data/lib/telnyx/version.rb +1 -1
- data/lib/telnyx.rb +2 -0
- data/rbi/telnyx/client.rbi +0 -1
- data/rbi/telnyx/models/ai_search_conversation_histories_params.rbi +319 -0
- data/rbi/telnyx/models/ai_search_conversation_histories_response.rbi +393 -0
- data/rbi/telnyx/models.rbi +3 -0
- data/rbi/telnyx/resources/ai.rbi +117 -1
- data/sig/telnyx/models/ai_search_conversation_histories_params.rbs +144 -0
- data/sig/telnyx/models/ai_search_conversation_histories_response.rbs +168 -0
- data/sig/telnyx/models.rbs +2 -0
- data/sig/telnyx/resources/ai.rbs +18 -0
- metadata +8 -2
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
class AISearchConversationHistoriesParams < Telnyx::Internal::Type::BaseModel
|
|
6
|
+
extend Telnyx::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Telnyx::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Telnyx::AISearchConversationHistoriesParams,
|
|
13
|
+
Telnyx::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Natural language search query. The text is embedded into a 1024-dimensional
|
|
18
|
+
# vector and compared against indexed record chunks using kNN cosine similarity.
|
|
19
|
+
sig { returns(String) }
|
|
20
|
+
attr_accessor :q
|
|
21
|
+
|
|
22
|
+
# The type of records to search. Each record type is stored in a separate vector
|
|
23
|
+
# index.
|
|
24
|
+
sig do
|
|
25
|
+
returns(
|
|
26
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::OrSymbol
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
attr_accessor :record_type
|
|
30
|
+
|
|
31
|
+
# Filter by document identifier (exact match). Populated for knowledge_base
|
|
32
|
+
# records.
|
|
33
|
+
sig { returns(T.nilable(String)) }
|
|
34
|
+
attr_reader :filter_document_id
|
|
35
|
+
|
|
36
|
+
sig { params(filter_document_id: String).void }
|
|
37
|
+
attr_writer :filter_document_id
|
|
38
|
+
|
|
39
|
+
# Only include records ingested (chunked, embedded, and indexed) on or after this
|
|
40
|
+
# ISO 8601 timestamp.
|
|
41
|
+
sig { returns(T.nilable(Time)) }
|
|
42
|
+
attr_reader :filter_ingested_at_gte
|
|
43
|
+
|
|
44
|
+
sig { params(filter_ingested_at_gte: Time).void }
|
|
45
|
+
attr_writer :filter_ingested_at_gte
|
|
46
|
+
|
|
47
|
+
# Only include records ingested (chunked, embedded, and indexed) on or before this
|
|
48
|
+
# ISO 8601 timestamp.
|
|
49
|
+
sig { returns(T.nilable(Time)) }
|
|
50
|
+
attr_reader :filter_ingested_at_lte
|
|
51
|
+
|
|
52
|
+
sig { params(filter_ingested_at_lte: Time).void }
|
|
53
|
+
attr_writer :filter_ingested_at_lte
|
|
54
|
+
|
|
55
|
+
# Only include records whose original creation time is on or after this ISO 8601
|
|
56
|
+
# timestamp.
|
|
57
|
+
sig { returns(T.nilable(Time)) }
|
|
58
|
+
attr_reader :filter_record_created_at_gte
|
|
59
|
+
|
|
60
|
+
sig { params(filter_record_created_at_gte: Time).void }
|
|
61
|
+
attr_writer :filter_record_created_at_gte
|
|
62
|
+
|
|
63
|
+
# Only include records whose original creation time is on or before this ISO 8601
|
|
64
|
+
# timestamp.
|
|
65
|
+
sig { returns(T.nilable(Time)) }
|
|
66
|
+
attr_reader :filter_record_created_at_lte
|
|
67
|
+
|
|
68
|
+
sig { params(filter_record_created_at_lte: Time).void }
|
|
69
|
+
attr_writer :filter_record_created_at_lte
|
|
70
|
+
|
|
71
|
+
# Filter to chunks belonging to a specific parent record (exact match).
|
|
72
|
+
sig { returns(T.nilable(String)) }
|
|
73
|
+
attr_reader :filter_record_id
|
|
74
|
+
|
|
75
|
+
sig { params(filter_record_id: String).void }
|
|
76
|
+
attr_writer :filter_record_id
|
|
77
|
+
|
|
78
|
+
# Filter by the region stored on the record. Comma-separated to match multiple
|
|
79
|
+
# regions (USA, DEU, AUS, UAE). Distinct from the `region` parameter, which
|
|
80
|
+
# selects which cluster(s) are queried.
|
|
81
|
+
sig { returns(T.nilable(String)) }
|
|
82
|
+
attr_reader :filter_region_in
|
|
83
|
+
|
|
84
|
+
sig { params(filter_region_in: String).void }
|
|
85
|
+
attr_writer :filter_region_in
|
|
86
|
+
|
|
87
|
+
# Filter by retention policy (exact match). Filter-only: not returned in the
|
|
88
|
+
# response body.
|
|
89
|
+
sig { returns(T.nilable(String)) }
|
|
90
|
+
attr_reader :filter_retention
|
|
91
|
+
|
|
92
|
+
sig { params(filter_retention: String).void }
|
|
93
|
+
attr_writer :filter_retention
|
|
94
|
+
|
|
95
|
+
# Filter to records owned by a specific user (exact match).
|
|
96
|
+
sig { returns(T.nilable(String)) }
|
|
97
|
+
attr_reader :filter_user_id
|
|
98
|
+
|
|
99
|
+
sig { params(filter_user_id: String).void }
|
|
100
|
+
attr_writer :filter_user_id
|
|
101
|
+
|
|
102
|
+
# Minimum cosine similarity score threshold (0.0 to 1.0). Results below this
|
|
103
|
+
# threshold are excluded.
|
|
104
|
+
sig { returns(T.nilable(Float)) }
|
|
105
|
+
attr_reader :min_score
|
|
106
|
+
|
|
107
|
+
sig { params(min_score: Float).void }
|
|
108
|
+
attr_writer :min_score
|
|
109
|
+
|
|
110
|
+
# Restrict search to a specific region's OpenSearch cluster. When omitted, all
|
|
111
|
+
# regions are queried in parallel (fan-out) and results are merged by cosine
|
|
112
|
+
# similarity score.
|
|
113
|
+
sig do
|
|
114
|
+
returns(
|
|
115
|
+
T.nilable(
|
|
116
|
+
Telnyx::AISearchConversationHistoriesParams::Region::OrSymbol
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
attr_reader :region
|
|
121
|
+
|
|
122
|
+
sig do
|
|
123
|
+
params(
|
|
124
|
+
region: Telnyx::AISearchConversationHistoriesParams::Region::OrSymbol
|
|
125
|
+
).void
|
|
126
|
+
end
|
|
127
|
+
attr_writer :region
|
|
128
|
+
|
|
129
|
+
# Maximum number of results to return. Defaults to 20, maximum 100.
|
|
130
|
+
sig { returns(T.nilable(Integer)) }
|
|
131
|
+
attr_reader :top_k
|
|
132
|
+
|
|
133
|
+
sig { params(top_k: Integer).void }
|
|
134
|
+
attr_writer :top_k
|
|
135
|
+
|
|
136
|
+
sig do
|
|
137
|
+
params(
|
|
138
|
+
q: String,
|
|
139
|
+
record_type:
|
|
140
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::OrSymbol,
|
|
141
|
+
filter_document_id: String,
|
|
142
|
+
filter_ingested_at_gte: Time,
|
|
143
|
+
filter_ingested_at_lte: Time,
|
|
144
|
+
filter_record_created_at_gte: Time,
|
|
145
|
+
filter_record_created_at_lte: Time,
|
|
146
|
+
filter_record_id: String,
|
|
147
|
+
filter_region_in: String,
|
|
148
|
+
filter_retention: String,
|
|
149
|
+
filter_user_id: String,
|
|
150
|
+
min_score: Float,
|
|
151
|
+
region: Telnyx::AISearchConversationHistoriesParams::Region::OrSymbol,
|
|
152
|
+
top_k: Integer,
|
|
153
|
+
request_options: Telnyx::RequestOptions::OrHash
|
|
154
|
+
).returns(T.attached_class)
|
|
155
|
+
end
|
|
156
|
+
def self.new(
|
|
157
|
+
# Natural language search query. The text is embedded into a 1024-dimensional
|
|
158
|
+
# vector and compared against indexed record chunks using kNN cosine similarity.
|
|
159
|
+
q:,
|
|
160
|
+
# The type of records to search. Each record type is stored in a separate vector
|
|
161
|
+
# index.
|
|
162
|
+
record_type:,
|
|
163
|
+
# Filter by document identifier (exact match). Populated for knowledge_base
|
|
164
|
+
# records.
|
|
165
|
+
filter_document_id: nil,
|
|
166
|
+
# Only include records ingested (chunked, embedded, and indexed) on or after this
|
|
167
|
+
# ISO 8601 timestamp.
|
|
168
|
+
filter_ingested_at_gte: nil,
|
|
169
|
+
# Only include records ingested (chunked, embedded, and indexed) on or before this
|
|
170
|
+
# ISO 8601 timestamp.
|
|
171
|
+
filter_ingested_at_lte: nil,
|
|
172
|
+
# Only include records whose original creation time is on or after this ISO 8601
|
|
173
|
+
# timestamp.
|
|
174
|
+
filter_record_created_at_gte: nil,
|
|
175
|
+
# Only include records whose original creation time is on or before this ISO 8601
|
|
176
|
+
# timestamp.
|
|
177
|
+
filter_record_created_at_lte: nil,
|
|
178
|
+
# Filter to chunks belonging to a specific parent record (exact match).
|
|
179
|
+
filter_record_id: nil,
|
|
180
|
+
# Filter by the region stored on the record. Comma-separated to match multiple
|
|
181
|
+
# regions (USA, DEU, AUS, UAE). Distinct from the `region` parameter, which
|
|
182
|
+
# selects which cluster(s) are queried.
|
|
183
|
+
filter_region_in: nil,
|
|
184
|
+
# Filter by retention policy (exact match). Filter-only: not returned in the
|
|
185
|
+
# response body.
|
|
186
|
+
filter_retention: nil,
|
|
187
|
+
# Filter to records owned by a specific user (exact match).
|
|
188
|
+
filter_user_id: nil,
|
|
189
|
+
# Minimum cosine similarity score threshold (0.0 to 1.0). Results below this
|
|
190
|
+
# threshold are excluded.
|
|
191
|
+
min_score: nil,
|
|
192
|
+
# Restrict search to a specific region's OpenSearch cluster. When omitted, all
|
|
193
|
+
# regions are queried in parallel (fan-out) and results are merged by cosine
|
|
194
|
+
# similarity score.
|
|
195
|
+
region: nil,
|
|
196
|
+
# Maximum number of results to return. Defaults to 20, maximum 100.
|
|
197
|
+
top_k: nil,
|
|
198
|
+
request_options: {}
|
|
199
|
+
)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
sig do
|
|
203
|
+
override.returns(
|
|
204
|
+
{
|
|
205
|
+
q: String,
|
|
206
|
+
record_type:
|
|
207
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::OrSymbol,
|
|
208
|
+
filter_document_id: String,
|
|
209
|
+
filter_ingested_at_gte: Time,
|
|
210
|
+
filter_ingested_at_lte: Time,
|
|
211
|
+
filter_record_created_at_gte: Time,
|
|
212
|
+
filter_record_created_at_lte: Time,
|
|
213
|
+
filter_record_id: String,
|
|
214
|
+
filter_region_in: String,
|
|
215
|
+
filter_retention: String,
|
|
216
|
+
filter_user_id: String,
|
|
217
|
+
min_score: Float,
|
|
218
|
+
region:
|
|
219
|
+
Telnyx::AISearchConversationHistoriesParams::Region::OrSymbol,
|
|
220
|
+
top_k: Integer,
|
|
221
|
+
request_options: Telnyx::RequestOptions
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
end
|
|
225
|
+
def to_hash
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# The type of records to search. Each record type is stored in a separate vector
|
|
229
|
+
# index.
|
|
230
|
+
module RecordType
|
|
231
|
+
extend Telnyx::Internal::Type::Enum
|
|
232
|
+
|
|
233
|
+
TaggedSymbol =
|
|
234
|
+
T.type_alias do
|
|
235
|
+
T.all(
|
|
236
|
+
Symbol,
|
|
237
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType
|
|
238
|
+
)
|
|
239
|
+
end
|
|
240
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
241
|
+
|
|
242
|
+
VOICE =
|
|
243
|
+
T.let(
|
|
244
|
+
:voice,
|
|
245
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::TaggedSymbol
|
|
246
|
+
)
|
|
247
|
+
MESSAGE =
|
|
248
|
+
T.let(
|
|
249
|
+
:message,
|
|
250
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::TaggedSymbol
|
|
251
|
+
)
|
|
252
|
+
AI_PIPELINE_STORAGE =
|
|
253
|
+
T.let(
|
|
254
|
+
:ai_pipeline_storage,
|
|
255
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::TaggedSymbol
|
|
256
|
+
)
|
|
257
|
+
KNOWLEDGE_BASE =
|
|
258
|
+
T.let(
|
|
259
|
+
:knowledge_base,
|
|
260
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::TaggedSymbol
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
sig do
|
|
264
|
+
override.returns(
|
|
265
|
+
T::Array[
|
|
266
|
+
Telnyx::AISearchConversationHistoriesParams::RecordType::TaggedSymbol
|
|
267
|
+
]
|
|
268
|
+
)
|
|
269
|
+
end
|
|
270
|
+
def self.values
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Restrict search to a specific region's OpenSearch cluster. When omitted, all
|
|
275
|
+
# regions are queried in parallel (fan-out) and results are merged by cosine
|
|
276
|
+
# similarity score.
|
|
277
|
+
module Region
|
|
278
|
+
extend Telnyx::Internal::Type::Enum
|
|
279
|
+
|
|
280
|
+
TaggedSymbol =
|
|
281
|
+
T.type_alias do
|
|
282
|
+
T.all(Symbol, Telnyx::AISearchConversationHistoriesParams::Region)
|
|
283
|
+
end
|
|
284
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
285
|
+
|
|
286
|
+
USA =
|
|
287
|
+
T.let(
|
|
288
|
+
:USA,
|
|
289
|
+
Telnyx::AISearchConversationHistoriesParams::Region::TaggedSymbol
|
|
290
|
+
)
|
|
291
|
+
DEU =
|
|
292
|
+
T.let(
|
|
293
|
+
:DEU,
|
|
294
|
+
Telnyx::AISearchConversationHistoriesParams::Region::TaggedSymbol
|
|
295
|
+
)
|
|
296
|
+
AUS =
|
|
297
|
+
T.let(
|
|
298
|
+
:AUS,
|
|
299
|
+
Telnyx::AISearchConversationHistoriesParams::Region::TaggedSymbol
|
|
300
|
+
)
|
|
301
|
+
UAE =
|
|
302
|
+
T.let(
|
|
303
|
+
:UAE,
|
|
304
|
+
Telnyx::AISearchConversationHistoriesParams::Region::TaggedSymbol
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
sig do
|
|
308
|
+
override.returns(
|
|
309
|
+
T::Array[
|
|
310
|
+
Telnyx::AISearchConversationHistoriesParams::Region::TaggedSymbol
|
|
311
|
+
]
|
|
312
|
+
)
|
|
313
|
+
end
|
|
314
|
+
def self.values
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
class AISearchConversationHistoriesResponse < Telnyx::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Telnyx::Models::AISearchConversationHistoriesResponse,
|
|
10
|
+
Telnyx::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Ranked list of matching text chunks, sorted by cosine similarity score
|
|
15
|
+
# descending.
|
|
16
|
+
sig do
|
|
17
|
+
returns(
|
|
18
|
+
T::Array[Telnyx::Models::AISearchConversationHistoriesResponse::Data]
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
attr_accessor :data
|
|
22
|
+
|
|
23
|
+
# Pagination metadata following the standard Telnyx V2 API format.
|
|
24
|
+
sig do
|
|
25
|
+
returns(Telnyx::Models::AISearchConversationHistoriesResponse::Meta)
|
|
26
|
+
end
|
|
27
|
+
attr_reader :meta
|
|
28
|
+
|
|
29
|
+
sig do
|
|
30
|
+
params(
|
|
31
|
+
meta:
|
|
32
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Meta::OrHash
|
|
33
|
+
).void
|
|
34
|
+
end
|
|
35
|
+
attr_writer :meta
|
|
36
|
+
|
|
37
|
+
# Search response following the standard Telnyx V2 API format.
|
|
38
|
+
sig do
|
|
39
|
+
params(
|
|
40
|
+
data:
|
|
41
|
+
T::Array[
|
|
42
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::OrHash
|
|
43
|
+
],
|
|
44
|
+
meta:
|
|
45
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Meta::OrHash
|
|
46
|
+
).returns(T.attached_class)
|
|
47
|
+
end
|
|
48
|
+
def self.new(
|
|
49
|
+
# Ranked list of matching text chunks, sorted by cosine similarity score
|
|
50
|
+
# descending.
|
|
51
|
+
data:,
|
|
52
|
+
# Pagination metadata following the standard Telnyx V2 API format.
|
|
53
|
+
meta:
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
sig do
|
|
58
|
+
override.returns(
|
|
59
|
+
{
|
|
60
|
+
data:
|
|
61
|
+
T::Array[
|
|
62
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data
|
|
63
|
+
],
|
|
64
|
+
meta: Telnyx::Models::AISearchConversationHistoriesResponse::Meta
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
def to_hash
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class Data < Telnyx::Internal::Type::BaseModel
|
|
72
|
+
OrHash =
|
|
73
|
+
T.type_alias do
|
|
74
|
+
T.any(
|
|
75
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data,
|
|
76
|
+
Telnyx::Internal::AnyHash
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Unique chunk identifier.
|
|
81
|
+
sig { returns(String) }
|
|
82
|
+
attr_accessor :id
|
|
83
|
+
|
|
84
|
+
# Zero-based index of this chunk within the parent record.
|
|
85
|
+
sig { returns(Integer) }
|
|
86
|
+
attr_accessor :chunk_index
|
|
87
|
+
|
|
88
|
+
# Total number of chunks the parent record was split into.
|
|
89
|
+
sig { returns(Integer) }
|
|
90
|
+
attr_accessor :chunk_total
|
|
91
|
+
|
|
92
|
+
# Document identifier. Present only for knowledge_base records; null for all other
|
|
93
|
+
# record types.
|
|
94
|
+
sig { returns(T.nilable(String)) }
|
|
95
|
+
attr_accessor :document_id
|
|
96
|
+
|
|
97
|
+
# When the record was chunked, embedded, and indexed (ISO 8601).
|
|
98
|
+
sig { returns(Time) }
|
|
99
|
+
attr_accessor :ingested_at
|
|
100
|
+
|
|
101
|
+
# Identifier of the organization that owns this record.
|
|
102
|
+
sig { returns(String) }
|
|
103
|
+
attr_accessor :organization_id
|
|
104
|
+
|
|
105
|
+
# When the original record was created (ISO 8601).
|
|
106
|
+
sig { returns(Time) }
|
|
107
|
+
attr_accessor :record_created_at
|
|
108
|
+
|
|
109
|
+
# Identifier of the parent record. Multiple chunks from the same record share this
|
|
110
|
+
# ID.
|
|
111
|
+
sig { returns(String) }
|
|
112
|
+
attr_accessor :record_id
|
|
113
|
+
|
|
114
|
+
# Type of the record.
|
|
115
|
+
sig do
|
|
116
|
+
returns(
|
|
117
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol
|
|
118
|
+
)
|
|
119
|
+
end
|
|
120
|
+
attr_accessor :record_type
|
|
121
|
+
|
|
122
|
+
# The region where this record is stored.
|
|
123
|
+
sig do
|
|
124
|
+
returns(
|
|
125
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
attr_accessor :region
|
|
129
|
+
|
|
130
|
+
# Cosine similarity score between the query vector and this chunk's vector. Higher
|
|
131
|
+
# values indicate greater semantic relevance.
|
|
132
|
+
sig { returns(Float) }
|
|
133
|
+
attr_accessor :score
|
|
134
|
+
|
|
135
|
+
# The text content of this chunk (up to 480 tokens).
|
|
136
|
+
sig { returns(String) }
|
|
137
|
+
attr_accessor :text
|
|
138
|
+
|
|
139
|
+
# Identifier of the user who owns this record.
|
|
140
|
+
sig { returns(String) }
|
|
141
|
+
attr_accessor :user_id
|
|
142
|
+
|
|
143
|
+
# Arbitrary metadata attached to the record at ingestion time. Stored as a
|
|
144
|
+
# flat_object in OpenSearch and filterable via filter[field]=value query
|
|
145
|
+
# parameters.
|
|
146
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
147
|
+
attr_reader :metadata
|
|
148
|
+
|
|
149
|
+
sig { params(metadata: T::Hash[Symbol, T.anything]).void }
|
|
150
|
+
attr_writer :metadata
|
|
151
|
+
|
|
152
|
+
# A single search result representing one chunk of a conversation history record.
|
|
153
|
+
# Records are split into chunks of up to 480 tokens with 64-token overlap at
|
|
154
|
+
# ingestion time.
|
|
155
|
+
sig do
|
|
156
|
+
params(
|
|
157
|
+
id: String,
|
|
158
|
+
chunk_index: Integer,
|
|
159
|
+
chunk_total: Integer,
|
|
160
|
+
document_id: T.nilable(String),
|
|
161
|
+
ingested_at: Time,
|
|
162
|
+
organization_id: String,
|
|
163
|
+
record_created_at: Time,
|
|
164
|
+
record_id: String,
|
|
165
|
+
record_type:
|
|
166
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::OrSymbol,
|
|
167
|
+
region:
|
|
168
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::OrSymbol,
|
|
169
|
+
score: Float,
|
|
170
|
+
text: String,
|
|
171
|
+
user_id: String,
|
|
172
|
+
metadata: T::Hash[Symbol, T.anything]
|
|
173
|
+
).returns(T.attached_class)
|
|
174
|
+
end
|
|
175
|
+
def self.new(
|
|
176
|
+
# Unique chunk identifier.
|
|
177
|
+
id:,
|
|
178
|
+
# Zero-based index of this chunk within the parent record.
|
|
179
|
+
chunk_index:,
|
|
180
|
+
# Total number of chunks the parent record was split into.
|
|
181
|
+
chunk_total:,
|
|
182
|
+
# Document identifier. Present only for knowledge_base records; null for all other
|
|
183
|
+
# record types.
|
|
184
|
+
document_id:,
|
|
185
|
+
# When the record was chunked, embedded, and indexed (ISO 8601).
|
|
186
|
+
ingested_at:,
|
|
187
|
+
# Identifier of the organization that owns this record.
|
|
188
|
+
organization_id:,
|
|
189
|
+
# When the original record was created (ISO 8601).
|
|
190
|
+
record_created_at:,
|
|
191
|
+
# Identifier of the parent record. Multiple chunks from the same record share this
|
|
192
|
+
# ID.
|
|
193
|
+
record_id:,
|
|
194
|
+
# Type of the record.
|
|
195
|
+
record_type:,
|
|
196
|
+
# The region where this record is stored.
|
|
197
|
+
region:,
|
|
198
|
+
# Cosine similarity score between the query vector and this chunk's vector. Higher
|
|
199
|
+
# values indicate greater semantic relevance.
|
|
200
|
+
score:,
|
|
201
|
+
# The text content of this chunk (up to 480 tokens).
|
|
202
|
+
text:,
|
|
203
|
+
# Identifier of the user who owns this record.
|
|
204
|
+
user_id:,
|
|
205
|
+
# Arbitrary metadata attached to the record at ingestion time. Stored as a
|
|
206
|
+
# flat_object in OpenSearch and filterable via filter[field]=value query
|
|
207
|
+
# parameters.
|
|
208
|
+
metadata: nil
|
|
209
|
+
)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
sig do
|
|
213
|
+
override.returns(
|
|
214
|
+
{
|
|
215
|
+
id: String,
|
|
216
|
+
chunk_index: Integer,
|
|
217
|
+
chunk_total: Integer,
|
|
218
|
+
document_id: T.nilable(String),
|
|
219
|
+
ingested_at: Time,
|
|
220
|
+
organization_id: String,
|
|
221
|
+
record_created_at: Time,
|
|
222
|
+
record_id: String,
|
|
223
|
+
record_type:
|
|
224
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol,
|
|
225
|
+
region:
|
|
226
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol,
|
|
227
|
+
score: Float,
|
|
228
|
+
text: String,
|
|
229
|
+
user_id: String,
|
|
230
|
+
metadata: T::Hash[Symbol, T.anything]
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
end
|
|
234
|
+
def to_hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Type of the record.
|
|
238
|
+
module RecordType
|
|
239
|
+
extend Telnyx::Internal::Type::Enum
|
|
240
|
+
|
|
241
|
+
TaggedSymbol =
|
|
242
|
+
T.type_alias do
|
|
243
|
+
T.all(
|
|
244
|
+
Symbol,
|
|
245
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType
|
|
246
|
+
)
|
|
247
|
+
end
|
|
248
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
249
|
+
|
|
250
|
+
VOICE =
|
|
251
|
+
T.let(
|
|
252
|
+
:voice,
|
|
253
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol
|
|
254
|
+
)
|
|
255
|
+
MESSAGE =
|
|
256
|
+
T.let(
|
|
257
|
+
:message,
|
|
258
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol
|
|
259
|
+
)
|
|
260
|
+
AI_PIPELINE_STORAGE =
|
|
261
|
+
T.let(
|
|
262
|
+
:ai_pipeline_storage,
|
|
263
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol
|
|
264
|
+
)
|
|
265
|
+
KNOWLEDGE_BASE =
|
|
266
|
+
T.let(
|
|
267
|
+
:knowledge_base,
|
|
268
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
sig do
|
|
272
|
+
override.returns(
|
|
273
|
+
T::Array[
|
|
274
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::RecordType::TaggedSymbol
|
|
275
|
+
]
|
|
276
|
+
)
|
|
277
|
+
end
|
|
278
|
+
def self.values
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# The region where this record is stored.
|
|
283
|
+
module Region
|
|
284
|
+
extend Telnyx::Internal::Type::Enum
|
|
285
|
+
|
|
286
|
+
TaggedSymbol =
|
|
287
|
+
T.type_alias do
|
|
288
|
+
T.all(
|
|
289
|
+
Symbol,
|
|
290
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region
|
|
291
|
+
)
|
|
292
|
+
end
|
|
293
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
294
|
+
|
|
295
|
+
USA =
|
|
296
|
+
T.let(
|
|
297
|
+
:USA,
|
|
298
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol
|
|
299
|
+
)
|
|
300
|
+
DEU =
|
|
301
|
+
T.let(
|
|
302
|
+
:DEU,
|
|
303
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol
|
|
304
|
+
)
|
|
305
|
+
AUS =
|
|
306
|
+
T.let(
|
|
307
|
+
:AUS,
|
|
308
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol
|
|
309
|
+
)
|
|
310
|
+
UAE =
|
|
311
|
+
T.let(
|
|
312
|
+
:UAE,
|
|
313
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
sig do
|
|
317
|
+
override.returns(
|
|
318
|
+
T::Array[
|
|
319
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Data::Region::TaggedSymbol
|
|
320
|
+
]
|
|
321
|
+
)
|
|
322
|
+
end
|
|
323
|
+
def self.values
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
class Meta < Telnyx::Internal::Type::BaseModel
|
|
329
|
+
OrHash =
|
|
330
|
+
T.type_alias do
|
|
331
|
+
T.any(
|
|
332
|
+
Telnyx::Models::AISearchConversationHistoriesResponse::Meta,
|
|
333
|
+
Telnyx::Internal::AnyHash
|
|
334
|
+
)
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Current page number (always 1 — this API does not support pagination, use top_k
|
|
338
|
+
# instead).
|
|
339
|
+
sig { returns(Integer) }
|
|
340
|
+
attr_accessor :page_number
|
|
341
|
+
|
|
342
|
+
# Number of results per page (equals the effective top_k value).
|
|
343
|
+
sig { returns(Integer) }
|
|
344
|
+
attr_accessor :page_size
|
|
345
|
+
|
|
346
|
+
# Total number of pages.
|
|
347
|
+
sig { returns(Integer) }
|
|
348
|
+
attr_accessor :total_pages
|
|
349
|
+
|
|
350
|
+
# Total number of matching results across all queried regions (before top_k
|
|
351
|
+
# truncation).
|
|
352
|
+
sig { returns(Integer) }
|
|
353
|
+
attr_accessor :total_results
|
|
354
|
+
|
|
355
|
+
# Pagination metadata following the standard Telnyx V2 API format.
|
|
356
|
+
sig do
|
|
357
|
+
params(
|
|
358
|
+
page_number: Integer,
|
|
359
|
+
page_size: Integer,
|
|
360
|
+
total_pages: Integer,
|
|
361
|
+
total_results: Integer
|
|
362
|
+
).returns(T.attached_class)
|
|
363
|
+
end
|
|
364
|
+
def self.new(
|
|
365
|
+
# Current page number (always 1 — this API does not support pagination, use top_k
|
|
366
|
+
# instead).
|
|
367
|
+
page_number:,
|
|
368
|
+
# Number of results per page (equals the effective top_k value).
|
|
369
|
+
page_size:,
|
|
370
|
+
# Total number of pages.
|
|
371
|
+
total_pages:,
|
|
372
|
+
# Total number of matching results across all queried regions (before top_k
|
|
373
|
+
# truncation).
|
|
374
|
+
total_results:
|
|
375
|
+
)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
sig do
|
|
379
|
+
override.returns(
|
|
380
|
+
{
|
|
381
|
+
page_number: Integer,
|
|
382
|
+
page_size: Integer,
|
|
383
|
+
total_pages: Integer,
|
|
384
|
+
total_results: Integer
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
end
|
|
388
|
+
def to_hash
|
|
389
|
+
end
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
end
|