openapi_openai 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +72 -0
- data/README.md +171 -0
- data/Rakefile +10 -0
- data/bin/bundle +109 -0
- data/bin/byebug +27 -0
- data/bin/coderay +27 -0
- data/bin/htmldiff +27 -0
- data/bin/ldiff +27 -0
- data/bin/pry +27 -0
- data/bin/racc +27 -0
- data/bin/rake +27 -0
- data/bin/rspec +27 -0
- data/bin/rubocop +27 -0
- data/bin/ruby-parse +27 -0
- data/bin/ruby-rewrite +27 -0
- data/docs/ChatCompletionFunctions.md +22 -0
- data/docs/ChatCompletionRequestMessage.md +24 -0
- data/docs/ChatCompletionRequestMessageFunctionCall.md +20 -0
- data/docs/ChatCompletionResponseMessage.md +22 -0
- data/docs/ChatCompletionStreamResponseDelta.md +22 -0
- data/docs/CreateChatCompletionRequest.md +44 -0
- data/docs/CreateChatCompletionRequestFunctionCall.md +49 -0
- data/docs/CreateChatCompletionRequestFunctionCallOneOf.md +18 -0
- data/docs/CreateChatCompletionRequestModel.md +47 -0
- data/docs/CreateChatCompletionRequestStop.md +49 -0
- data/docs/CreateChatCompletionResponse.md +28 -0
- data/docs/CreateChatCompletionResponseChoicesInner.md +22 -0
- data/docs/CreateChatCompletionStreamResponse.md +26 -0
- data/docs/CreateChatCompletionStreamResponseChoicesInner.md +22 -0
- data/docs/CreateCompletionRequest.md +48 -0
- data/docs/CreateCompletionRequestModel.md +47 -0
- data/docs/CreateCompletionRequestPrompt.md +53 -0
- data/docs/CreateCompletionRequestStop.md +49 -0
- data/docs/CreateCompletionResponse.md +28 -0
- data/docs/CreateCompletionResponseChoicesInner.md +24 -0
- data/docs/CreateCompletionResponseChoicesInnerLogprobs.md +24 -0
- data/docs/CreateCompletionResponseUsage.md +22 -0
- data/docs/CreateEditRequest.md +28 -0
- data/docs/CreateEditRequestModel.md +47 -0
- data/docs/CreateEditResponse.md +24 -0
- data/docs/CreateEditResponseChoicesInner.md +24 -0
- data/docs/CreateEmbeddingRequest.md +22 -0
- data/docs/CreateEmbeddingRequestInput.md +53 -0
- data/docs/CreateEmbeddingRequestModel.md +47 -0
- data/docs/CreateEmbeddingResponse.md +24 -0
- data/docs/CreateEmbeddingResponseDataInner.md +22 -0
- data/docs/CreateEmbeddingResponseUsage.md +20 -0
- data/docs/CreateFineTuneRequest.md +40 -0
- data/docs/CreateFineTuneRequestModel.md +47 -0
- data/docs/CreateImageRequest.md +26 -0
- data/docs/CreateModerationRequest.md +20 -0
- data/docs/CreateModerationRequestInput.md +49 -0
- data/docs/CreateModerationRequestModel.md +47 -0
- data/docs/CreateModerationResponse.md +22 -0
- data/docs/CreateModerationResponseResultsInner.md +22 -0
- data/docs/CreateModerationResponseResultsInnerCategories.md +30 -0
- data/docs/CreateModerationResponseResultsInnerCategoryScores.md +30 -0
- data/docs/CreateTranscriptionRequestModel.md +47 -0
- data/docs/CreateTranscriptionResponse.md +18 -0
- data/docs/CreateTranslationResponse.md +18 -0
- data/docs/DeleteFileResponse.md +22 -0
- data/docs/DeleteModelResponse.md +22 -0
- data/docs/Error.md +24 -0
- data/docs/ErrorResponse.md +18 -0
- data/docs/FineTune.md +42 -0
- data/docs/FineTuneEvent.md +24 -0
- data/docs/ImagesResponse.md +20 -0
- data/docs/ImagesResponseDataInner.md +20 -0
- data/docs/ListFilesResponse.md +20 -0
- data/docs/ListFineTuneEventsResponse.md +20 -0
- data/docs/ListFineTunesResponse.md +20 -0
- data/docs/ListModelsResponse.md +20 -0
- data/docs/Model.md +24 -0
- data/docs/OpenAIApi.md +1499 -0
- data/docs/OpenAIFile.md +32 -0
- data/git_push.sh +57 -0
- data/lib/openapi_openai/api/open_ai_api.rb +1583 -0
- data/lib/openapi_openai/api_client.rb +393 -0
- data/lib/openapi_openai/api_error.rb +58 -0
- data/lib/openapi_openai/configuration.rb +291 -0
- data/lib/openapi_openai/models/chat_completion_functions.rb +244 -0
- data/lib/openapi_openai/models/chat_completion_request_message.rb +285 -0
- data/lib/openapi_openai/models/chat_completion_request_message_function_call.rb +226 -0
- data/lib/openapi_openai/models/chat_completion_response_message.rb +276 -0
- data/lib/openapi_openai/models/chat_completion_stream_response_delta.rb +269 -0
- data/lib/openapi_openai/models/create_chat_completion_request.rb +537 -0
- data/lib/openapi_openai/models/create_chat_completion_request_function_call.rb +106 -0
- data/lib/openapi_openai/models/create_chat_completion_request_function_call_one_of.rb +222 -0
- data/lib/openapi_openai/models/create_chat_completion_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_chat_completion_request_stop.rb +106 -0
- data/lib/openapi_openai/models/create_chat_completion_response.rb +296 -0
- data/lib/openapi_openai/models/create_chat_completion_response_choices_inner.rb +266 -0
- data/lib/openapi_openai/models/create_chat_completion_stream_response.rb +287 -0
- data/lib/openapi_openai/models/create_chat_completion_stream_response_choices_inner.rb +266 -0
- data/lib/openapi_openai/models/create_completion_request.rb +586 -0
- data/lib/openapi_openai/models/create_completion_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_completion_request_prompt.rb +108 -0
- data/lib/openapi_openai/models/create_completion_request_stop.rb +106 -0
- data/lib/openapi_openai/models/create_completion_response.rb +296 -0
- data/lib/openapi_openai/models/create_completion_response_choices_inner.rb +299 -0
- data/lib/openapi_openai/models/create_completion_response_choices_inner_logprobs.rb +249 -0
- data/lib/openapi_openai/models/create_completion_response_usage.rb +253 -0
- data/lib/openapi_openai/models/create_edit_request.rb +362 -0
- data/lib/openapi_openai/models/create_edit_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_edit_response.rb +271 -0
- data/lib/openapi_openai/models/create_edit_response_choices_inner.rb +276 -0
- data/lib/openapi_openai/models/create_embedding_request.rb +247 -0
- data/lib/openapi_openai/models/create_embedding_request_input.rb +108 -0
- data/lib/openapi_openai/models/create_embedding_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_embedding_response.rb +271 -0
- data/lib/openapi_openai/models/create_embedding_response_data_inner.rb +255 -0
- data/lib/openapi_openai/models/create_embedding_response_usage.rb +237 -0
- data/lib/openapi_openai/models/create_fine_tune_request.rb +374 -0
- data/lib/openapi_openai/models/create_fine_tune_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_image_request.rb +341 -0
- data/lib/openapi_openai/models/create_moderation_request.rb +230 -0
- data/lib/openapi_openai/models/create_moderation_request_input.rb +106 -0
- data/lib/openapi_openai/models/create_moderation_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_moderation_response.rb +255 -0
- data/lib/openapi_openai/models/create_moderation_response_results_inner.rb +253 -0
- data/lib/openapi_openai/models/create_moderation_response_results_inner_categories.rb +317 -0
- data/lib/openapi_openai/models/create_moderation_response_results_inner_category_scores.rb +317 -0
- data/lib/openapi_openai/models/create_transcription_request_model.rb +105 -0
- data/lib/openapi_openai/models/create_transcription_response.rb +221 -0
- data/lib/openapi_openai/models/create_translation_response.rb +221 -0
- data/lib/openapi_openai/models/delete_file_response.rb +253 -0
- data/lib/openapi_openai/models/delete_model_response.rb +253 -0
- data/lib/openapi_openai/models/error.rb +261 -0
- data/lib/openapi_openai/models/error_response.rb +221 -0
- data/lib/openapi_openai/models/fine_tune.rb +410 -0
- data/lib/openapi_openai/models/fine_tune_event.rb +269 -0
- data/lib/openapi_openai/models/images_response.rb +239 -0
- data/lib/openapi_openai/models/images_response_data_inner.rb +223 -0
- data/lib/openapi_openai/models/list_files_response.rb +239 -0
- data/lib/openapi_openai/models/list_fine_tune_events_response.rb +239 -0
- data/lib/openapi_openai/models/list_fine_tunes_response.rb +239 -0
- data/lib/openapi_openai/models/list_models_response.rb +239 -0
- data/lib/openapi_openai/models/model.rb +269 -0
- data/lib/openapi_openai/models/open_ai_file.rb +320 -0
- data/lib/openapi_openai/version.rb +15 -0
- data/lib/openapi_openai.rb +99 -0
- data/openapi_openai.gemspec +39 -0
- data/spec/api/open_ai_api_spec.rb +306 -0
- data/spec/models/chat_completion_functions_spec.rb +48 -0
- data/spec/models/chat_completion_request_message_function_call_spec.rb +42 -0
- data/spec/models/chat_completion_request_message_spec.rb +58 -0
- data/spec/models/chat_completion_response_message_spec.rb +52 -0
- data/spec/models/chat_completion_stream_response_delta_spec.rb +52 -0
- data/spec/models/create_chat_completion_request_function_call_one_of_spec.rb +36 -0
- data/spec/models/create_chat_completion_request_function_call_spec.rb +32 -0
- data/spec/models/create_chat_completion_request_model_spec.rb +32 -0
- data/spec/models/create_chat_completion_request_spec.rb +114 -0
- data/spec/models/create_chat_completion_request_stop_spec.rb +32 -0
- data/spec/models/create_chat_completion_response_choices_inner_spec.rb +52 -0
- data/spec/models/create_chat_completion_response_spec.rb +66 -0
- data/spec/models/create_chat_completion_stream_response_choices_inner_spec.rb +52 -0
- data/spec/models/create_chat_completion_stream_response_spec.rb +60 -0
- data/spec/models/create_completion_request_model_spec.rb +32 -0
- data/spec/models/create_completion_request_prompt_spec.rb +32 -0
- data/spec/models/create_completion_request_spec.rb +126 -0
- data/spec/models/create_completion_request_stop_spec.rb +32 -0
- data/spec/models/create_completion_response_choices_inner_logprobs_spec.rb +54 -0
- data/spec/models/create_completion_response_choices_inner_spec.rb +58 -0
- data/spec/models/create_completion_response_spec.rb +66 -0
- data/spec/models/create_completion_response_usage_spec.rb +48 -0
- data/spec/models/create_edit_request_model_spec.rb +32 -0
- data/spec/models/create_edit_request_spec.rb +66 -0
- data/spec/models/create_edit_response_choices_inner_spec.rb +58 -0
- data/spec/models/create_edit_response_spec.rb +54 -0
- data/spec/models/create_embedding_request_input_spec.rb +32 -0
- data/spec/models/create_embedding_request_model_spec.rb +32 -0
- data/spec/models/create_embedding_request_spec.rb +48 -0
- data/spec/models/create_embedding_response_data_inner_spec.rb +48 -0
- data/spec/models/create_embedding_response_spec.rb +54 -0
- data/spec/models/create_embedding_response_usage_spec.rb +42 -0
- data/spec/models/create_fine_tune_request_model_spec.rb +32 -0
- data/spec/models/create_fine_tune_request_spec.rb +102 -0
- data/spec/models/create_image_request_spec.rb +68 -0
- data/spec/models/create_moderation_request_input_spec.rb +32 -0
- data/spec/models/create_moderation_request_model_spec.rb +32 -0
- data/spec/models/create_moderation_request_spec.rb +42 -0
- data/spec/models/create_moderation_response_results_inner_categories_spec.rb +72 -0
- data/spec/models/create_moderation_response_results_inner_category_scores_spec.rb +72 -0
- data/spec/models/create_moderation_response_results_inner_spec.rb +48 -0
- data/spec/models/create_moderation_response_spec.rb +48 -0
- data/spec/models/create_transcription_request_model_spec.rb +32 -0
- data/spec/models/create_transcription_response_spec.rb +36 -0
- data/spec/models/create_translation_response_spec.rb +36 -0
- data/spec/models/delete_file_response_spec.rb +48 -0
- data/spec/models/delete_model_response_spec.rb +48 -0
- data/spec/models/error_response_spec.rb +36 -0
- data/spec/models/error_spec.rb +54 -0
- data/spec/models/fine_tune_event_spec.rb +54 -0
- data/spec/models/fine_tune_spec.rb +108 -0
- data/spec/models/images_response_data_inner_spec.rb +42 -0
- data/spec/models/images_response_spec.rb +42 -0
- data/spec/models/list_files_response_spec.rb +42 -0
- data/spec/models/list_fine_tune_events_response_spec.rb +42 -0
- data/spec/models/list_fine_tunes_response_spec.rb +42 -0
- data/spec/models/list_models_response_spec.rb +42 -0
- data/spec/models/model_spec.rb +54 -0
- data/spec/models/open_ai_file_spec.rb +78 -0
- data/spec/spec_helper.rb +111 -0
- metadata +348 -0
data/bin/ruby-rewrite
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby2.7
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'ruby-rewrite' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("parser", "ruby-rewrite")
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# OpenApiOpenAIClient::ChatCompletionFunctions
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **name** | **String** | The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. | |
|
8
|
+
| **description** | **String** | The description of what the function does. | [optional] |
|
9
|
+
| **parameters** | **Hash<String, Object>** | The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'openapi_openai'
|
15
|
+
|
16
|
+
instance = OpenApiOpenAIClient::ChatCompletionFunctions.new(
|
17
|
+
name: null,
|
18
|
+
description: null,
|
19
|
+
parameters: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# OpenApiOpenAIClient::ChatCompletionRequestMessage
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **role** | **String** | The role of the messages author. One of `system`, `user`, `assistant`, or `function`. | |
|
8
|
+
| **content** | **String** | The contents of the message. `content` is required for all messages except assistant messages with function calls. | [optional] |
|
9
|
+
| **name** | **String** | The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters. | [optional] |
|
10
|
+
| **function_call** | [**ChatCompletionRequestMessageFunctionCall**](ChatCompletionRequestMessageFunctionCall.md) | | [optional] |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'openapi_openai'
|
16
|
+
|
17
|
+
instance = OpenApiOpenAIClient::ChatCompletionRequestMessage.new(
|
18
|
+
role: null,
|
19
|
+
content: null,
|
20
|
+
name: null,
|
21
|
+
function_call: null
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# OpenApiOpenAIClient::ChatCompletionRequestMessageFunctionCall
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **name** | **String** | The name of the function to call. | [optional] |
|
8
|
+
| **arguments** | **String** | The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. | [optional] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'openapi_openai'
|
14
|
+
|
15
|
+
instance = OpenApiOpenAIClient::ChatCompletionRequestMessageFunctionCall.new(
|
16
|
+
name: null,
|
17
|
+
arguments: null
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# OpenApiOpenAIClient::ChatCompletionResponseMessage
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **role** | **String** | The role of the author of this message. | |
|
8
|
+
| **content** | **String** | The contents of the message. | [optional] |
|
9
|
+
| **function_call** | [**ChatCompletionRequestMessageFunctionCall**](ChatCompletionRequestMessageFunctionCall.md) | | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'openapi_openai'
|
15
|
+
|
16
|
+
instance = OpenApiOpenAIClient::ChatCompletionResponseMessage.new(
|
17
|
+
role: null,
|
18
|
+
content: null,
|
19
|
+
function_call: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# OpenApiOpenAIClient::ChatCompletionStreamResponseDelta
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **role** | **String** | The role of the author of this message. | [optional] |
|
8
|
+
| **content** | **String** | The contents of the chunk message. | [optional] |
|
9
|
+
| **function_call** | [**ChatCompletionRequestMessageFunctionCall**](ChatCompletionRequestMessageFunctionCall.md) | | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'openapi_openai'
|
15
|
+
|
16
|
+
instance = OpenApiOpenAIClient::ChatCompletionStreamResponseDelta.new(
|
17
|
+
role: null,
|
18
|
+
content: null,
|
19
|
+
function_call: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **model** | [**CreateChatCompletionRequestModel**](CreateChatCompletionRequestModel.md) | | |
|
8
|
+
| **messages** | [**Array<ChatCompletionRequestMessage>**](ChatCompletionRequestMessage.md) | A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb). | |
|
9
|
+
| **functions** | [**Array<ChatCompletionFunctions>**](ChatCompletionFunctions.md) | A list of functions the model may generate JSON inputs for. | [optional] |
|
10
|
+
| **function_call** | [**CreateChatCompletionRequestFunctionCall**](CreateChatCompletionRequestFunctionCall.md) | | [optional] |
|
11
|
+
| **temperature** | **Float** | What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. | [optional][default to 1] |
|
12
|
+
| **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] |
|
13
|
+
| **n** | **Integer** | How many chat completion choices to generate for each input message. | [optional][default to 1] |
|
14
|
+
| **stream** | **Boolean** | If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). | [optional][default to false] |
|
15
|
+
| **stop** | [**CreateChatCompletionRequestStop**](CreateChatCompletionRequestStop.md) | | [optional] |
|
16
|
+
| **max_tokens** | **Integer** | The maximum number of [tokens](/tokenizer) to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. | [optional] |
|
17
|
+
| **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. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) | [optional][default to 0] |
|
18
|
+
| **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. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) | [optional][default to 0] |
|
19
|
+
| **logit_bias** | **Object** | Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. 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. | [optional] |
|
20
|
+
| **user** | **String** | A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). | [optional] |
|
21
|
+
|
22
|
+
## Example
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require 'openapi_openai'
|
26
|
+
|
27
|
+
instance = OpenApiOpenAIClient::CreateChatCompletionRequest.new(
|
28
|
+
model: null,
|
29
|
+
messages: null,
|
30
|
+
functions: null,
|
31
|
+
function_call: null,
|
32
|
+
temperature: 1,
|
33
|
+
top_p: 1,
|
34
|
+
n: 1,
|
35
|
+
stream: null,
|
36
|
+
stop: null,
|
37
|
+
max_tokens: null,
|
38
|
+
presence_penalty: null,
|
39
|
+
frequency_penalty: null,
|
40
|
+
logit_bias: null,
|
41
|
+
user: user-1234
|
42
|
+
)
|
43
|
+
```
|
44
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCall
|
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 'openapi_openai'
|
13
|
+
|
14
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCall.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'CreateChatCompletionRequestFunctionCallOneOf',
|
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 'openapi_openai'
|
30
|
+
|
31
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCall.build(data)
|
32
|
+
# => #<CreateChatCompletionRequestFunctionCallOneOf:0x00007fdd4aab02a0>
|
33
|
+
|
34
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCall.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
|
+
- `CreateChatCompletionRequestFunctionCallOneOf`
|
47
|
+
- `String`
|
48
|
+
- `nil` (if no type matches)
|
49
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCallOneOf
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **name** | **String** | The name of the function to call. | |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'openapi_openai'
|
13
|
+
|
14
|
+
instance = OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCallOneOf.new(
|
15
|
+
name: null
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionRequestModel
|
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 'openapi_openai'
|
13
|
+
|
14
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestModel.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'String'
|
18
|
+
# ]
|
19
|
+
```
|
20
|
+
|
21
|
+
### build
|
22
|
+
|
23
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
24
|
+
|
25
|
+
#### Example
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'openapi_openai'
|
29
|
+
|
30
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestModel.build(data)
|
31
|
+
# => #<String:0x00007fdd4aab02a0>
|
32
|
+
|
33
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestModel.build(data_that_doesnt_match)
|
34
|
+
# => nil
|
35
|
+
```
|
36
|
+
|
37
|
+
#### Parameters
|
38
|
+
|
39
|
+
| Name | Type | Description |
|
40
|
+
| ---- | ---- | ----------- |
|
41
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
42
|
+
|
43
|
+
#### Return type
|
44
|
+
|
45
|
+
- `String`
|
46
|
+
- `nil` (if no type matches)
|
47
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionRequestStop
|
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 'openapi_openai'
|
13
|
+
|
14
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestStop.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 'openapi_openai'
|
30
|
+
|
31
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestStop.build(data)
|
32
|
+
# => #<Array<String>:0x00007fdd4aab02a0>
|
33
|
+
|
34
|
+
OpenApiOpenAIClient::CreateChatCompletionRequestStop.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,28 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **id** | **String** | | |
|
8
|
+
| **object** | **String** | | |
|
9
|
+
| **created** | **Integer** | | |
|
10
|
+
| **model** | **String** | | |
|
11
|
+
| **choices** | [**Array<CreateChatCompletionResponseChoicesInner>**](CreateChatCompletionResponseChoicesInner.md) | | |
|
12
|
+
| **usage** | [**CreateCompletionResponseUsage**](CreateCompletionResponseUsage.md) | | [optional] |
|
13
|
+
|
14
|
+
## Example
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'openapi_openai'
|
18
|
+
|
19
|
+
instance = OpenApiOpenAIClient::CreateChatCompletionResponse.new(
|
20
|
+
id: null,
|
21
|
+
object: null,
|
22
|
+
created: null,
|
23
|
+
model: null,
|
24
|
+
choices: null,
|
25
|
+
usage: null
|
26
|
+
)
|
27
|
+
```
|
28
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionResponseChoicesInner
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **index** | **Integer** | | [optional] |
|
8
|
+
| **message** | [**ChatCompletionResponseMessage**](ChatCompletionResponseMessage.md) | | [optional] |
|
9
|
+
| **finish_reason** | **String** | | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'openapi_openai'
|
15
|
+
|
16
|
+
instance = OpenApiOpenAIClient::CreateChatCompletionResponseChoicesInner.new(
|
17
|
+
index: null,
|
18
|
+
message: null,
|
19
|
+
finish_reason: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionStreamResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **id** | **String** | | |
|
8
|
+
| **object** | **String** | | |
|
9
|
+
| **created** | **Integer** | | |
|
10
|
+
| **model** | **String** | | |
|
11
|
+
| **choices** | [**Array<CreateChatCompletionStreamResponseChoicesInner>**](CreateChatCompletionStreamResponseChoicesInner.md) | | |
|
12
|
+
|
13
|
+
## Example
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'openapi_openai'
|
17
|
+
|
18
|
+
instance = OpenApiOpenAIClient::CreateChatCompletionStreamResponse.new(
|
19
|
+
id: null,
|
20
|
+
object: null,
|
21
|
+
created: null,
|
22
|
+
model: null,
|
23
|
+
choices: null
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateChatCompletionStreamResponseChoicesInner
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **index** | **Integer** | | [optional] |
|
8
|
+
| **delta** | [**ChatCompletionStreamResponseDelta**](ChatCompletionStreamResponseDelta.md) | | [optional] |
|
9
|
+
| **finish_reason** | **String** | | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'openapi_openai'
|
15
|
+
|
16
|
+
instance = OpenApiOpenAIClient::CreateChatCompletionStreamResponseChoicesInner.new(
|
17
|
+
index: null,
|
18
|
+
delta: null,
|
19
|
+
finish_reason: null
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateCompletionRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **model** | [**CreateCompletionRequestModel**](CreateCompletionRequestModel.md) | | |
|
8
|
+
| **prompt** | [**CreateCompletionRequestPrompt**](CreateCompletionRequestPrompt.md) | | |
|
9
|
+
| **suffix** | **String** | The suffix that comes after a completion of inserted text. | [optional] |
|
10
|
+
| **max_tokens** | **Integer** | The maximum number of [tokens](/tokenizer) to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. | [optional][default to 16] |
|
11
|
+
| **temperature** | **Float** | What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both. | [optional][default to 1] |
|
12
|
+
| **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] |
|
13
|
+
| **n** | **Integer** | How many completions to generate for each prompt. **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](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). | [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. The maximum value for `logprobs` is 5. | [optional] |
|
16
|
+
| **echo** | **Boolean** | Echo back the prompt in addition to the completion | [optional][default to false] |
|
17
|
+
| **stop** | [**CreateCompletionRequestStop**](CreateCompletionRequestStop.md) | | [optional] |
|
18
|
+
| **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. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) | [optional][default to 0] |
|
19
|
+
| **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. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) | [optional][default to 0] |
|
20
|
+
| **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`. | [optional][default to 1] |
|
21
|
+
| **logit_bias** | **Object** | 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](/tokenizer?view=bpe) (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\": -100}` to prevent the <|endoftext|> token from being generated. | [optional] |
|
22
|
+
| **user** | **String** | A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). | [optional] |
|
23
|
+
|
24
|
+
## Example
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'openapi_openai'
|
28
|
+
|
29
|
+
instance = OpenApiOpenAIClient::CreateCompletionRequest.new(
|
30
|
+
model: null,
|
31
|
+
prompt: null,
|
32
|
+
suffix: test.,
|
33
|
+
max_tokens: 16,
|
34
|
+
temperature: 1,
|
35
|
+
top_p: 1,
|
36
|
+
n: 1,
|
37
|
+
stream: null,
|
38
|
+
logprobs: null,
|
39
|
+
echo: null,
|
40
|
+
stop: null,
|
41
|
+
presence_penalty: null,
|
42
|
+
frequency_penalty: null,
|
43
|
+
best_of: null,
|
44
|
+
logit_bias: null,
|
45
|
+
user: user-1234
|
46
|
+
)
|
47
|
+
```
|
48
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateCompletionRequestModel
|
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 'openapi_openai'
|
13
|
+
|
14
|
+
OpenApiOpenAIClient::CreateCompletionRequestModel.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'String'
|
18
|
+
# ]
|
19
|
+
```
|
20
|
+
|
21
|
+
### build
|
22
|
+
|
23
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
24
|
+
|
25
|
+
#### Example
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'openapi_openai'
|
29
|
+
|
30
|
+
OpenApiOpenAIClient::CreateCompletionRequestModel.build(data)
|
31
|
+
# => #<String:0x00007fdd4aab02a0>
|
32
|
+
|
33
|
+
OpenApiOpenAIClient::CreateCompletionRequestModel.build(data_that_doesnt_match)
|
34
|
+
# => nil
|
35
|
+
```
|
36
|
+
|
37
|
+
#### Parameters
|
38
|
+
|
39
|
+
| Name | Type | Description |
|
40
|
+
| ---- | ---- | ----------- |
|
41
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
42
|
+
|
43
|
+
#### Return type
|
44
|
+
|
45
|
+
- `String`
|
46
|
+
- `nil` (if no type matches)
|
47
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateCompletionRequestPrompt
|
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 'openapi_openai'
|
13
|
+
|
14
|
+
OpenApiOpenAIClient::CreateCompletionRequestPrompt.openapi_one_of
|
15
|
+
# =>
|
16
|
+
# [
|
17
|
+
# :'Array<Array<Integer>>',
|
18
|
+
# :'Array<Integer>',
|
19
|
+
# :'Array<String>',
|
20
|
+
# :'String'
|
21
|
+
# ]
|
22
|
+
```
|
23
|
+
|
24
|
+
### build
|
25
|
+
|
26
|
+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
27
|
+
|
28
|
+
#### Example
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'openapi_openai'
|
32
|
+
|
33
|
+
OpenApiOpenAIClient::CreateCompletionRequestPrompt.build(data)
|
34
|
+
# => #<Array<Array<Integer>>:0x00007fdd4aab02a0>
|
35
|
+
|
36
|
+
OpenApiOpenAIClient::CreateCompletionRequestPrompt.build(data_that_doesnt_match)
|
37
|
+
# => nil
|
38
|
+
```
|
39
|
+
|
40
|
+
#### Parameters
|
41
|
+
|
42
|
+
| Name | Type | Description |
|
43
|
+
| ---- | ---- | ----------- |
|
44
|
+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
|
45
|
+
|
46
|
+
#### Return type
|
47
|
+
|
48
|
+
- `Array<Array<Integer>>`
|
49
|
+
- `Array<Integer>`
|
50
|
+
- `Array<String>`
|
51
|
+
- `String`
|
52
|
+
- `nil` (if no type matches)
|
53
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# OpenApiOpenAIClient::CreateCompletionRequestStop
|
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 'openapi_openai'
|
13
|
+
|
14
|
+
OpenApiOpenAIClient::CreateCompletionRequestStop.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 'openapi_openai'
|
30
|
+
|
31
|
+
OpenApiOpenAIClient::CreateCompletionRequestStop.build(data)
|
32
|
+
# => #<Array<String>:0x00007fdd4aab02a0>
|
33
|
+
|
34
|
+
OpenApiOpenAIClient::CreateCompletionRequestStop.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
|
+
|