azure_openai_client 0.0.1 → 0.0.2
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/Gemfile +10 -0
- data/Gemfile.lock +76 -0
- data/README.md +50 -87
- data/Rakefile +10 -0
- data/azure_openai_client.gemspec +38 -0
- data/docs/ChatCompletionsCreate200Response.md +28 -0
- data/docs/ChatCompletionsCreate200ResponseChoicesInner.md +22 -0
- data/docs/ChatCompletionsCreate200ResponseChoicesInnerMessage.md +20 -0
- data/docs/ChatCompletionsCreate200ResponseUsage.md +22 -0
- data/docs/ChatCompletionsCreateRequest.md +38 -0
- data/docs/ChatCompletionsCreateRequestMessagesInner.md +22 -0
- data/docs/ChatCompletionsCreateRequestStop.md +49 -0
- data/docs/CompletionsCreate200Response.md +28 -0
- data/docs/CompletionsCreate200ResponseChoicesInner.md +24 -0
- data/docs/CompletionsCreate200ResponseChoicesInnerLogprobs.md +24 -0
- data/docs/CompletionsCreate200ResponseUsage.md +22 -0
- data/docs/CompletionsCreateRequest.md +52 -0
- data/docs/CompletionsCreateRequestPrompt.md +49 -0
- data/docs/CompletionsCreateRequestStop.md +49 -0
- data/docs/DefaultApi.md +238 -0
- data/docs/EmbeddingsCreate200Response.md +24 -0
- data/docs/EmbeddingsCreate200ResponseDataInner.md +22 -0
- data/docs/EmbeddingsCreate200ResponseUsage.md +20 -0
- data/docs/EmbeddingsCreateRequest.md +24 -0
- data/docs/EmbeddingsCreateRequestInput.md +49 -0
- data/docs/ErrorResponse.md +18 -0
- data/docs/ErrorResponseError.md +24 -0
- data/git_push.sh +57 -0
- data/inference.json +816 -0
- data/lib/azure_openai_client/api/default_api.rb +120 -93
- data/lib/azure_openai_client/api_client.rb +77 -75
- data/lib/azure_openai_client/api_error.rb +5 -5
- data/lib/azure_openai_client/configuration.rb +114 -22
- data/lib/azure_openai_client/models/{inline_response_200_2.rb → chat_completions_create200_response.rb} +34 -26
- data/lib/azure_openai_client/models/{inline_response_200_2_choices.rb → chat_completions_create200_response_choices_inner.rb} +28 -20
- data/lib/azure_openai_client/models/{inline_response_200_2_message.rb → chat_completions_create200_response_choices_inner_message.rb} +28 -20
- data/lib/azure_openai_client/models/{inline_response_200_2_usage.rb → chat_completions_create200_response_usage.rb} +28 -20
- data/lib/azure_openai_client/models/{chat_completions_body.rb → chat_completions_create_request.rb} +183 -37
- data/lib/azure_openai_client/models/{deploymentsdeploymentidchatcompletions_messages.rb → chat_completions_create_request_messages_inner.rb} +30 -22
- data/lib/azure_openai_client/models/chat_completions_create_request_stop.rb +105 -0
- data/lib/azure_openai_client/models/{inline_response_200.rb → completions_create200_response.rb} +34 -26
- data/lib/azure_openai_client/models/{inline_response_200_choices.rb → completions_create200_response_choices_inner.rb} +30 -22
- data/lib/azure_openai_client/models/{inline_response_200_logprobs.rb → completions_create200_response_choices_inner_logprobs.rb} +30 -22
- data/lib/azure_openai_client/models/{inline_response_200_usage.rb → completions_create200_response_usage.rb} +28 -20
- data/lib/azure_openai_client/models/{deploymentid_completions_body.rb → completions_create_request.rb} +58 -52
- data/lib/azure_openai_client/models/completions_create_request_prompt.rb +105 -0
- data/lib/azure_openai_client/models/completions_create_request_stop.rb +105 -0
- data/lib/azure_openai_client/models/{inline_response_200_1.rb → embeddings_create200_response.rb} +30 -22
- data/lib/azure_openai_client/models/{inline_response_200_1_data.rb → embeddings_create200_response_data_inner.rb} +28 -20
- data/lib/azure_openai_client/models/{inline_response_200_1_usage.rb → embeddings_create200_response_usage.rb} +26 -18
- data/lib/azure_openai_client/models/embeddings_create_request.rb +252 -0
- data/lib/azure_openai_client/models/embeddings_create_request_input.rb +105 -0
- data/lib/azure_openai_client/models/error_response.rb +21 -13
- data/lib/azure_openai_client/models/error_response_error.rb +27 -19
- data/lib/azure_openai_client/version.rb +5 -6
- data/lib/azure_openai_client.rb +23 -23
- data/openapi-codegen.sh +12 -0
- data/openapi_config.yaml +14 -0
- data/spec/api/default_api_spec.rb +21 -22
- data/spec/api_client_spec.rb +15 -16
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/chat_completions_create200_response_choices_inner_message_spec.rb +44 -0
- data/spec/models/chat_completions_create200_response_choices_inner_spec.rb +46 -0
- data/spec/models/chat_completions_create200_response_spec.rb +64 -0
- data/spec/models/chat_completions_create200_response_usage_spec.rb +46 -0
- data/spec/models/chat_completions_create_request_messages_inner_spec.rb +50 -0
- data/spec/models/chat_completions_create_request_spec.rb +94 -0
- data/spec/models/chat_completions_create_request_stop_spec.rb +31 -0
- data/spec/models/completions_create200_response_choices_inner_logprobs_spec.rb +52 -0
- data/spec/models/completions_create200_response_choices_inner_spec.rb +52 -0
- data/spec/models/completions_create200_response_spec.rb +64 -0
- data/spec/models/completions_create200_response_usage_spec.rb +46 -0
- data/spec/models/completions_create_request_prompt_spec.rb +31 -0
- data/spec/models/completions_create_request_spec.rb +136 -0
- data/spec/models/completions_create_request_stop_spec.rb +31 -0
- data/spec/models/embeddings_create200_response_data_inner_spec.rb +46 -0
- data/spec/models/embeddings_create200_response_spec.rb +52 -0
- data/spec/models/embeddings_create200_response_usage_spec.rb +40 -0
- data/spec/models/embeddings_create_request_input_spec.rb +31 -0
- data/spec/models/embeddings_create_request_spec.rb +52 -0
- data/spec/models/error_response_error_spec.rb +12 -20
- data/spec/models/error_response_spec.rb +9 -17
- data/spec/spec_helper.rb +4 -5
- metadata +91 -77
- data/lib/azure_openai_client/models/deploymentid_embeddings_body.rb +0 -202
- data/lib/azure_openai_client/models/one_ofchat_completions_body_stop.rb +0 -198
- data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_prompt.rb +0 -198
- data/lib/azure_openai_client/models/one_ofdeploymentid_completions_body_stop.rb +0 -198
- data/spec/models/chat_completions_body_spec.rb +0 -102
- data/spec/models/deploymentid_completions_body_spec.rb +0 -144
- data/spec/models/deploymentid_embeddings_body_spec.rb +0 -36
- data/spec/models/deploymentsdeploymentidchatcompletions_messages_spec.rb +0 -58
- data/spec/models/inline_response_200_1_data_spec.rb +0 -54
- data/spec/models/inline_response_200_1_spec.rb +0 -60
- data/spec/models/inline_response_200_1_usage_spec.rb +0 -48
- data/spec/models/inline_response_200_2_choices_spec.rb +0 -54
- data/spec/models/inline_response_200_2_message_spec.rb +0 -52
- data/spec/models/inline_response_200_2_spec.rb +0 -72
- data/spec/models/inline_response_200_2_usage_spec.rb +0 -54
- data/spec/models/inline_response_200_choices_spec.rb +0 -60
- data/spec/models/inline_response_200_logprobs_spec.rb +0 -60
- data/spec/models/inline_response_200_spec.rb +0 -72
- data/spec/models/inline_response_200_usage_spec.rb +0 -54
- data/spec/models/one_ofchat_completions_body_stop_spec.rb +0 -36
- data/spec/models/one_ofdeploymentid_completions_body_prompt_spec.rb +0 -36
- data/spec/models/one_ofdeploymentid_completions_body_stop_spec.rb +0 -36
@@ -0,0 +1,52 @@
|
|
1
|
+
# AzureOpenaiClient::CompletionsCreateRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **prompt** | [**CompletionsCreateRequestPrompt**](CompletionsCreateRequestPrompt.md) | | [optional] |
|
8
|
+
| **max_tokens** | **Integer** | The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096). Has minimum of 0. | [optional][default to 16] |
|
9
|
+
| **temperature** | **Float** | What sampling temperature to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or top_p but not both. | [optional][default to 1] |
|
10
|
+
| **top_p** | **Float** | An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. | [optional][default to 1] |
|
11
|
+
| **logit_bias** | **Object** | Defaults to null. Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this tokenizer tool (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass {\"50256\" &#58; -100} to prevent the <|endoftext|> token from being generated. | [optional] |
|
12
|
+
| **user** | **String** | A unique identifier representing your end-user, which can help monitoring and detecting abuse | [optional] |
|
13
|
+
| **n** | **Integer** | How many completions to generate for each prompt. Minimum of 1 and maximum of 128 allowed. Note: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop. | [optional][default to 1] |
|
14
|
+
| **stream** | **Boolean** | Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. | [optional][default to false] |
|
15
|
+
| **logprobs** | **Integer** | Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens. For example, if logprobs is 5, the API will return a list of the 5 most likely tokens. The API will always return the logprob of the sampled token, so there may be up to logprobs+1 elements in the response. Minimum of 0 and maximum of 5 allowed. | [optional] |
|
16
|
+
| **model** | **String** | ID of the model to use. You can use the Models_List operation to see all of your available models, or see our Models_Get overview for descriptions of them. | [optional] |
|
17
|
+
| **suffix** | **String** | The suffix that comes after a completion of inserted text. | [optional] |
|
18
|
+
| **echo** | **Boolean** | Echo back the prompt in addition to the completion | [optional][default to false] |
|
19
|
+
| **stop** | [**CompletionsCreateRequestStop**](CompletionsCreateRequestStop.md) | | [optional] |
|
20
|
+
| **completion_config** | **String** | | [optional] |
|
21
|
+
| **cache_level** | **Integer** | can be used to disable any server-side caching, 0=no cache, 1=prompt prefix enabled, 2=full cache | [optional] |
|
22
|
+
| **presence_penalty** | **Float** | Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. | [optional][default to 0] |
|
23
|
+
| **frequency_penalty** | **Float** | Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. | [optional][default to 0] |
|
24
|
+
| **best_of** | **Integer** | Generates best_of completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed. When used with n, best_of controls the number of candidate completions and n specifies how many to return – best_of must be greater than n. Note: Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for max_tokens and stop. Has maximum value of 128. | [optional] |
|
25
|
+
|
26
|
+
## Example
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'azure_openai_client'
|
30
|
+
|
31
|
+
instance = AzureOpenaiClient::CompletionsCreateRequest.new(
|
32
|
+
prompt: null,
|
33
|
+
max_tokens: 16,
|
34
|
+
temperature: 1,
|
35
|
+
top_p: 1,
|
36
|
+
logit_bias: null,
|
37
|
+
user: null,
|
38
|
+
n: 1,
|
39
|
+
stream: null,
|
40
|
+
logprobs: null,
|
41
|
+
model: davinci,
|
42
|
+
suffix: null,
|
43
|
+
echo: null,
|
44
|
+
stop: null,
|
45
|
+
completion_config: null,
|
46
|
+
cache_level: null,
|
47
|
+
presence_penalty: null,
|
48
|
+
frequency_penalty: null,
|
49
|
+
best_of: null
|
50
|
+
)
|
51
|
+
```
|
52
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# AzureOpenaiClient::CompletionsCreateRequestPrompt
|
2
|
+
|
3
|
+
## Class instance methods
|
4
|
+
|
5
|
+
### `openapi_one_of`
|
6
|
+
|
7
|
+
Returns the list of classes defined in oneOf.
|
8
|
+
|
9
|
+
#### Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'azure_openai_client'
|
13
|
+
|
14
|
+
AzureOpenaiClient::CompletionsCreateRequestPrompt.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'Array<String>',
|
18
|
+
# :'String'
|
19
|
+
# ]
|
20
|
+
```
|
21
|
+
|
22
|
+
### build
|
23
|
+
|
24
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
25
|
+
|
26
|
+
#### Example
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'azure_openai_client'
|
30
|
+
|
31
|
+
AzureOpenaiClient::CompletionsCreateRequestPrompt.build(data)
|
32
|
+
# => #<Array<String>:0x00007fdd4aab02a0>
|
33
|
+
|
34
|
+
AzureOpenaiClient::CompletionsCreateRequestPrompt.build(data_that_doesnt_match)
|
35
|
+
# => nil
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Parameters
|
39
|
+
|
40
|
+
| Name | Type | Description |
|
41
|
+
| ---- | ---- | ----------- |
|
42
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
43
|
+
|
44
|
+
#### Return type
|
45
|
+
|
46
|
+
- `Array<String>`
|
47
|
+
- `String`
|
48
|
+
- `nil` (if no type matches)
|
49
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# AzureOpenaiClient::CompletionsCreateRequestStop
|
2
|
+
|
3
|
+
## Class instance methods
|
4
|
+
|
5
|
+
### `openapi_one_of`
|
6
|
+
|
7
|
+
Returns the list of classes defined in oneOf.
|
8
|
+
|
9
|
+
#### Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'azure_openai_client'
|
13
|
+
|
14
|
+
AzureOpenaiClient::CompletionsCreateRequestStop.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'Array<String>',
|
18
|
+
# :'String'
|
19
|
+
# ]
|
20
|
+
```
|
21
|
+
|
22
|
+
### build
|
23
|
+
|
24
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
25
|
+
|
26
|
+
#### Example
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'azure_openai_client'
|
30
|
+
|
31
|
+
AzureOpenaiClient::CompletionsCreateRequestStop.build(data)
|
32
|
+
# => #<Array<String>:0x00007fdd4aab02a0>
|
33
|
+
|
34
|
+
AzureOpenaiClient::CompletionsCreateRequestStop.build(data_that_doesnt_match)
|
35
|
+
# => nil
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Parameters
|
39
|
+
|
40
|
+
| Name | Type | Description |
|
41
|
+
| ---- | ---- | ----------- |
|
42
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
43
|
+
|
44
|
+
#### Return type
|
45
|
+
|
46
|
+
- `Array<String>`
|
47
|
+
- `String`
|
48
|
+
- `nil` (if no type matches)
|
49
|
+
|
data/docs/DefaultApi.md
ADDED
@@ -0,0 +1,238 @@
|
|
1
|
+
# AzureOpenaiClient::DefaultApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://your-resource-name.openai.azure.com/openai*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**chat_completions_create**](DefaultApi.md#chat_completions_create) | **POST** /deployments/{deployment-id}/chat/completions | Creates a completion for the chat message |
|
8
|
+
| [**completions_create**](DefaultApi.md#completions_create) | **POST** /deployments/{deployment-id}/completions | Creates a completion for the provided prompt, parameters and chosen model. |
|
9
|
+
| [**embeddings_create**](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. |
|
10
|
+
|
11
|
+
|
12
|
+
## chat_completions_create
|
13
|
+
|
14
|
+
> <ChatCompletionsCreate200Response> chat_completions_create(deployment_id, api_version, chat_completions_create_request)
|
15
|
+
|
16
|
+
Creates a completion for the chat message
|
17
|
+
|
18
|
+
### Examples
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'time'
|
22
|
+
require 'azure_openai_client'
|
23
|
+
# setup authorization
|
24
|
+
AzureOpenaiClient.configure do |config|
|
25
|
+
# Configure API key authorization: apiKey
|
26
|
+
config.api_key['apiKey'] = 'YOUR API KEY'
|
27
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
28
|
+
# config.api_key_prefix['apiKey'] = 'Bearer'
|
29
|
+
|
30
|
+
# Configure OAuth2 access token for authorization: bearer
|
31
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
32
|
+
end
|
33
|
+
|
34
|
+
api_instance = AzureOpenaiClient::DefaultApi.new
|
35
|
+
deployment_id = 'deployment_id_example' # String |
|
36
|
+
api_version = '2023-05-15' # String |
|
37
|
+
chat_completions_create_request = AzureOpenaiClient::ChatCompletionsCreateRequest.new({messages: [AzureOpenaiClient::ChatCompletionsCreateRequestMessagesInner.new({role: 'system', content: 'content_example'})]}) # ChatCompletionsCreateRequest |
|
38
|
+
|
39
|
+
begin
|
40
|
+
# Creates a completion for the chat message
|
41
|
+
result = api_instance.chat_completions_create(deployment_id, api_version, chat_completions_create_request)
|
42
|
+
p result
|
43
|
+
rescue AzureOpenaiClient::ApiError => e
|
44
|
+
puts "Error when calling DefaultApi->chat_completions_create: #{e}"
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
#### Using the chat_completions_create_with_http_info variant
|
49
|
+
|
50
|
+
This returns an Array which contains the response data, status code and headers.
|
51
|
+
|
52
|
+
> <Array(<ChatCompletionsCreate200Response>, Integer, Hash)> chat_completions_create_with_http_info(deployment_id, api_version, chat_completions_create_request)
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
begin
|
56
|
+
# Creates a completion for the chat message
|
57
|
+
data, status_code, headers = api_instance.chat_completions_create_with_http_info(deployment_id, api_version, chat_completions_create_request)
|
58
|
+
p status_code # => 2xx
|
59
|
+
p headers # => { ... }
|
60
|
+
p data # => <ChatCompletionsCreate200Response>
|
61
|
+
rescue AzureOpenaiClient::ApiError => e
|
62
|
+
puts "Error when calling DefaultApi->chat_completions_create_with_http_info: #{e}"
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
### Parameters
|
67
|
+
|
68
|
+
| Name | Type | Description | Notes |
|
69
|
+
| ---- | ---- | ----------- | ----- |
|
70
|
+
| **deployment_id** | **String** | | |
|
71
|
+
| **api_version** | **String** | | |
|
72
|
+
| **chat_completions_create_request** | [**ChatCompletionsCreateRequest**](ChatCompletionsCreateRequest.md) | | |
|
73
|
+
|
74
|
+
### Return type
|
75
|
+
|
76
|
+
[**ChatCompletionsCreate200Response**](ChatCompletionsCreate200Response.md)
|
77
|
+
|
78
|
+
### Authorization
|
79
|
+
|
80
|
+
[apiKey](../README.md#apiKey), [bearer](../README.md#bearer)
|
81
|
+
|
82
|
+
### HTTP request headers
|
83
|
+
|
84
|
+
- **Content-Type**: application/json
|
85
|
+
- **Accept**: application/json
|
86
|
+
|
87
|
+
|
88
|
+
## completions_create
|
89
|
+
|
90
|
+
> <CompletionsCreate200Response> completions_create(deployment_id, api_version, completions_create_request)
|
91
|
+
|
92
|
+
Creates a completion for the provided prompt, parameters and chosen model.
|
93
|
+
|
94
|
+
### Examples
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
require 'time'
|
98
|
+
require 'azure_openai_client'
|
99
|
+
# setup authorization
|
100
|
+
AzureOpenaiClient.configure do |config|
|
101
|
+
# Configure API key authorization: apiKey
|
102
|
+
config.api_key['apiKey'] = 'YOUR API KEY'
|
103
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
104
|
+
# config.api_key_prefix['apiKey'] = 'Bearer'
|
105
|
+
|
106
|
+
# Configure OAuth2 access token for authorization: bearer
|
107
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
108
|
+
end
|
109
|
+
|
110
|
+
api_instance = AzureOpenaiClient::DefaultApi.new
|
111
|
+
deployment_id = 'davinci' # String |
|
112
|
+
api_version = '2023-05-15' # String |
|
113
|
+
completions_create_request = AzureOpenaiClient::CompletionsCreateRequest.new # CompletionsCreateRequest |
|
114
|
+
|
115
|
+
begin
|
116
|
+
# Creates a completion for the provided prompt, parameters and chosen model.
|
117
|
+
result = api_instance.completions_create(deployment_id, api_version, completions_create_request)
|
118
|
+
p result
|
119
|
+
rescue AzureOpenaiClient::ApiError => e
|
120
|
+
puts "Error when calling DefaultApi->completions_create: #{e}"
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
#### Using the completions_create_with_http_info variant
|
125
|
+
|
126
|
+
This returns an Array which contains the response data, status code and headers.
|
127
|
+
|
128
|
+
> <Array(<CompletionsCreate200Response>, Integer, Hash)> completions_create_with_http_info(deployment_id, api_version, completions_create_request)
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
begin
|
132
|
+
# Creates a completion for the provided prompt, parameters and chosen model.
|
133
|
+
data, status_code, headers = api_instance.completions_create_with_http_info(deployment_id, api_version, completions_create_request)
|
134
|
+
p status_code # => 2xx
|
135
|
+
p headers # => { ... }
|
136
|
+
p data # => <CompletionsCreate200Response>
|
137
|
+
rescue AzureOpenaiClient::ApiError => e
|
138
|
+
puts "Error when calling DefaultApi->completions_create_with_http_info: #{e}"
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
142
|
+
### Parameters
|
143
|
+
|
144
|
+
| Name | Type | Description | Notes |
|
145
|
+
| ---- | ---- | ----------- | ----- |
|
146
|
+
| **deployment_id** | **String** | | |
|
147
|
+
| **api_version** | **String** | | |
|
148
|
+
| **completions_create_request** | [**CompletionsCreateRequest**](CompletionsCreateRequest.md) | | |
|
149
|
+
|
150
|
+
### Return type
|
151
|
+
|
152
|
+
[**CompletionsCreate200Response**](CompletionsCreate200Response.md)
|
153
|
+
|
154
|
+
### Authorization
|
155
|
+
|
156
|
+
[apiKey](../README.md#apiKey), [bearer](../README.md#bearer)
|
157
|
+
|
158
|
+
### HTTP request headers
|
159
|
+
|
160
|
+
- **Content-Type**: application/json
|
161
|
+
- **Accept**: application/json
|
162
|
+
|
163
|
+
|
164
|
+
## embeddings_create
|
165
|
+
|
166
|
+
> <EmbeddingsCreate200Response> embeddings_create(deployment_id, api_version, request_body)
|
167
|
+
|
168
|
+
Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
169
|
+
|
170
|
+
### Examples
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
require 'time'
|
174
|
+
require 'azure_openai_client'
|
175
|
+
# setup authorization
|
176
|
+
AzureOpenaiClient.configure do |config|
|
177
|
+
# Configure API key authorization: apiKey
|
178
|
+
config.api_key['apiKey'] = 'YOUR API KEY'
|
179
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
180
|
+
# config.api_key_prefix['apiKey'] = 'Bearer'
|
181
|
+
|
182
|
+
# Configure OAuth2 access token for authorization: bearer
|
183
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
184
|
+
end
|
185
|
+
|
186
|
+
api_instance = AzureOpenaiClient::DefaultApi.new
|
187
|
+
deployment_id = 'ada-search-index-v1' # String | The deployment id of the model which was deployed.
|
188
|
+
api_version = '2023-05-15' # String |
|
189
|
+
request_body = { key: 3.56} # Hash<String, Object> |
|
190
|
+
|
191
|
+
begin
|
192
|
+
# Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
193
|
+
result = api_instance.embeddings_create(deployment_id, api_version, request_body)
|
194
|
+
p result
|
195
|
+
rescue AzureOpenaiClient::ApiError => e
|
196
|
+
puts "Error when calling DefaultApi->embeddings_create: #{e}"
|
197
|
+
end
|
198
|
+
```
|
199
|
+
|
200
|
+
#### Using the embeddings_create_with_http_info variant
|
201
|
+
|
202
|
+
This returns an Array which contains the response data, status code and headers.
|
203
|
+
|
204
|
+
> <Array(<EmbeddingsCreate200Response>, Integer, Hash)> embeddings_create_with_http_info(deployment_id, api_version, request_body)
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
begin
|
208
|
+
# Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
209
|
+
data, status_code, headers = api_instance.embeddings_create_with_http_info(deployment_id, api_version, request_body)
|
210
|
+
p status_code # => 2xx
|
211
|
+
p headers # => { ... }
|
212
|
+
p data # => <EmbeddingsCreate200Response>
|
213
|
+
rescue AzureOpenaiClient::ApiError => e
|
214
|
+
puts "Error when calling DefaultApi->embeddings_create_with_http_info: #{e}"
|
215
|
+
end
|
216
|
+
```
|
217
|
+
|
218
|
+
### Parameters
|
219
|
+
|
220
|
+
| Name | Type | Description | Notes |
|
221
|
+
| ---- | ---- | ----------- | ----- |
|
222
|
+
| **deployment_id** | **String** | The deployment id of the model which was deployed. | |
|
223
|
+
| **api_version** | **String** | | |
|
224
|
+
| **request_body** | [**Hash<String, Object>**](Object.md) | | |
|
225
|
+
|
226
|
+
### Return type
|
227
|
+
|
228
|
+
[**EmbeddingsCreate200Response**](EmbeddingsCreate200Response.md)
|
229
|
+
|
230
|
+
### Authorization
|
231
|
+
|
232
|
+
[apiKey](../README.md#apiKey), [bearer](../README.md#bearer)
|
233
|
+
|
234
|
+
### HTTP request headers
|
235
|
+
|
236
|
+
- **Content-Type**: application/json
|
237
|
+
- **Accept**: application/json
|
238
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# AzureOpenaiClient::EmbeddingsCreate200Response
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **object** | **String** | | |
|
8
|
+
| **model** | **String** | | |
|
9
|
+
| **data** | [**Array<EmbeddingsCreate200ResponseDataInner>**](EmbeddingsCreate200ResponseDataInner.md) | | |
|
10
|
+
| **usage** | [**EmbeddingsCreate200ResponseUsage**](EmbeddingsCreate200ResponseUsage.md) | | |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'azure_openai_client'
|
16
|
+
|
17
|
+
instance = AzureOpenaiClient::EmbeddingsCreate200Response.new(
|
18
|
+
object: null,
|
19
|
+
model: null,
|
20
|
+
data: null,
|
21
|
+
usage: null
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# AzureOpenaiClient::EmbeddingsCreate200ResponseDataInner
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **index** | **Integer** | | |
|
8
|
+
| **object** | **String** | | |
|
9
|
+
| **embedding** | **Array<Float>** | | |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'azure_openai_client'
|
15
|
+
|
16
|
+
instance = AzureOpenaiClient::EmbeddingsCreate200ResponseDataInner.new(
|
17
|
+
index: null,
|
18
|
+
object: null,
|
19
|
+
embedding: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# AzureOpenaiClient::EmbeddingsCreate200ResponseUsage
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **prompt_tokens** | **Integer** | | |
|
8
|
+
| **total_tokens** | **Integer** | | |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'azure_openai_client'
|
14
|
+
|
15
|
+
instance = AzureOpenaiClient::EmbeddingsCreate200ResponseUsage.new(
|
16
|
+
prompt_tokens: null,
|
17
|
+
total_tokens: null
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# AzureOpenaiClient::EmbeddingsCreateRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **input** | [**EmbeddingsCreateRequestInput**](EmbeddingsCreateRequestInput.md) | | |
|
8
|
+
| **user** | **String** | A unique identifier representing your end-user, which can help monitoring and detecting abuse. | [optional] |
|
9
|
+
| **input_type** | **String** | input type of embedding search to use | [optional] |
|
10
|
+
| **model** | **String** | ID of the model to use. You can use the Models_List operation to see all of your available models, or see our Models_Get overview for descriptions of them. | [optional] |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'azure_openai_client'
|
16
|
+
|
17
|
+
instance = AzureOpenaiClient::EmbeddingsCreateRequest.new(
|
18
|
+
input: null,
|
19
|
+
user: null,
|
20
|
+
input_type: query,
|
21
|
+
model: null
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# AzureOpenaiClient::EmbeddingsCreateRequestInput
|
2
|
+
|
3
|
+
## Class instance methods
|
4
|
+
|
5
|
+
### `openapi_one_of`
|
6
|
+
|
7
|
+
Returns the list of classes defined in oneOf.
|
8
|
+
|
9
|
+
#### Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'azure_openai_client'
|
13
|
+
|
14
|
+
AzureOpenaiClient::EmbeddingsCreateRequestInput.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'Array<String>',
|
18
|
+
# :'String'
|
19
|
+
# ]
|
20
|
+
```
|
21
|
+
|
22
|
+
### build
|
23
|
+
|
24
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
25
|
+
|
26
|
+
#### Example
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'azure_openai_client'
|
30
|
+
|
31
|
+
AzureOpenaiClient::EmbeddingsCreateRequestInput.build(data)
|
32
|
+
# => #<Array<String>:0x00007fdd4aab02a0>
|
33
|
+
|
34
|
+
AzureOpenaiClient::EmbeddingsCreateRequestInput.build(data_that_doesnt_match)
|
35
|
+
# => nil
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Parameters
|
39
|
+
|
40
|
+
| Name | Type | Description |
|
41
|
+
| ---- | ---- | ----------- |
|
42
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
43
|
+
|
44
|
+
#### Return type
|
45
|
+
|
46
|
+
- `Array<String>`
|
47
|
+
- `String`
|
48
|
+
- `nil` (if no type matches)
|
49
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# AzureOpenaiClient::ErrorResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **error** | [**ErrorResponseError**](ErrorResponseError.md) | | [optional] |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'azure_openai_client'
|
13
|
+
|
14
|
+
instance = AzureOpenaiClient::ErrorResponse.new(
|
15
|
+
error: null
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# AzureOpenaiClient::ErrorResponseError
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **code** | **String** | | [optional] |
|
8
|
+
| **message** | **String** | | [optional] |
|
9
|
+
| **param** | **String** | | [optional] |
|
10
|
+
| **type** | **String** | | [optional] |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'azure_openai_client'
|
16
|
+
|
17
|
+
instance = AzureOpenaiClient::ErrorResponseError.new(
|
18
|
+
code: null,
|
19
|
+
message: null,
|
20
|
+
param: null,
|
21
|
+
type: null
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
data/git_push.sh
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
3
|
+
#
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
5
|
+
|
6
|
+
git_user_id=$1
|
7
|
+
git_repo_id=$2
|
8
|
+
release_note=$3
|
9
|
+
git_host=$4
|
10
|
+
|
11
|
+
if [ "$git_host" = "" ]; then
|
12
|
+
git_host="github.com"
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
14
|
+
fi
|
15
|
+
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
17
|
+
git_user_id="etsenake"
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
19
|
+
fi
|
20
|
+
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
22
|
+
git_repo_id="azure-openai-client"
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
24
|
+
fi
|
25
|
+
|
26
|
+
if [ "$release_note" = "" ]; then
|
27
|
+
release_note="Moving to openapi generator"
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
29
|
+
fi
|
30
|
+
|
31
|
+
# Initialize the local directory as a Git repository
|
32
|
+
git init
|
33
|
+
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
35
|
+
git add .
|
36
|
+
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
38
|
+
git commit -m "$release_note"
|
39
|
+
|
40
|
+
# Sets the new remote
|
41
|
+
git_remote=$(git remote)
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
43
|
+
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
47
|
+
else
|
48
|
+
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
49
|
+
fi
|
50
|
+
|
51
|
+
fi
|
52
|
+
|
53
|
+
git pull origin master
|
54
|
+
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|