openapi_openai
OpenApiOpenAIClient - the Ruby gem for the OpenAI API
APIs for sampling from and fine-tuning language models
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 2.0.0
- Package version: 1.0.0
- Generator version: 7.4.0
- Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://github.com/oapicf/openapi-openai
Installation
Build a gem
To build the Ruby code into a gem:
gem build openapi_openai.gemspec
Then either install the gem locally:
gem install ./openapi_openai-1.0.0.gem
(for development, run gem install --dev ./openapi_openai-1.0.0.gem to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'openapi_openai', '~> 1.0.0'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
gem 'openapi_openai', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
Include the Ruby code directly
Include the Ruby code directly using -I as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
# Load the gem
require 'openapi_openai'
api_instance = OpenApiOpenAIClient::OpenAIApi.new
fine_tune_id = 'ft-AF1WoRqd3aJAHsqc9NY7iL8F' # String | The ID of the fine-tune job to cancel
begin
#Immediately cancel a fine-tune job.
result = api_instance.cancel_fine_tune(fine_tune_id)
p result
rescue OpenApiOpenAIClient::ApiError => e
puts "Exception when calling OpenAIApi->cancel_fine_tune: #{e}"
end
Documentation for API Endpoints
All URIs are relative to https://api.openai.com/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| OpenApiOpenAIClient::OpenAIApi | cancel_fine_tune | POST /fine-tunes/fine_tune_id/cancel | Immediately cancel a fine-tune job. |
| OpenApiOpenAIClient::OpenAIApi | create_chat_completion | POST /chat/completions | Creates a model response for the given chat conversation. |
| OpenApiOpenAIClient::OpenAIApi | create_completion | POST /completions | Creates a completion for the provided prompt and parameters. |
| OpenApiOpenAIClient::OpenAIApi | create_edit | POST /edits | Creates a new edit for the provided input, instruction, and parameters. |
| OpenApiOpenAIClient::OpenAIApi | create_embedding | POST /embeddings | Creates an embedding vector representing the input text. |
| OpenApiOpenAIClient::OpenAIApi | create_file | POST /files | Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit. |
| OpenApiOpenAIClient::OpenAIApi | create_fine_tune | POST /fine-tunes | Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. Learn more about Fine-tuning |
| OpenApiOpenAIClient::OpenAIApi | create_image | POST /images/generations | Creates an image given a prompt. |
| OpenApiOpenAIClient::OpenAIApi | create_image_edit | POST /images/edits | Creates an edited or extended image given an original image and a prompt. |
| OpenApiOpenAIClient::OpenAIApi | create_image_variation | POST /images/variations | Creates a variation of a given image. |
| OpenApiOpenAIClient::OpenAIApi | create_moderation | POST /moderations | Classifies if text violates OpenAI's Content Policy |
| OpenApiOpenAIClient::OpenAIApi | create_transcription | POST /audio/transcriptions | Transcribes audio into the input language. |
| OpenApiOpenAIClient::OpenAIApi | create_translation | POST /audio/translations | Translates audio into English. |
| OpenApiOpenAIClient::OpenAIApi | delete_file | DELETE /files/file_id | Delete a file. |
| OpenApiOpenAIClient::OpenAIApi | delete_model | DELETE /models/model | Delete a fine-tuned model. You must have the Owner role in your organization. |
| OpenApiOpenAIClient::OpenAIApi | download_file | GET /files/file_id/content | Returns the contents of the specified file |
| OpenApiOpenAIClient::OpenAIApi | list_files | GET /files | Returns a list of files that belong to the user's organization. |
| OpenApiOpenAIClient::OpenAIApi | list_fine_tune_events | GET /fine-tunes/fine_tune_id/events | Get fine-grained status updates for a fine-tune job. |
| OpenApiOpenAIClient::OpenAIApi | list_fine_tunes | GET /fine-tunes | List your organization's fine-tuning jobs |
| OpenApiOpenAIClient::OpenAIApi | list_models | GET /models | Lists the currently available models, and provides basic information about each one such as the owner and availability. |
| OpenApiOpenAIClient::OpenAIApi | retrieve_file | GET /files/file_id | Returns information about a specific file. |
| OpenApiOpenAIClient::OpenAIApi | retrieve_fine_tune | GET /fine-tunes/fine_tune_id | Gets info about the fine-tune job. Learn more about Fine-tuning |
| OpenApiOpenAIClient::OpenAIApi | retrieve_model | GET /models/model | Retrieves a model instance, providing basic information about the model such as the owner and permissioning. |
Documentation for Models
- OpenApiOpenAIClient::ChatCompletionFunctions
- OpenApiOpenAIClient::ChatCompletionRequestMessage
- OpenApiOpenAIClient::ChatCompletionRequestMessageFunctionCall
- OpenApiOpenAIClient::ChatCompletionResponseMessage
- OpenApiOpenAIClient::ChatCompletionStreamResponseDelta
- OpenApiOpenAIClient::CreateChatCompletionRequest
- OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCall
- OpenApiOpenAIClient::CreateChatCompletionRequestFunctionCallOneOf
- OpenApiOpenAIClient::CreateChatCompletionRequestModel
- OpenApiOpenAIClient::CreateChatCompletionRequestStop
- OpenApiOpenAIClient::CreateChatCompletionResponse
- OpenApiOpenAIClient::CreateChatCompletionResponseChoicesInner
- OpenApiOpenAIClient::CreateChatCompletionStreamResponse
- OpenApiOpenAIClient::CreateChatCompletionStreamResponseChoicesInner
- OpenApiOpenAIClient::CreateCompletionRequest
- OpenApiOpenAIClient::CreateCompletionRequestModel
- OpenApiOpenAIClient::CreateCompletionRequestPrompt
- OpenApiOpenAIClient::CreateCompletionRequestStop
- OpenApiOpenAIClient::CreateCompletionResponse
- OpenApiOpenAIClient::CreateCompletionResponseChoicesInner
- OpenApiOpenAIClient::CreateCompletionResponseChoicesInnerLogprobs
- OpenApiOpenAIClient::CreateCompletionResponseUsage
- OpenApiOpenAIClient::CreateEditRequest
- OpenApiOpenAIClient::CreateEditRequestModel
- OpenApiOpenAIClient::CreateEditResponse
- OpenApiOpenAIClient::CreateEditResponseChoicesInner
- OpenApiOpenAIClient::CreateEmbeddingRequest
- OpenApiOpenAIClient::CreateEmbeddingRequestInput
- OpenApiOpenAIClient::CreateEmbeddingRequestModel
- OpenApiOpenAIClient::CreateEmbeddingResponse
- OpenApiOpenAIClient::CreateEmbeddingResponseDataInner
- OpenApiOpenAIClient::CreateEmbeddingResponseUsage
- OpenApiOpenAIClient::CreateFineTuneRequest
- OpenApiOpenAIClient::CreateFineTuneRequestModel
- OpenApiOpenAIClient::CreateImageRequest
- OpenApiOpenAIClient::CreateModerationRequest
- OpenApiOpenAIClient::CreateModerationRequestInput
- OpenApiOpenAIClient::CreateModerationRequestModel
- OpenApiOpenAIClient::CreateModerationResponse
- OpenApiOpenAIClient::CreateModerationResponseResultsInner
- OpenApiOpenAIClient::CreateModerationResponseResultsInnerCategories
- OpenApiOpenAIClient::CreateModerationResponseResultsInnerCategoryScores
- OpenApiOpenAIClient::CreateTranscriptionRequestModel
- OpenApiOpenAIClient::CreateTranscriptionResponse
- OpenApiOpenAIClient::CreateTranslationResponse
- OpenApiOpenAIClient::DeleteFileResponse
- OpenApiOpenAIClient::DeleteModelResponse
- OpenApiOpenAIClient::Error
- OpenApiOpenAIClient::ErrorResponse
- OpenApiOpenAIClient::FineTune
- OpenApiOpenAIClient::FineTuneEvent
- OpenApiOpenAIClient::ImagesResponse
- OpenApiOpenAIClient::ImagesResponseDataInner
- OpenApiOpenAIClient::ListFilesResponse
- OpenApiOpenAIClient::ListFineTuneEventsResponse
- OpenApiOpenAIClient::ListFineTunesResponse
- OpenApiOpenAIClient::ListModelsResponse
- OpenApiOpenAIClient::Model
- OpenApiOpenAIClient::OpenAIFile
Documentation for Authorization
Endpoints do not require authorization.