azure_cognitiveservices_qnamakerruntime 0.17.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 +7 -0
- data/LICENSE.txt +21 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime.rb +47 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/context_dto.rb +73 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/error.rb +108 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/error_code_type.rb +28 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/error_response.rb +48 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/error_response_error.rb +85 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/feedback_record_dto.rb +72 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/feedback_records_dto.rb +55 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/inner_error_model.rb +62 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/metadata_dto.rb +65 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/prompt_dto.rb +86 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/prompt_dtoqna.rb +108 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/qn_adto.rb +128 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/qn_adtocontext.rb +63 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/qn_asearch_result.rb +130 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/qn_asearch_result_context.rb +63 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/qn_asearch_result_list.rb +55 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/query_context_dto.rb +57 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/query_dto.rb +137 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/models/query_dtocontext.rb +51 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/module_definition.rb +9 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/qnamaker_runtime_client.rb +127 -0
- data/lib/4.0/generated/azure_cognitiveservices_qnamakerruntime/runtime.rb +214 -0
- data/lib/azure_cognitiveservices_qnamakerruntime.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/qnamakerruntime_profile_module.rb +135 -0
- data/lib/profiles/latest/qnamakerruntime_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/qnamakerruntime_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +147 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::QnamakerRuntime::V4_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Context object with previous QnA's information.
|
10
|
+
#
|
11
|
+
class QueryDTOContext < QueryContextDTO
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
|
16
|
+
#
|
17
|
+
# Mapper for QueryDTOContext class as Ruby Hash.
|
18
|
+
# This will be used for serialization/deserialization.
|
19
|
+
#
|
20
|
+
def self.mapper()
|
21
|
+
{
|
22
|
+
client_side_validation: true,
|
23
|
+
required: false,
|
24
|
+
serialized_name: 'QueryDTO_context',
|
25
|
+
type: {
|
26
|
+
name: 'Composite',
|
27
|
+
class_name: 'QueryDTOContext',
|
28
|
+
model_properties: {
|
29
|
+
previous_qna_id: {
|
30
|
+
client_side_validation: true,
|
31
|
+
required: false,
|
32
|
+
serialized_name: 'previousQnaId',
|
33
|
+
type: {
|
34
|
+
name: 'String'
|
35
|
+
}
|
36
|
+
},
|
37
|
+
previous_user_query: {
|
38
|
+
client_side_validation: true,
|
39
|
+
required: false,
|
40
|
+
serialized_name: 'previousUserQuery',
|
41
|
+
type: {
|
42
|
+
name: 'String'
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure end
|
7
|
+
module Azure::CognitiveServices end
|
8
|
+
module Azure::CognitiveServices::QnamakerRuntime end
|
9
|
+
module Azure::CognitiveServices::QnamakerRuntime::V4_0 end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::QnamakerRuntime::V4_0
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class QnamakerRuntimeClient < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_reader :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] QnA Maker App Service endpoint (for example:
|
21
|
+
# https://{qnaservice-hostname}.azurewebsites.net).
|
22
|
+
attr_accessor :runtime_endpoint
|
23
|
+
|
24
|
+
# @return [String] The preferred language for the response.
|
25
|
+
attr_accessor :accept_language
|
26
|
+
|
27
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
28
|
+
# Operations. Default value is 30.
|
29
|
+
attr_accessor :long_running_operation_retry_timeout
|
30
|
+
|
31
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
32
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
33
|
+
# generated and included in each request. Default is true.
|
34
|
+
attr_accessor :generate_client_request_id
|
35
|
+
|
36
|
+
# @return [Runtime] runtime
|
37
|
+
attr_reader :runtime
|
38
|
+
|
39
|
+
#
|
40
|
+
# Creates initializes a new instance of the QnamakerRuntimeClient class.
|
41
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
42
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
43
|
+
#
|
44
|
+
def initialize(credentials = nil, options = nil)
|
45
|
+
super(credentials, options)
|
46
|
+
@base_url = '{RuntimeEndpoint}/qnamaker'
|
47
|
+
|
48
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
49
|
+
@credentials = credentials
|
50
|
+
|
51
|
+
@runtime = Runtime.new(self)
|
52
|
+
@accept_language = 'en-US'
|
53
|
+
@long_running_operation_retry_timeout = 30
|
54
|
+
@generate_client_request_id = true
|
55
|
+
add_telemetry
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Makes a request and returns the body of the response.
|
60
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
61
|
+
# @param path [String] the path, relative to {base_url}.
|
62
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
63
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
64
|
+
# Example:
|
65
|
+
#
|
66
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
67
|
+
# path = "/path"
|
68
|
+
# options = {
|
69
|
+
# body: request_content,
|
70
|
+
# query_params: {'api-version' => '2016-02-01'}
|
71
|
+
# }
|
72
|
+
# result = @client.make_request(:put, path, options)
|
73
|
+
#
|
74
|
+
def make_request(method, path, options = {})
|
75
|
+
result = make_request_with_http_info(method, path, options)
|
76
|
+
result.body unless result.nil?
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Makes a request and returns the operation response.
|
81
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
82
|
+
# @param path [String] the path, relative to {base_url}.
|
83
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
84
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
85
|
+
#
|
86
|
+
def make_request_with_http_info(method, path, options = {})
|
87
|
+
result = make_request_async(method, path, options).value!
|
88
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
89
|
+
result
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Makes a request asynchronously.
|
94
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
95
|
+
# @param path [String] the path, relative to {base_url}.
|
96
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
97
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
98
|
+
#
|
99
|
+
def make_request_async(method, path, options = {})
|
100
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
101
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
102
|
+
|
103
|
+
request_url = options[:base_url] || @base_url
|
104
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
105
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
106
|
+
end
|
107
|
+
|
108
|
+
request_headers = @request_headers
|
109
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
110
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
111
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
112
|
+
|
113
|
+
super(request_url, method, path, options)
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
private
|
118
|
+
#
|
119
|
+
# Adds telemetry information.
|
120
|
+
#
|
121
|
+
def add_telemetry
|
122
|
+
sdk_information = 'azure_cognitiveservices_qnamakerruntime'
|
123
|
+
sdk_information = "#{sdk_information}/0.17.0"
|
124
|
+
add_user_agent_information(sdk_information)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::QnamakerRuntime::V4_0
|
7
|
+
#
|
8
|
+
# An API for QnAMaker runtime
|
9
|
+
#
|
10
|
+
class Runtime
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Runtime class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [QnamakerRuntimeClient] reference to the QnamakerRuntimeClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# GenerateAnswer call to query the knowledgebase.
|
26
|
+
#
|
27
|
+
# @param kb_id [String] Knowledgebase id.
|
28
|
+
# @param generate_answer_payload [QueryDTO] Post body of the request.
|
29
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
30
|
+
# will be added to the HTTP request.
|
31
|
+
#
|
32
|
+
# @return [QnASearchResultList] operation results.
|
33
|
+
#
|
34
|
+
def generate_answer(kb_id, generate_answer_payload, custom_headers:nil)
|
35
|
+
response = generate_answer_async(kb_id, generate_answer_payload, custom_headers:custom_headers).value!
|
36
|
+
response.body unless response.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# GenerateAnswer call to query the knowledgebase.
|
41
|
+
#
|
42
|
+
# @param kb_id [String] Knowledgebase id.
|
43
|
+
# @param generate_answer_payload [QueryDTO] Post body of the request.
|
44
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
45
|
+
# will be added to the HTTP request.
|
46
|
+
#
|
47
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
48
|
+
#
|
49
|
+
def generate_answer_with_http_info(kb_id, generate_answer_payload, custom_headers:nil)
|
50
|
+
generate_answer_async(kb_id, generate_answer_payload, custom_headers:custom_headers).value!
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# GenerateAnswer call to query the knowledgebase.
|
55
|
+
#
|
56
|
+
# @param kb_id [String] Knowledgebase id.
|
57
|
+
# @param generate_answer_payload [QueryDTO] Post body of the request.
|
58
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
59
|
+
# to the HTTP request.
|
60
|
+
#
|
61
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
62
|
+
#
|
63
|
+
def generate_answer_async(kb_id, generate_answer_payload, custom_headers:nil)
|
64
|
+
fail ArgumentError, '@client.runtime_endpoint is nil' if @client.runtime_endpoint.nil?
|
65
|
+
fail ArgumentError, 'kb_id is nil' if kb_id.nil?
|
66
|
+
fail ArgumentError, 'generate_answer_payload is nil' if generate_answer_payload.nil?
|
67
|
+
|
68
|
+
|
69
|
+
request_headers = {}
|
70
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
71
|
+
|
72
|
+
# Set Headers
|
73
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
74
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
75
|
+
|
76
|
+
# Serialize Request
|
77
|
+
request_mapper = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryDTO.mapper()
|
78
|
+
request_content = @client.serialize(request_mapper, generate_answer_payload)
|
79
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
80
|
+
|
81
|
+
path_template = 'knowledgebases/{kbId}/generateAnswer'
|
82
|
+
|
83
|
+
request_url = @base_url || @client.base_url
|
84
|
+
request_url = request_url.gsub('{RuntimeEndpoint}', @client.runtime_endpoint)
|
85
|
+
|
86
|
+
options = {
|
87
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
88
|
+
path_params: {'kbId' => kb_id},
|
89
|
+
body: request_content,
|
90
|
+
headers: request_headers.merge(custom_headers || {}),
|
91
|
+
base_url: request_url
|
92
|
+
}
|
93
|
+
promise = @client.make_request_async(:post, path_template, options)
|
94
|
+
|
95
|
+
promise = promise.then do |result|
|
96
|
+
http_response = result.response
|
97
|
+
status_code = http_response.status
|
98
|
+
response_content = http_response.body
|
99
|
+
unless status_code == 200
|
100
|
+
error_model = JSON.load(response_content)
|
101
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
102
|
+
end
|
103
|
+
|
104
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
105
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
106
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
107
|
+
# Deserialize Response
|
108
|
+
if status_code == 200
|
109
|
+
begin
|
110
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
111
|
+
result_mapper = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResultList.mapper()
|
112
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
113
|
+
rescue Exception => e
|
114
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
result
|
119
|
+
end
|
120
|
+
|
121
|
+
promise.execute
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Train call to add suggestions to the knowledgebase.
|
126
|
+
#
|
127
|
+
# @param kb_id [String] Knowledgebase id.
|
128
|
+
# @param train_payload [FeedbackRecordsDTO] Post body of the request.
|
129
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
130
|
+
# will be added to the HTTP request.
|
131
|
+
#
|
132
|
+
#
|
133
|
+
def train(kb_id, train_payload, custom_headers:nil)
|
134
|
+
response = train_async(kb_id, train_payload, custom_headers:custom_headers).value!
|
135
|
+
nil
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Train call to add suggestions to the knowledgebase.
|
140
|
+
#
|
141
|
+
# @param kb_id [String] Knowledgebase id.
|
142
|
+
# @param train_payload [FeedbackRecordsDTO] Post body of the request.
|
143
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
144
|
+
# will be added to the HTTP request.
|
145
|
+
#
|
146
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
147
|
+
#
|
148
|
+
def train_with_http_info(kb_id, train_payload, custom_headers:nil)
|
149
|
+
train_async(kb_id, train_payload, custom_headers:custom_headers).value!
|
150
|
+
end
|
151
|
+
|
152
|
+
#
|
153
|
+
# Train call to add suggestions to the knowledgebase.
|
154
|
+
#
|
155
|
+
# @param kb_id [String] Knowledgebase id.
|
156
|
+
# @param train_payload [FeedbackRecordsDTO] Post body of the request.
|
157
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
158
|
+
# to the HTTP request.
|
159
|
+
#
|
160
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
161
|
+
#
|
162
|
+
def train_async(kb_id, train_payload, custom_headers:nil)
|
163
|
+
fail ArgumentError, '@client.runtime_endpoint is nil' if @client.runtime_endpoint.nil?
|
164
|
+
fail ArgumentError, 'kb_id is nil' if kb_id.nil?
|
165
|
+
fail ArgumentError, 'train_payload is nil' if train_payload.nil?
|
166
|
+
|
167
|
+
|
168
|
+
request_headers = {}
|
169
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
170
|
+
|
171
|
+
# Set Headers
|
172
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
173
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
174
|
+
|
175
|
+
# Serialize Request
|
176
|
+
request_mapper = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::FeedbackRecordsDTO.mapper()
|
177
|
+
request_content = @client.serialize(request_mapper, train_payload)
|
178
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
179
|
+
|
180
|
+
path_template = 'knowledgebases/{kbId}/train'
|
181
|
+
|
182
|
+
request_url = @base_url || @client.base_url
|
183
|
+
request_url = request_url.gsub('{RuntimeEndpoint}', @client.runtime_endpoint)
|
184
|
+
|
185
|
+
options = {
|
186
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
187
|
+
path_params: {'kbId' => kb_id},
|
188
|
+
body: request_content,
|
189
|
+
headers: request_headers.merge(custom_headers || {}),
|
190
|
+
base_url: request_url
|
191
|
+
}
|
192
|
+
promise = @client.make_request_async(:post, path_template, options)
|
193
|
+
|
194
|
+
promise = promise.then do |result|
|
195
|
+
http_response = result.response
|
196
|
+
status_code = http_response.status
|
197
|
+
response_content = http_response.body
|
198
|
+
unless status_code == 204
|
199
|
+
error_model = JSON.load(response_content)
|
200
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
201
|
+
end
|
202
|
+
|
203
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
204
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
205
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
206
|
+
|
207
|
+
result
|
208
|
+
end
|
209
|
+
|
210
|
+
promise.execute
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require '4.0/generated/azure_cognitiveservices_qnamakerruntime'
|
6
|
+
require 'profiles/latest/qnamakerruntime_latest_profile_client'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
module Azure end
|
6
|
+
module Azure::Cognitiveservices end
|
7
|
+
module Azure::Cognitiveservices::Qnamakerruntime end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require 'azure_cognitiveservices_qnamakerruntime'
|
6
|
+
|
7
|
+
module Azure::QnamakerRuntime::Profiles::Latest
|
8
|
+
Runtime = Azure::CognitiveServices::QnamakerRuntime::V4_0::Runtime
|
9
|
+
|
10
|
+
module Models
|
11
|
+
Error = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::Error
|
12
|
+
MetadataDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::MetadataDTO
|
13
|
+
ErrorResponse = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ErrorResponse
|
14
|
+
InnerErrorModel = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::InnerErrorModel
|
15
|
+
FeedbackRecordDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::FeedbackRecordDTO
|
16
|
+
QnASearchResult = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResult
|
17
|
+
ContextDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ContextDTO
|
18
|
+
QnADTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnADTO
|
19
|
+
QueryDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryDTO
|
20
|
+
QnASearchResultList = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResultList
|
21
|
+
QueryContextDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryContextDTO
|
22
|
+
PromptDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::PromptDTO
|
23
|
+
FeedbackRecordsDTO = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::FeedbackRecordsDTO
|
24
|
+
QnADTOContext = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnADTOContext
|
25
|
+
PromptDTOQna = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::PromptDTOQna
|
26
|
+
ErrorResponseError = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ErrorResponseError
|
27
|
+
QueryDTOContext = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryDTOContext
|
28
|
+
QnASearchResultContext = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResultContext
|
29
|
+
ErrorCodeType = Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ErrorCodeType
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# QnamakerRuntimeDataClass
|
34
|
+
#
|
35
|
+
class QnamakerRuntimeDataClass
|
36
|
+
attr_reader :runtime, :configurable, :base_url, :options, :model_classes
|
37
|
+
|
38
|
+
def initialize(options = {})
|
39
|
+
if options.is_a?(Hash) && options.length == 0
|
40
|
+
@options = setup_default_options
|
41
|
+
else
|
42
|
+
@options = options
|
43
|
+
end
|
44
|
+
|
45
|
+
reset!(options)
|
46
|
+
|
47
|
+
@configurable = self
|
48
|
+
@base_url = options[:base_url].nil? ? nil:options[:base_url]
|
49
|
+
@options = options[:options].nil? ? nil:options[:options]
|
50
|
+
|
51
|
+
@client_0 = Azure::CognitiveServices::QnamakerRuntime::V4_0::QnamakerRuntimeClient.new(configurable.credentials, options)
|
52
|
+
if(@client_0.respond_to?(:subscription_id))
|
53
|
+
@client_0.subscription_id = configurable.subscription_id
|
54
|
+
end
|
55
|
+
add_telemetry(@client_0)
|
56
|
+
@runtime = @client_0.runtime
|
57
|
+
|
58
|
+
@model_classes = ModelClasses.new
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_telemetry(client)
|
62
|
+
profile_information = 'Profiles/Latest/QnamakerRuntime'
|
63
|
+
client.add_user_agent_information(profile_information)
|
64
|
+
end
|
65
|
+
|
66
|
+
def method_missing(method, *args)
|
67
|
+
if @client_0.respond_to?method
|
68
|
+
@client_0.send(method, *args)
|
69
|
+
else
|
70
|
+
super
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
class ModelClasses
|
77
|
+
def error
|
78
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::Error
|
79
|
+
end
|
80
|
+
def metadata_dto
|
81
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::MetadataDTO
|
82
|
+
end
|
83
|
+
def error_response
|
84
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ErrorResponse
|
85
|
+
end
|
86
|
+
def inner_error_model
|
87
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::InnerErrorModel
|
88
|
+
end
|
89
|
+
def feedback_record_dto
|
90
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::FeedbackRecordDTO
|
91
|
+
end
|
92
|
+
def qn_asearch_result
|
93
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResult
|
94
|
+
end
|
95
|
+
def context_dto
|
96
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ContextDTO
|
97
|
+
end
|
98
|
+
def qn_adto
|
99
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnADTO
|
100
|
+
end
|
101
|
+
def query_dto
|
102
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryDTO
|
103
|
+
end
|
104
|
+
def qn_asearch_result_list
|
105
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResultList
|
106
|
+
end
|
107
|
+
def query_context_dto
|
108
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryContextDTO
|
109
|
+
end
|
110
|
+
def prompt_dto
|
111
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::PromptDTO
|
112
|
+
end
|
113
|
+
def feedback_records_dto
|
114
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::FeedbackRecordsDTO
|
115
|
+
end
|
116
|
+
def qn_adtocontext
|
117
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnADTOContext
|
118
|
+
end
|
119
|
+
def prompt_dtoqna
|
120
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::PromptDTOQna
|
121
|
+
end
|
122
|
+
def error_response_error
|
123
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ErrorResponseError
|
124
|
+
end
|
125
|
+
def query_dtocontext
|
126
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QueryDTOContext
|
127
|
+
end
|
128
|
+
def qn_asearch_result_context
|
129
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::QnASearchResultContext
|
130
|
+
end
|
131
|
+
def error_code_type
|
132
|
+
Azure::CognitiveServices::QnamakerRuntime::V4_0::Models::ErrorCodeType
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|