azure_openai_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +178 -0
- data/lib/azure_openai_client/api/default_api.rb +232 -0
- data/lib/azure_openai_client/api_client.rb +390 -0
- data/lib/azure_openai_client/api_error.rb +58 -0
- data/lib/azure_openai_client/configuration.rb +214 -0
- data/lib/azure_openai_client/models/chat_completions_body.rb +334 -0
- data/lib/azure_openai_client/models/deploymentid_completions_body.rb +406 -0
- data/lib/azure_openai_client/models/deploymentid_embeddings_body.rb +202 -0
- data/lib/azure_openai_client/models/deploymentsdeploymentidchatcompletions_messages.rb +274 -0
- data/lib/azure_openai_client/models/error_response.rb +209 -0
- data/lib/azure_openai_client/models/error_response_error.rb +236 -0
- data/lib/azure_openai_client/models/inline_response_200.rb +281 -0
- data/lib/azure_openai_client/models/inline_response_200_1.rb +258 -0
- data/lib/azure_openai_client/models/inline_response_200_1_data.rb +244 -0
- data/lib/azure_openai_client/models/inline_response_200_1_usage.rb +228 -0
- data/lib/azure_openai_client/models/inline_response_200_2.rb +281 -0
- data/lib/azure_openai_client/models/inline_response_200_2_choices.rb +227 -0
- data/lib/azure_openai_client/models/inline_response_200_2_message.rb +264 -0
- data/lib/azure_openai_client/models/inline_response_200_2_usage.rb +242 -0
- data/lib/azure_openai_client/models/inline_response_200_choices.rb +236 -0
- data/lib/azure_openai_client/models/inline_response_200_logprobs.rb +244 -0
- data/lib/azure_openai_client/models/inline_response_200_usage.rb +242 -0
- data/lib/azure_openai_client/models/one_ofchat_completions_body_stop.rb +198 -0
- data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_prompt.rb +198 -0
- data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_stop.rb +198 -0
- data/lib/azure_openai_client/version.rb +16 -0
- data/lib/azure_openai_client.rb +61 -0
- data/spec/api/default_api_spec.rb +75 -0
- data/spec/api_client_spec.rb +229 -0
- data/spec/configuration_spec.rb +78 -0
- data/spec/models/chat_completions_body_spec.rb +102 -0
- data/spec/models/deploymentid_completions_body_spec.rb +144 -0
- data/spec/models/deploymentid_embeddings_body_spec.rb +36 -0
- data/spec/models/deploymentsdeploymentidchatcompletions_messages_spec.rb +58 -0
- data/spec/models/error_response_error_spec.rb +60 -0
- data/spec/models/error_response_spec.rb +42 -0
- data/spec/models/inline_response_200_1_data_spec.rb +54 -0
- data/spec/models/inline_response_200_1_spec.rb +60 -0
- data/spec/models/inline_response_200_1_usage_spec.rb +48 -0
- data/spec/models/inline_response_200_2_choices_spec.rb +54 -0
- data/spec/models/inline_response_200_2_message_spec.rb +52 -0
- data/spec/models/inline_response_200_2_spec.rb +72 -0
- data/spec/models/inline_response_200_2_usage_spec.rb +54 -0
- data/spec/models/inline_response_200_choices_spec.rb +60 -0
- data/spec/models/inline_response_200_logprobs_spec.rb +60 -0
- data/spec/models/inline_response_200_spec.rb +72 -0
- data/spec/models/inline_response_200_usage_spec.rb +54 -0
- data/spec/models/one_ofchat_completions_body_stop_spec.rb +36 -0
- data/spec/models/one_ofdeploymentid_completions_body_prompt_spec.rb +36 -0
- data/spec/models/one_ofdeploymentid_completions_body_stop_spec.rb +36 -0
- data/spec/spec_helper.rb +112 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a16f8557725c03a595a0917831440f10db8b079067bff26f101db47ce55bfcf
|
4
|
+
data.tar.gz: d69ef18fd78150c8806034e6441028a4ac07a7c6ac0a01df023a1770673dd20f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce73995a7ce5ac1488d3e41e9432cc55b2b2c6ab80008dbcaa3a0060ea3fb2e3ee263a93bcb1335fb2a428d64a8adeaad93b1764a4c2a1a38d596442e4417106
|
7
|
+
data.tar.gz: f56d3bf7714e0db8467f88788ed27df098461e98a509ad9c389dd30783d8abaa84d46276de5e8e02d2df51d4f385dbbffa9b5e0f54ed792cf3503d7a20d5aa81
|
data/README.md
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
# azure_openai_client
|
2
|
+
|
3
|
+
AzureOpenaiClient - the Ruby gem for the Azure OpenAI Service API
|
4
|
+
|
5
|
+
Azure OpenAI APIs for completions and search
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
|
+
|
9
|
+
- API version: 2023-05-15
|
10
|
+
- Package version: 1.0.0
|
11
|
+
- Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
### Build a gem
|
16
|
+
|
17
|
+
To build the Ruby code into a gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gem build azure_openai_client.gemspec
|
21
|
+
```
|
22
|
+
|
23
|
+
Then either install the gem locally:
|
24
|
+
|
25
|
+
```shell
|
26
|
+
gem install ./azure_openai_client-1.0.0.gem
|
27
|
+
```
|
28
|
+
(for development, run `gem install --dev ./azure_openai_client-1.0.0.gem` to install the development dependencies)
|
29
|
+
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
|
+
|
32
|
+
Finally add this to the Gemfile:
|
33
|
+
|
34
|
+
gem 'azure_openai_client', '~> 1.0.0'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
|
39
|
+
|
40
|
+
gem 'azure_openai_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
|
41
|
+
|
42
|
+
### Include the Ruby code directly
|
43
|
+
|
44
|
+
Include the Ruby code directly using `-I` as follows:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
ruby -Ilib script.rb
|
48
|
+
```
|
49
|
+
|
50
|
+
## Getting Started
|
51
|
+
|
52
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
53
|
+
```ruby
|
54
|
+
# Load the gem
|
55
|
+
require 'azure_openai_client'
|
56
|
+
# Setup authorization
|
57
|
+
AzureOpenaiClient.configure do |config|
|
58
|
+
# Configure API key authorization: apiKey
|
59
|
+
config.api_key['api-key'] = 'YOUR API KEY'
|
60
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
61
|
+
#config.api_key_prefix['api-key'] = 'Bearer'
|
62
|
+
|
63
|
+
# Configure OAuth2 access token for authorization: bearer
|
64
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
65
|
+
end
|
66
|
+
|
67
|
+
api_instance = AzureOpenaiClient::DefaultApi.new
|
68
|
+
body = AzureOpenaiClient::ChatCompletionsBody.new # ChatCompletionsBody |
|
69
|
+
deployment_id = 'deployment_id_example' # String |
|
70
|
+
api_version = 'api_version_example' # String |
|
71
|
+
|
72
|
+
|
73
|
+
begin
|
74
|
+
#Creates a completion for the chat message
|
75
|
+
result = api_instance.chat_completions_create(body, deployment_id, api_version)
|
76
|
+
p result
|
77
|
+
rescue AzureOpenaiClient::ApiError => e
|
78
|
+
puts "Exception when calling DefaultApi->chat_completions_create: #{e}"
|
79
|
+
end
|
80
|
+
# Setup authorization
|
81
|
+
AzureOpenaiClient.configure do |config|
|
82
|
+
# Configure API key authorization: apiKey
|
83
|
+
config.api_key['api-key'] = 'YOUR API KEY'
|
84
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
85
|
+
#config.api_key_prefix['api-key'] = 'Bearer'
|
86
|
+
|
87
|
+
# Configure OAuth2 access token for authorization: bearer
|
88
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
89
|
+
end
|
90
|
+
|
91
|
+
api_instance = AzureOpenaiClient::DefaultApi.new
|
92
|
+
body = AzureOpenaiClient::DeploymentidCompletionsBody.new # DeploymentidCompletionsBody |
|
93
|
+
deployment_id = 'deployment_id_example' # String |
|
94
|
+
api_version = 'api_version_example' # String |
|
95
|
+
|
96
|
+
|
97
|
+
begin
|
98
|
+
#Creates a completion for the provided prompt, parameters and chosen model.
|
99
|
+
result = api_instance.completions_create(body, deployment_id, api_version)
|
100
|
+
p result
|
101
|
+
rescue AzureOpenaiClient::ApiError => e
|
102
|
+
puts "Exception when calling DefaultApi->completions_create: #{e}"
|
103
|
+
end
|
104
|
+
# Setup authorization
|
105
|
+
AzureOpenaiClient.configure do |config|
|
106
|
+
# Configure API key authorization: apiKey
|
107
|
+
config.api_key['api-key'] = 'YOUR API KEY'
|
108
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
109
|
+
#config.api_key_prefix['api-key'] = 'Bearer'
|
110
|
+
|
111
|
+
# Configure OAuth2 access token for authorization: bearer
|
112
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
113
|
+
end
|
114
|
+
|
115
|
+
api_instance = AzureOpenaiClient::DefaultApi.new
|
116
|
+
body = nil # Hash |
|
117
|
+
deployment_id = 'deployment_id_example' # String | The deployment id of the model which was deployed.
|
118
|
+
api_version = 'api_version_example' # String |
|
119
|
+
|
120
|
+
|
121
|
+
begin
|
122
|
+
#Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
123
|
+
result = api_instance.embeddings_create(body, deployment_id, api_version)
|
124
|
+
p result
|
125
|
+
rescue AzureOpenaiClient::ApiError => e
|
126
|
+
puts "Exception when calling DefaultApi->embeddings_create: #{e}"
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
## Documentation for API Endpoints
|
131
|
+
|
132
|
+
All URIs are relative to *https://{endpoint}/openai*
|
133
|
+
|
134
|
+
Class | Method | HTTP request | Description
|
135
|
+
------------ | ------------- | ------------- | -------------
|
136
|
+
*AzureOpenaiClient::DefaultApi* | [**chat_completions_create**](docs/DefaultApi.md#chat_completions_create) | **POST** /deployments/{deployment-id}/chat/completions | Creates a completion for the chat message
|
137
|
+
*AzureOpenaiClient::DefaultApi* | [**completions_create**](docs/DefaultApi.md#completions_create) | **POST** /deployments/{deployment-id}/completions | Creates a completion for the provided prompt, parameters and chosen model.
|
138
|
+
*AzureOpenaiClient::DefaultApi* | [**embeddings_create**](docs/DefaultApi.md#embeddings_create) | **POST** /deployments/{deployment-id}/embeddings | Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
139
|
+
|
140
|
+
## Documentation for Models
|
141
|
+
|
142
|
+
- [AzureOpenaiClient::ChatCompletionsBody](docs/ChatCompletionsBody.md)
|
143
|
+
- [AzureOpenaiClient::DeploymentidCompletionsBody](docs/DeploymentidCompletionsBody.md)
|
144
|
+
- [AzureOpenaiClient::DeploymentidEmbeddingsBody](docs/DeploymentidEmbeddingsBody.md)
|
145
|
+
- [AzureOpenaiClient::DeploymentsdeploymentidchatcompletionsMessages](docs/DeploymentsdeploymentidchatcompletionsMessages.md)
|
146
|
+
- [AzureOpenaiClient::ErrorResponse](docs/ErrorResponse.md)
|
147
|
+
- [AzureOpenaiClient::ErrorResponseError](docs/ErrorResponseError.md)
|
148
|
+
- [AzureOpenaiClient::InlineResponse200](docs/InlineResponse200.md)
|
149
|
+
- [AzureOpenaiClient::InlineResponse2001](docs/InlineResponse2001.md)
|
150
|
+
- [AzureOpenaiClient::InlineResponse2001Data](docs/InlineResponse2001Data.md)
|
151
|
+
- [AzureOpenaiClient::InlineResponse2001Usage](docs/InlineResponse2001Usage.md)
|
152
|
+
- [AzureOpenaiClient::InlineResponse2002](docs/InlineResponse2002.md)
|
153
|
+
- [AzureOpenaiClient::InlineResponse2002Choices](docs/InlineResponse2002Choices.md)
|
154
|
+
- [AzureOpenaiClient::InlineResponse2002Message](docs/InlineResponse2002Message.md)
|
155
|
+
- [AzureOpenaiClient::InlineResponse2002Usage](docs/InlineResponse2002Usage.md)
|
156
|
+
- [AzureOpenaiClient::InlineResponse200Choices](docs/InlineResponse200Choices.md)
|
157
|
+
- [AzureOpenaiClient::InlineResponse200Logprobs](docs/InlineResponse200Logprobs.md)
|
158
|
+
- [AzureOpenaiClient::InlineResponse200Usage](docs/InlineResponse200Usage.md)
|
159
|
+
- [AzureOpenaiClient::OneOfchatCompletionsBodyStop](docs/OneOfchatCompletionsBodyStop.md)
|
160
|
+
- [AzureOpenaiClient::OneOfdeploymentidCompletionsBodyPrompt](docs/OneOfdeploymentidCompletionsBodyPrompt.md)
|
161
|
+
- [AzureOpenaiClient::OneOfdeploymentidCompletionsBodyStop](docs/OneOfdeploymentidCompletionsBodyStop.md)
|
162
|
+
|
163
|
+
## Documentation for Authorization
|
164
|
+
|
165
|
+
|
166
|
+
### apiKey
|
167
|
+
|
168
|
+
- **Type**: API key
|
169
|
+
- **API key parameter name**: api-key
|
170
|
+
- **Location**: HTTP header
|
171
|
+
|
172
|
+
### bearer
|
173
|
+
|
174
|
+
- **Type**: OAuth
|
175
|
+
- **Flow**: implicit
|
176
|
+
- **Authorization URL**: https://login.microsoftonline.com/common/oauth2/v2.0/authorize
|
177
|
+
- **Scopes**:
|
178
|
+
|
@@ -0,0 +1,232 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
=begin
|
4
|
+
#Azure OpenAI Service API
|
5
|
+
|
6
|
+
#Azure OpenAI APIs for completions and search
|
7
|
+
|
8
|
+
OpenAPI spec version: 2023-05-15
|
9
|
+
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
+
Swagger Codegen version: 3.0.42
|
12
|
+
=end
|
13
|
+
|
14
|
+
module AzureOpenaiClient
|
15
|
+
class DefaultApi
|
16
|
+
attr_accessor :api_client
|
17
|
+
|
18
|
+
def initialize(api_client = ApiClient.default)
|
19
|
+
@api_client = api_client
|
20
|
+
end
|
21
|
+
|
22
|
+
# Creates a completion for the chat message
|
23
|
+
# @param body
|
24
|
+
# @param api_version
|
25
|
+
# @param deployment_id
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [InlineResponse2002]
|
28
|
+
def chat_completions_create(body, api_version, deployment_id, opts = {})
|
29
|
+
data, _status_code, _headers = chat_completions_create_with_http_info(body, api_version, deployment_id, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates a completion for the chat message
|
34
|
+
# @param body
|
35
|
+
# @param api_version
|
36
|
+
# @param deployment_id
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
|
39
|
+
def chat_completions_create_with_http_info(body, api_version, deployment_id, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.chat_completions_create ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'body' is set
|
44
|
+
if @api_client.config.client_side_validation && body.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling DefaultApi.chat_completions_create"
|
46
|
+
end
|
47
|
+
# verify the required parameter 'api_version' is set
|
48
|
+
if @api_client.config.client_side_validation && api_version.nil?
|
49
|
+
fail ArgumentError, "Missing the required parameter 'api_version' when calling DefaultApi.chat_completions_create"
|
50
|
+
end
|
51
|
+
# verify the required parameter 'deployment_id' is set
|
52
|
+
if @api_client.config.client_side_validation && deployment_id.nil?
|
53
|
+
fail ArgumentError, "Missing the required parameter 'deployment_id' when calling DefaultApi.chat_completions_create"
|
54
|
+
end
|
55
|
+
# resource path
|
56
|
+
local_var_path = '/deployments/{deployment-id}/chat/completions'.sub('{' + 'deployment-id' + '}', deployment_id.to_s)
|
57
|
+
|
58
|
+
# query parameters
|
59
|
+
query_params = opts[:query_params] || {}
|
60
|
+
query_params[:'api-version'] = api_version
|
61
|
+
|
62
|
+
# header parameters
|
63
|
+
header_params = opts[:header_params] || {}
|
64
|
+
# HTTP header 'Accept' (if needed)
|
65
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
66
|
+
# HTTP header 'Content-Type'
|
67
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
68
|
+
|
69
|
+
# form parameters
|
70
|
+
form_params = opts[:form_params] || {}
|
71
|
+
|
72
|
+
# http body (model)
|
73
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
74
|
+
|
75
|
+
return_type = opts[:return_type] || 'InlineResponse2002'
|
76
|
+
|
77
|
+
auth_names = opts[:auth_names] || ['apiKey', 'bearer']
|
78
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
79
|
+
header_params: header_params,
|
80
|
+
query_params: query_params,
|
81
|
+
form_params: form_params,
|
82
|
+
body: post_body,
|
83
|
+
auth_names: auth_names,
|
84
|
+
return_type: return_type)
|
85
|
+
|
86
|
+
if @api_client.config.debugging
|
87
|
+
@api_client.config.logger.debug "API called: DefaultApi#chat_completions_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
88
|
+
end
|
89
|
+
return data, status_code, headers
|
90
|
+
end
|
91
|
+
|
92
|
+
# Creates a completion for the provided prompt, parameters and chosen model.
|
93
|
+
# @param body
|
94
|
+
# @param api_version
|
95
|
+
# @param deployment_id
|
96
|
+
# @param [Hash] opts the optional parameters
|
97
|
+
# @return [InlineResponse200]
|
98
|
+
def completions_create(body, api_version, deployment_id, opts = {})
|
99
|
+
data, _status_code, _headers = completions_create_with_http_info(body, api_version, deployment_id, opts)
|
100
|
+
data
|
101
|
+
end
|
102
|
+
|
103
|
+
# Creates a completion for the provided prompt, parameters and chosen model.
|
104
|
+
# @param body
|
105
|
+
# @param api_version
|
106
|
+
# @param deployment_id
|
107
|
+
# @param [Hash] opts the optional parameters
|
108
|
+
# @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
|
109
|
+
def completions_create_with_http_info(body, api_version, deployment_id, opts = {})
|
110
|
+
if @api_client.config.debugging
|
111
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.completions_create ...'
|
112
|
+
end
|
113
|
+
# verify the required parameter 'body' is set
|
114
|
+
if @api_client.config.client_side_validation && body.nil?
|
115
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling DefaultApi.completions_create"
|
116
|
+
end
|
117
|
+
# verify the required parameter 'api_version' is set
|
118
|
+
if @api_client.config.client_side_validation && api_version.nil?
|
119
|
+
fail ArgumentError, "Missing the required parameter 'api_version' when calling DefaultApi.completions_create"
|
120
|
+
end
|
121
|
+
# verify the required parameter 'deployment_id' is set
|
122
|
+
if @api_client.config.client_side_validation && deployment_id.nil?
|
123
|
+
fail ArgumentError, "Missing the required parameter 'deployment_id' when calling DefaultApi.completions_create"
|
124
|
+
end
|
125
|
+
# resource path
|
126
|
+
local_var_path = '/deployments/{deployment-id}/completions'.sub('{' + 'deployment-id' + '}', deployment_id.to_s)
|
127
|
+
|
128
|
+
# query parameters
|
129
|
+
query_params = opts[:query_params] || {}
|
130
|
+
query_params[:'api-version'] = api_version
|
131
|
+
|
132
|
+
# header parameters
|
133
|
+
header_params = opts[:header_params] || {}
|
134
|
+
# HTTP header 'Accept' (if needed)
|
135
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
136
|
+
# HTTP header 'Content-Type'
|
137
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
138
|
+
|
139
|
+
# form parameters
|
140
|
+
form_params = opts[:form_params] || {}
|
141
|
+
|
142
|
+
# http body (model)
|
143
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
144
|
+
|
145
|
+
return_type = opts[:return_type] || 'InlineResponse200'
|
146
|
+
|
147
|
+
auth_names = opts[:auth_names] || ['apiKey', 'bearer']
|
148
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
149
|
+
header_params: header_params,
|
150
|
+
query_params: query_params,
|
151
|
+
form_params: form_params,
|
152
|
+
body: post_body,
|
153
|
+
auth_names: auth_names,
|
154
|
+
return_type: return_type)
|
155
|
+
|
156
|
+
if @api_client.config.debugging
|
157
|
+
@api_client.config.logger.debug "API called: DefaultApi#completions_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
158
|
+
end
|
159
|
+
return data, status_code, headers
|
160
|
+
end
|
161
|
+
|
162
|
+
# Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
163
|
+
# @param body
|
164
|
+
# @param api_version
|
165
|
+
# @param deployment_id The deployment id of the model which was deployed.
|
166
|
+
# @param [Hash] opts the optional parameters
|
167
|
+
# @return [InlineResponse2001]
|
168
|
+
def embeddings_create(body, api_version, deployment_id, opts = {})
|
169
|
+
data, _status_code, _headers = embeddings_create_with_http_info(body, api_version, deployment_id, opts)
|
170
|
+
data
|
171
|
+
end
|
172
|
+
|
173
|
+
# Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
174
|
+
# @param body
|
175
|
+
# @param api_version
|
176
|
+
# @param deployment_id The deployment id of the model which was deployed.
|
177
|
+
# @param [Hash] opts the optional parameters
|
178
|
+
# @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
|
179
|
+
def embeddings_create_with_http_info(body, api_version, deployment_id, opts = {})
|
180
|
+
if @api_client.config.debugging
|
181
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.embeddings_create ...'
|
182
|
+
end
|
183
|
+
# verify the required parameter 'body' is set
|
184
|
+
if @api_client.config.client_side_validation && body.nil?
|
185
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling DefaultApi.embeddings_create"
|
186
|
+
end
|
187
|
+
# verify the required parameter 'api_version' is set
|
188
|
+
if @api_client.config.client_side_validation && api_version.nil?
|
189
|
+
fail ArgumentError, "Missing the required parameter 'api_version' when calling DefaultApi.embeddings_create"
|
190
|
+
end
|
191
|
+
# verify the required parameter 'deployment_id' is set
|
192
|
+
if @api_client.config.client_side_validation && deployment_id.nil?
|
193
|
+
fail ArgumentError, "Missing the required parameter 'deployment_id' when calling DefaultApi.embeddings_create"
|
194
|
+
end
|
195
|
+
# resource path
|
196
|
+
local_var_path = '/deployments/{deployment-id}/embeddings'.sub('{' + 'deployment-id' + '}', deployment_id.to_s)
|
197
|
+
|
198
|
+
# query parameters
|
199
|
+
query_params = opts[:query_params] || {}
|
200
|
+
query_params[:'api-version'] = api_version
|
201
|
+
|
202
|
+
# header parameters
|
203
|
+
header_params = opts[:header_params] || {}
|
204
|
+
# HTTP header 'Accept' (if needed)
|
205
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
206
|
+
# HTTP header 'Content-Type'
|
207
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
208
|
+
|
209
|
+
# form parameters
|
210
|
+
form_params = opts[:form_params] || {}
|
211
|
+
|
212
|
+
# http body (model)
|
213
|
+
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
214
|
+
|
215
|
+
return_type = opts[:return_type] || 'InlineResponse2001'
|
216
|
+
|
217
|
+
auth_names = opts[:auth_names] || ['apiKey', 'bearer']
|
218
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
219
|
+
header_params: header_params,
|
220
|
+
query_params: query_params,
|
221
|
+
form_params: form_params,
|
222
|
+
body: post_body,
|
223
|
+
auth_names: auth_names,
|
224
|
+
return_type: return_type)
|
225
|
+
|
226
|
+
if @api_client.config.debugging
|
227
|
+
@api_client.config.logger.debug "API called: DefaultApi#embeddings_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
228
|
+
end
|
229
|
+
return data, status_code, headers
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|