telnyx 5.17.0 → 5.18.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/models/ai/openai/embedding_create_params.rb +92 -0
- data/lib/telnyx/models/ai/openai/embedding_create_response.rb +92 -0
- data/lib/telnyx/models/ai/openai/embedding_list_models_params.rb +18 -0
- data/lib/telnyx/models/ai/openai/embedding_list_models_response.rb +65 -0
- data/lib/telnyx/resources/ai/openai/embeddings.rb +74 -0
- data/lib/telnyx/resources/ai/openai.rb +20 -0
- data/lib/telnyx/resources/ai.rb +4 -0
- data/lib/telnyx/version.rb +1 -1
- data/lib/telnyx.rb +6 -0
- data/rbi/telnyx/models/ai/openai/embedding_create_params.rbi +171 -0
- data/rbi/telnyx/models/ai/openai/embedding_create_response.rbi +176 -0
- data/rbi/telnyx/models/ai/openai/embedding_list_models_params.rbi +34 -0
- data/rbi/telnyx/models/ai/openai/embedding_list_models_response.rbi +123 -0
- data/rbi/telnyx/resources/ai/openai/embeddings.rbi +60 -0
- data/rbi/telnyx/resources/ai/openai.rbi +17 -0
- data/rbi/telnyx/resources/ai.rbi +3 -0
- data/sig/telnyx/models/ai/openai/embedding_create_params.rbs +79 -0
- data/sig/telnyx/models/ai/openai/embedding_create_response.rbs +77 -0
- data/sig/telnyx/models/ai/openai/embedding_list_models_params.rbs +19 -0
- data/sig/telnyx/models/ai/openai/embedding_list_models_response.rbs +56 -0
- data/sig/telnyx/resources/ai/openai/embeddings.rbs +24 -0
- data/sig/telnyx/resources/ai/openai.rbs +11 -0
- data/sig/telnyx/resources/ai.rbs +2 -0
- metadata +19 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f64a193fae0f68851a1b545044ea384297a3e6852731a084bf503c8897b48d8
|
|
4
|
+
data.tar.gz: 7026c1707b3da887862b4856f4e051277d93baa7744f4ed876d83a01de1e9667
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bffe7cb7ede65f87722e7df8fb1b9981db665d9134fec32b2790d4163072c499c02340abb3541707d54b8c151776302b1c677ac072d2356bf0705a49779f678a
|
|
7
|
+
data.tar.gz: 70a983984587aa67731ea5a505703f16332d06c1b25c9814c5fe18b821d5836584d6b19d32238efab8e22e12286d1bd86707b658f88e9ff5634f33dabca0319f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.18.0 (2026-02-11)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v5.17.0...v5.18.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.17.0...v5.18.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* Add OpenAI-compatible embeddings API spec ([e7aea5f](https://github.com/team-telnyx/telnyx-ruby/commit/e7aea5feb3c2277889875352e58e1e59ee9be532))
|
|
10
|
+
|
|
3
11
|
## 5.17.0 (2026-02-11)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v5.16.0...v5.17.0](https://github.com/team-telnyx/telnyx-ruby/compare/v5.16.0...v5.17.0)
|
data/README.md
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
module AI
|
|
6
|
+
module OpenAI
|
|
7
|
+
# @see Telnyx::Resources::AI::OpenAI::Embeddings#create
|
|
8
|
+
class EmbeddingCreateParams < Telnyx::Internal::Type::BaseModel
|
|
9
|
+
extend Telnyx::Internal::Type::RequestParameters::Converter
|
|
10
|
+
include Telnyx::Internal::Type::RequestParameters
|
|
11
|
+
|
|
12
|
+
# @!attribute input
|
|
13
|
+
# Input text to embed. Can be a string or array of strings.
|
|
14
|
+
#
|
|
15
|
+
# @return [String, Array<String>]
|
|
16
|
+
required :input, union: -> { Telnyx::AI::OpenAI::EmbeddingCreateParams::Input }
|
|
17
|
+
|
|
18
|
+
# @!attribute model
|
|
19
|
+
# ID of the model to use. Use the List embedding models endpoint to see available
|
|
20
|
+
# models.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
required :model, String
|
|
24
|
+
|
|
25
|
+
# @!attribute dimensions
|
|
26
|
+
# The number of dimensions the resulting output embeddings should have. Only
|
|
27
|
+
# supported in some models.
|
|
28
|
+
#
|
|
29
|
+
# @return [Integer, nil]
|
|
30
|
+
optional :dimensions, Integer
|
|
31
|
+
|
|
32
|
+
# @!attribute encoding_format
|
|
33
|
+
# The format to return the embeddings in.
|
|
34
|
+
#
|
|
35
|
+
# @return [Symbol, Telnyx::Models::AI::OpenAI::EmbeddingCreateParams::EncodingFormat, nil]
|
|
36
|
+
optional :encoding_format, enum: -> { Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat }
|
|
37
|
+
|
|
38
|
+
# @!attribute user
|
|
39
|
+
# A unique identifier representing your end-user for monitoring and abuse
|
|
40
|
+
# detection.
|
|
41
|
+
#
|
|
42
|
+
# @return [String, nil]
|
|
43
|
+
optional :user, String
|
|
44
|
+
|
|
45
|
+
# @!method initialize(input:, model:, dimensions: nil, encoding_format: nil, user: nil, request_options: {})
|
|
46
|
+
# Some parameter documentations has been truncated, see
|
|
47
|
+
# {Telnyx::Models::AI::OpenAI::EmbeddingCreateParams} for more details.
|
|
48
|
+
#
|
|
49
|
+
# @param input [String, Array<String>] Input text to embed. Can be a string or array of strings.
|
|
50
|
+
#
|
|
51
|
+
# @param model [String] ID of the model to use. Use the List embedding models endpoint to see available
|
|
52
|
+
#
|
|
53
|
+
# @param dimensions [Integer] The number of dimensions the resulting output embeddings should have. Only suppo
|
|
54
|
+
#
|
|
55
|
+
# @param encoding_format [Symbol, Telnyx::Models::AI::OpenAI::EmbeddingCreateParams::EncodingFormat] The format to return the embeddings in.
|
|
56
|
+
#
|
|
57
|
+
# @param user [String] A unique identifier representing your end-user for monitoring and abuse detectio
|
|
58
|
+
#
|
|
59
|
+
# @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}]
|
|
60
|
+
|
|
61
|
+
# Input text to embed. Can be a string or array of strings.
|
|
62
|
+
module Input
|
|
63
|
+
extend Telnyx::Internal::Type::Union
|
|
64
|
+
|
|
65
|
+
# A single text string to embed
|
|
66
|
+
variant String
|
|
67
|
+
|
|
68
|
+
# An array of text strings to embed
|
|
69
|
+
variant -> { Telnyx::Models::AI::OpenAI::EmbeddingCreateParams::Input::StringArray }
|
|
70
|
+
|
|
71
|
+
# @!method self.variants
|
|
72
|
+
# @return [Array(String, Array<String>)]
|
|
73
|
+
|
|
74
|
+
# @type [Telnyx::Internal::Type::Converter]
|
|
75
|
+
StringArray = Telnyx::Internal::Type::ArrayOf[String]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# The format to return the embeddings in.
|
|
79
|
+
module EncodingFormat
|
|
80
|
+
extend Telnyx::Internal::Type::Enum
|
|
81
|
+
|
|
82
|
+
FLOAT = :float
|
|
83
|
+
BASE64 = :base64
|
|
84
|
+
|
|
85
|
+
# @!method self.values
|
|
86
|
+
# @return [Array<Symbol>]
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
module AI
|
|
6
|
+
module OpenAI
|
|
7
|
+
# @see Telnyx::Resources::AI::OpenAI::Embeddings#create
|
|
8
|
+
class EmbeddingCreateResponse < Telnyx::Internal::Type::BaseModel
|
|
9
|
+
# @!attribute data
|
|
10
|
+
# List of embedding objects
|
|
11
|
+
#
|
|
12
|
+
# @return [Array<Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse::Data>]
|
|
13
|
+
required :data,
|
|
14
|
+
-> { Telnyx::Internal::Type::ArrayOf[Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse::Data] }
|
|
15
|
+
|
|
16
|
+
# @!attribute model
|
|
17
|
+
# The model used for embedding
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
required :model, String
|
|
21
|
+
|
|
22
|
+
# @!attribute object
|
|
23
|
+
# The object type, always 'list'
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
required :object, String
|
|
27
|
+
|
|
28
|
+
# @!attribute usage
|
|
29
|
+
#
|
|
30
|
+
# @return [Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse::Usage]
|
|
31
|
+
required :usage, -> { Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse::Usage }
|
|
32
|
+
|
|
33
|
+
# @!method initialize(data:, model:, object:, usage:)
|
|
34
|
+
# @param data [Array<Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse::Data>] List of embedding objects
|
|
35
|
+
#
|
|
36
|
+
# @param model [String] The model used for embedding
|
|
37
|
+
#
|
|
38
|
+
# @param object [String] The object type, always 'list'
|
|
39
|
+
#
|
|
40
|
+
# @param usage [Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse::Usage]
|
|
41
|
+
|
|
42
|
+
class Data < Telnyx::Internal::Type::BaseModel
|
|
43
|
+
# @!attribute embedding
|
|
44
|
+
# The embedding vector
|
|
45
|
+
#
|
|
46
|
+
# @return [Array<Float>]
|
|
47
|
+
required :embedding, Telnyx::Internal::Type::ArrayOf[Float]
|
|
48
|
+
|
|
49
|
+
# @!attribute index
|
|
50
|
+
# The index of the embedding in the list of embeddings
|
|
51
|
+
#
|
|
52
|
+
# @return [Integer]
|
|
53
|
+
required :index, Integer
|
|
54
|
+
|
|
55
|
+
# @!attribute object
|
|
56
|
+
# The object type, always 'embedding'
|
|
57
|
+
#
|
|
58
|
+
# @return [String]
|
|
59
|
+
required :object, String
|
|
60
|
+
|
|
61
|
+
# @!method initialize(embedding:, index:, object:)
|
|
62
|
+
# @param embedding [Array<Float>] The embedding vector
|
|
63
|
+
#
|
|
64
|
+
# @param index [Integer] The index of the embedding in the list of embeddings
|
|
65
|
+
#
|
|
66
|
+
# @param object [String] The object type, always 'embedding'
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @see Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse#usage
|
|
70
|
+
class Usage < Telnyx::Internal::Type::BaseModel
|
|
71
|
+
# @!attribute prompt_tokens
|
|
72
|
+
# Number of tokens in the input
|
|
73
|
+
#
|
|
74
|
+
# @return [Integer]
|
|
75
|
+
required :prompt_tokens, Integer
|
|
76
|
+
|
|
77
|
+
# @!attribute total_tokens
|
|
78
|
+
# Total number of tokens used
|
|
79
|
+
#
|
|
80
|
+
# @return [Integer]
|
|
81
|
+
required :total_tokens, Integer
|
|
82
|
+
|
|
83
|
+
# @!method initialize(prompt_tokens:, total_tokens:)
|
|
84
|
+
# @param prompt_tokens [Integer] Number of tokens in the input
|
|
85
|
+
#
|
|
86
|
+
# @param total_tokens [Integer] Total number of tokens used
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
module AI
|
|
6
|
+
module OpenAI
|
|
7
|
+
# @see Telnyx::Resources::AI::OpenAI::Embeddings#list_models
|
|
8
|
+
class EmbeddingListModelsParams < Telnyx::Internal::Type::BaseModel
|
|
9
|
+
extend Telnyx::Internal::Type::RequestParameters::Converter
|
|
10
|
+
include Telnyx::Internal::Type::RequestParameters
|
|
11
|
+
|
|
12
|
+
# @!method initialize(request_options: {})
|
|
13
|
+
# @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
module AI
|
|
6
|
+
module OpenAI
|
|
7
|
+
# @see Telnyx::Resources::AI::OpenAI::Embeddings#list_models
|
|
8
|
+
class EmbeddingListModelsResponse < Telnyx::Internal::Type::BaseModel
|
|
9
|
+
# @!attribute data
|
|
10
|
+
# List of available embedding models
|
|
11
|
+
#
|
|
12
|
+
# @return [Array<Telnyx::Models::AI::OpenAI::EmbeddingListModelsResponse::Data>]
|
|
13
|
+
required :data,
|
|
14
|
+
-> { Telnyx::Internal::Type::ArrayOf[Telnyx::Models::AI::OpenAI::EmbeddingListModelsResponse::Data] }
|
|
15
|
+
|
|
16
|
+
# @!attribute object
|
|
17
|
+
# The object type, always 'list'
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
required :object, String
|
|
21
|
+
|
|
22
|
+
# @!method initialize(data:, object:)
|
|
23
|
+
# @param data [Array<Telnyx::Models::AI::OpenAI::EmbeddingListModelsResponse::Data>] List of available embedding models
|
|
24
|
+
#
|
|
25
|
+
# @param object [String] The object type, always 'list'
|
|
26
|
+
|
|
27
|
+
class Data < Telnyx::Internal::Type::BaseModel
|
|
28
|
+
# @!attribute id
|
|
29
|
+
# The model identifier
|
|
30
|
+
#
|
|
31
|
+
# @return [String]
|
|
32
|
+
required :id, String
|
|
33
|
+
|
|
34
|
+
# @!attribute created
|
|
35
|
+
# Unix timestamp of when the model was created
|
|
36
|
+
#
|
|
37
|
+
# @return [Integer]
|
|
38
|
+
required :created, Integer
|
|
39
|
+
|
|
40
|
+
# @!attribute object
|
|
41
|
+
# The object type, always 'model'
|
|
42
|
+
#
|
|
43
|
+
# @return [String]
|
|
44
|
+
required :object, String
|
|
45
|
+
|
|
46
|
+
# @!attribute owned_by
|
|
47
|
+
# The organization that owns the model
|
|
48
|
+
#
|
|
49
|
+
# @return [String]
|
|
50
|
+
required :owned_by, String
|
|
51
|
+
|
|
52
|
+
# @!method initialize(id:, created:, object:, owned_by:)
|
|
53
|
+
# @param id [String] The model identifier
|
|
54
|
+
#
|
|
55
|
+
# @param created [Integer] Unix timestamp of when the model was created
|
|
56
|
+
#
|
|
57
|
+
# @param object [String] The object type, always 'model'
|
|
58
|
+
#
|
|
59
|
+
# @param owned_by [String] The organization that owns the model
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Resources
|
|
5
|
+
class AI
|
|
6
|
+
class OpenAI
|
|
7
|
+
class Embeddings
|
|
8
|
+
# Some parameter documentations has been truncated, see
|
|
9
|
+
# {Telnyx::Models::AI::OpenAI::EmbeddingCreateParams} for more details.
|
|
10
|
+
#
|
|
11
|
+
# Creates an embedding vector representing the input text. This endpoint is
|
|
12
|
+
# compatible with the
|
|
13
|
+
# [OpenAI Embeddings API](https://platform.openai.com/docs/api-reference/embeddings)
|
|
14
|
+
# and may be used with the OpenAI JS or Python SDK by setting the base URL to
|
|
15
|
+
# `https://api.telnyx.com/v2/ai/openai`.
|
|
16
|
+
#
|
|
17
|
+
# @overload create(input:, model:, dimensions: nil, encoding_format: nil, user: nil, request_options: {})
|
|
18
|
+
#
|
|
19
|
+
# @param input [String, Array<String>] Input text to embed. Can be a string or array of strings.
|
|
20
|
+
#
|
|
21
|
+
# @param model [String] ID of the model to use. Use the List embedding models endpoint to see available
|
|
22
|
+
#
|
|
23
|
+
# @param dimensions [Integer] The number of dimensions the resulting output embeddings should have. Only suppo
|
|
24
|
+
#
|
|
25
|
+
# @param encoding_format [Symbol, Telnyx::Models::AI::OpenAI::EmbeddingCreateParams::EncodingFormat] The format to return the embeddings in.
|
|
26
|
+
#
|
|
27
|
+
# @param user [String] A unique identifier representing your end-user for monitoring and abuse detectio
|
|
28
|
+
#
|
|
29
|
+
# @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
30
|
+
#
|
|
31
|
+
# @return [Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse]
|
|
32
|
+
#
|
|
33
|
+
# @see Telnyx::Models::AI::OpenAI::EmbeddingCreateParams
|
|
34
|
+
def create(params)
|
|
35
|
+
parsed, options = Telnyx::AI::OpenAI::EmbeddingCreateParams.dump_request(params)
|
|
36
|
+
@client.request(
|
|
37
|
+
method: :post,
|
|
38
|
+
path: "ai/openai/embeddings",
|
|
39
|
+
body: parsed,
|
|
40
|
+
model: Telnyx::Models::AI::OpenAI::EmbeddingCreateResponse,
|
|
41
|
+
options: options
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns a list of available embedding models. This endpoint is compatible with
|
|
46
|
+
# the OpenAI Models API format.
|
|
47
|
+
#
|
|
48
|
+
# @overload list_models(request_options: {})
|
|
49
|
+
#
|
|
50
|
+
# @param request_options [Telnyx::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
51
|
+
#
|
|
52
|
+
# @return [Telnyx::Models::AI::OpenAI::EmbeddingListModelsResponse]
|
|
53
|
+
#
|
|
54
|
+
# @see Telnyx::Models::AI::OpenAI::EmbeddingListModelsParams
|
|
55
|
+
def list_models(params = {})
|
|
56
|
+
@client.request(
|
|
57
|
+
method: :get,
|
|
58
|
+
path: "ai/openai/embeddings/models",
|
|
59
|
+
model: Telnyx::Models::AI::OpenAI::EmbeddingListModelsResponse,
|
|
60
|
+
options: params[:request_options]
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @api private
|
|
65
|
+
#
|
|
66
|
+
# @param client [Telnyx::Client]
|
|
67
|
+
def initialize(client:)
|
|
68
|
+
@client = client
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Resources
|
|
5
|
+
class AI
|
|
6
|
+
class OpenAI
|
|
7
|
+
# @return [Telnyx::Resources::AI::OpenAI::Embeddings]
|
|
8
|
+
attr_reader :embeddings
|
|
9
|
+
|
|
10
|
+
# @api private
|
|
11
|
+
#
|
|
12
|
+
# @param client [Telnyx::Client]
|
|
13
|
+
def initialize(client:)
|
|
14
|
+
@client = client
|
|
15
|
+
@embeddings = Telnyx::Resources::AI::OpenAI::Embeddings.new(client: client)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/telnyx/resources/ai.rb
CHANGED
|
@@ -30,6 +30,9 @@ module Telnyx
|
|
|
30
30
|
# @return [Telnyx::Resources::AI::McpServers]
|
|
31
31
|
attr_reader :mcp_servers
|
|
32
32
|
|
|
33
|
+
# @return [Telnyx::Resources::AI::OpenAI]
|
|
34
|
+
attr_reader :openai
|
|
35
|
+
|
|
33
36
|
# This endpoint returns a list of Open Source and OpenAI models that are available
|
|
34
37
|
# for use. <br /><br /> **Note**: Model `id`'s will be in the form
|
|
35
38
|
# `{source}/{model_name}`. For example `openai/gpt-4` or
|
|
@@ -102,6 +105,7 @@ module Telnyx
|
|
|
102
105
|
@fine_tuning = Telnyx::Resources::AI::FineTuning.new(client: client)
|
|
103
106
|
@integrations = Telnyx::Resources::AI::Integrations.new(client: client)
|
|
104
107
|
@mcp_servers = Telnyx::Resources::AI::McpServers.new(client: client)
|
|
108
|
+
@openai = Telnyx::Resources::AI::OpenAI.new(client: client)
|
|
105
109
|
end
|
|
106
110
|
end
|
|
107
111
|
end
|
data/lib/telnyx/version.rb
CHANGED
data/lib/telnyx.rb
CHANGED
|
@@ -274,6 +274,10 @@ require_relative "telnyx/models/ai/mcp_server_retrieve_response"
|
|
|
274
274
|
require_relative "telnyx/models/ai/mcp_server_update_params"
|
|
275
275
|
require_relative "telnyx/models/ai/mcp_server_update_response"
|
|
276
276
|
require_relative "telnyx/models/ai/messaging_settings"
|
|
277
|
+
require_relative "telnyx/models/ai/openai/embedding_create_params"
|
|
278
|
+
require_relative "telnyx/models/ai/openai/embedding_create_response"
|
|
279
|
+
require_relative "telnyx/models/ai/openai/embedding_list_models_params"
|
|
280
|
+
require_relative "telnyx/models/ai/openai/embedding_list_models_response"
|
|
277
281
|
require_relative "telnyx/models/ai/privacy_settings"
|
|
278
282
|
require_relative "telnyx/models/ai/recursive_cluster"
|
|
279
283
|
require_relative "telnyx/models/ai/retrieval_tool"
|
|
@@ -2059,6 +2063,8 @@ require_relative "telnyx/resources/ai/fine_tuning/jobs"
|
|
|
2059
2063
|
require_relative "telnyx/resources/ai/integrations"
|
|
2060
2064
|
require_relative "telnyx/resources/ai/integrations/connections"
|
|
2061
2065
|
require_relative "telnyx/resources/ai/mcp_servers"
|
|
2066
|
+
require_relative "telnyx/resources/ai/openai"
|
|
2067
|
+
require_relative "telnyx/resources/ai/openai/embeddings"
|
|
2062
2068
|
require_relative "telnyx/resources/audit_events"
|
|
2063
2069
|
require_relative "telnyx/resources/authentication_providers"
|
|
2064
2070
|
require_relative "telnyx/resources/available_phone_number_blocks"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Models
|
|
5
|
+
module AI
|
|
6
|
+
module OpenAI
|
|
7
|
+
class EmbeddingCreateParams < Telnyx::Internal::Type::BaseModel
|
|
8
|
+
extend Telnyx::Internal::Type::RequestParameters::Converter
|
|
9
|
+
include Telnyx::Internal::Type::RequestParameters
|
|
10
|
+
|
|
11
|
+
OrHash =
|
|
12
|
+
T.type_alias do
|
|
13
|
+
T.any(
|
|
14
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams,
|
|
15
|
+
Telnyx::Internal::AnyHash
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Input text to embed. Can be a string or array of strings.
|
|
20
|
+
sig do
|
|
21
|
+
returns(Telnyx::AI::OpenAI::EmbeddingCreateParams::Input::Variants)
|
|
22
|
+
end
|
|
23
|
+
attr_accessor :input
|
|
24
|
+
|
|
25
|
+
# ID of the model to use. Use the List embedding models endpoint to see available
|
|
26
|
+
# models.
|
|
27
|
+
sig { returns(String) }
|
|
28
|
+
attr_accessor :model
|
|
29
|
+
|
|
30
|
+
# The number of dimensions the resulting output embeddings should have. Only
|
|
31
|
+
# supported in some models.
|
|
32
|
+
sig { returns(T.nilable(Integer)) }
|
|
33
|
+
attr_reader :dimensions
|
|
34
|
+
|
|
35
|
+
sig { params(dimensions: Integer).void }
|
|
36
|
+
attr_writer :dimensions
|
|
37
|
+
|
|
38
|
+
# The format to return the embeddings in.
|
|
39
|
+
sig do
|
|
40
|
+
returns(
|
|
41
|
+
T.nilable(
|
|
42
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::OrSymbol
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
attr_reader :encoding_format
|
|
47
|
+
|
|
48
|
+
sig do
|
|
49
|
+
params(
|
|
50
|
+
encoding_format:
|
|
51
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::OrSymbol
|
|
52
|
+
).void
|
|
53
|
+
end
|
|
54
|
+
attr_writer :encoding_format
|
|
55
|
+
|
|
56
|
+
# A unique identifier representing your end-user for monitoring and abuse
|
|
57
|
+
# detection.
|
|
58
|
+
sig { returns(T.nilable(String)) }
|
|
59
|
+
attr_reader :user
|
|
60
|
+
|
|
61
|
+
sig { params(user: String).void }
|
|
62
|
+
attr_writer :user
|
|
63
|
+
|
|
64
|
+
sig do
|
|
65
|
+
params(
|
|
66
|
+
input: Telnyx::AI::OpenAI::EmbeddingCreateParams::Input::Variants,
|
|
67
|
+
model: String,
|
|
68
|
+
dimensions: Integer,
|
|
69
|
+
encoding_format:
|
|
70
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::OrSymbol,
|
|
71
|
+
user: String,
|
|
72
|
+
request_options: Telnyx::RequestOptions::OrHash
|
|
73
|
+
).returns(T.attached_class)
|
|
74
|
+
end
|
|
75
|
+
def self.new(
|
|
76
|
+
# Input text to embed. Can be a string or array of strings.
|
|
77
|
+
input:,
|
|
78
|
+
# ID of the model to use. Use the List embedding models endpoint to see available
|
|
79
|
+
# models.
|
|
80
|
+
model:,
|
|
81
|
+
# The number of dimensions the resulting output embeddings should have. Only
|
|
82
|
+
# supported in some models.
|
|
83
|
+
dimensions: nil,
|
|
84
|
+
# The format to return the embeddings in.
|
|
85
|
+
encoding_format: nil,
|
|
86
|
+
# A unique identifier representing your end-user for monitoring and abuse
|
|
87
|
+
# detection.
|
|
88
|
+
user: nil,
|
|
89
|
+
request_options: {}
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
sig do
|
|
94
|
+
override.returns(
|
|
95
|
+
{
|
|
96
|
+
input:
|
|
97
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::Input::Variants,
|
|
98
|
+
model: String,
|
|
99
|
+
dimensions: Integer,
|
|
100
|
+
encoding_format:
|
|
101
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::OrSymbol,
|
|
102
|
+
user: String,
|
|
103
|
+
request_options: Telnyx::RequestOptions
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
def to_hash
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Input text to embed. Can be a string or array of strings.
|
|
111
|
+
module Input
|
|
112
|
+
extend Telnyx::Internal::Type::Union
|
|
113
|
+
|
|
114
|
+
Variants = T.type_alias { T.any(String, T::Array[String]) }
|
|
115
|
+
|
|
116
|
+
sig do
|
|
117
|
+
override.returns(
|
|
118
|
+
T::Array[
|
|
119
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::Input::Variants
|
|
120
|
+
]
|
|
121
|
+
)
|
|
122
|
+
end
|
|
123
|
+
def self.variants
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
StringArray =
|
|
127
|
+
T.let(
|
|
128
|
+
Telnyx::Internal::Type::ArrayOf[String],
|
|
129
|
+
Telnyx::Internal::Type::Converter
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# The format to return the embeddings in.
|
|
134
|
+
module EncodingFormat
|
|
135
|
+
extend Telnyx::Internal::Type::Enum
|
|
136
|
+
|
|
137
|
+
TaggedSymbol =
|
|
138
|
+
T.type_alias do
|
|
139
|
+
T.all(
|
|
140
|
+
Symbol,
|
|
141
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
145
|
+
|
|
146
|
+
FLOAT =
|
|
147
|
+
T.let(
|
|
148
|
+
:float,
|
|
149
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::TaggedSymbol
|
|
150
|
+
)
|
|
151
|
+
BASE64 =
|
|
152
|
+
T.let(
|
|
153
|
+
:base64,
|
|
154
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::TaggedSymbol
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
sig do
|
|
158
|
+
override.returns(
|
|
159
|
+
T::Array[
|
|
160
|
+
Telnyx::AI::OpenAI::EmbeddingCreateParams::EncodingFormat::TaggedSymbol
|
|
161
|
+
]
|
|
162
|
+
)
|
|
163
|
+
end
|
|
164
|
+
def self.values
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|