class OpenAI::Client
- OpenAI::Client
- Reference
- Object
Overview
OpenAI client
Defined in:
openai/client.cropenai/config.cr
Constructors
- .new(api_key : String | Nil = nil, proxy : ProxyConfig | Nil = nil)
- .new(config : OpenAI::Client::Config)
Class Method Summary
Instance Method Summary
-
#cancel_fine_tuning_job(job_id : String) : FineTuningJob
Immediately cancel a fine-tune job.
-
#chat_completion(req : ChatCompletionRequest) : ChatCompletionResponse
API call to Create a completion for the chat message.
-
#chat_completion_stream(req : ChatCompletionRequest) : ChatCompletionStream
API call to create a chat completion w/ streaming support.
-
#completion(req : CompletionRequest) : CompletionResponse
API call to create a completion.
-
#completion_stream(req : CompletionRequest) : CompletionStream
API call to create a completion w/ streaming support.
- #config : Config
-
#create_fine_tuning_job(job : FineTuningJobRequest) : FineTuningJob
Creates a job that fine-tunes a specified model from a given dataset.
-
#create_image(req : ImageRequest) : ImageResponse
API call to create an image.
-
#create_image_edit(req : ImageEditRequest) : ImageResponse
Creates an edited or extended image given an original image and a prompt.
-
#create_image_variation(req : ImageVariationRequest) : ImageResponse
Creates a variation of a given image.
-
#delete_file(file_id : String) : FileDeletionStatus
Delete a file
-
#embeddings(req : EmbeddingRequest) : EmbeddingResponse
Creates an embedding vector representing the input text.
-
#engine(id : String) : Engine
Retrieves an engine instance, providing basic information about such as the owner and availability.
-
#engines : Array(Engine)
Lists the currently available engines, and provides basic information about each option such as the owner and availability.
-
#get_file(file_id : String) : FileResponse
Retrieve a file
-
#get_file_contents(file_id : String) : IO
Returns the contents of the specified file.
-
#get_fine_tuning_job(job_id : String) : FineTuningJob
Get info about a fine-tuning job.
-
#list_files : Array(FileResponse)
Returns a list of files that belong to the user's organization.
-
#list_fine_tuning_events(job_id : String, after : String | Nil = nil, limit : Int32 = 20) : FineTuningJobEventList
Get status updates for a fine-tuning job.
-
#list_fine_tuning_jobs(after : String | Nil = nil, limit : Int32 = 20) : FineTuningJobEventList
List your organization's fine-tuning jobs
after
: Identifier for the last job from the previous pagination request. -
#model(id : String) : Model
Retrieves a model instance, providing basic information about the model
-
#models : Array(Model)
Lists currently available models, and provide basic information about each model
-
#moderation(req : ModerationRequest) : ModerationResponse
Performs a moderation api call
-
#transcription(req : TranscriptionRequest) : TranscriptionResponse
API call to transcribe audio into the input language.
-
#translation(req : TranscriptionRequest) : TranscriptionResponse
API call to translate audio into English.
-
#upload_file(req : FileRequest) : FileResponse
Upload a file that contains document(s) to be used across various endpoints/features.
Constructor Detail
Class Method Detail
Instance Method Detail
API call to Create a completion for the chat message.
API call to create a chat completion w/ streaming support. It sets 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.
API call to create a completion. This is the main endpoint of the API. Returns new text as well as, if requested, the probabilities over each alternative token at each position.
If using a fine-tuned model, simply provide the model's ID in the CompletionRequest object, and the server will use the model's parameters to generate the completion.
API call to create a completion w/ streaming support. It sets 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.
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.
API call to create an image. This is the main endpoint of the DALL-E API.
Creates an edited or extended image given an original image and a prompt.
Creates a variation of a given image.
Creates an embedding vector representing the input text.
Retrieves an engine instance, providing basic information about such as the owner and availability.
Lists the currently available engines, and provides basic information about each option such as the owner and availability.
Returns a list of files that belong to the user's organization.
Get status updates for a fine-tuning job.
after
: Identifier for the last job from the previous pagination request.
limit
: Number of fine-tuning jobs to retrieve.
List your organization's fine-tuning jobs
after
: Identifier for the last job from the previous pagination request.
limit
: Number of fine-tuning jobs to retrieve.
Retrieves a model instance, providing basic information about the model
Lists currently available models, and provide basic information about each model
Performs a moderation api call
API call to transcribe audio into the input language.
API call to translate audio into English.
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 OpenAI if you need to increase the storage limit.