NAME
OpenAPI::Client::OpenAI::Methods - Methods for OpenAI API
DESCRIPTION
Yes, this isn't perfect. But it's a start. The OpenAI API is complex and and the OpenAPI::Client module is a bit opaque at times. We'll add more later.
METHODS
cancelBatch
Cancels an in-progress batch.
Parameters
batch_id
The ID of the batch to cancel.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
cancelFineTuningJob
Immediately cancel a fine-tune job.
Parameters
fine_tuning_job_id
The ID of the fine-tuning job to cancel.
Type: string
In: path
Required: True
Default: N/A
Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
Enum: N/A
cancelRun
Cancels a run that is in_progress
.
Parameters
thread_id
The ID of the thread to which this run belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
run_id
The ID of the run to cancel.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
cancelVectorStoreFileBatch
Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
Parameters
vector_store_id
The ID of the vector store that the file batch belongs to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
batch_id
The ID of the file batch to cancel.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
createAssistant
Create an assistant with a model and instructions.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createBatch
Creates and executes a batch from an uploaded file of requests
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createChatCompletion
Creates a model response for the given chat conversation.
Examples
See the following files in the distribution for examples:
examples/chat.pl
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createCompletion
Creates a completion for the provided prompt and parameters.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createEmbedding
Creates an embedding vector representing the input text.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createFile
Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.
The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details.
The Fine-tuning API only supports .jsonl
files.
The Batch API only supports .jsonl
files up to 100 MB in size.
Please contact us if you need to increase these storage limits.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createFineTuningJob
Creates a fine-tuning job which begins the process of creating a new 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.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createImage
Creates an image given a prompt.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createImageEdit
Creates an edited or extended image given an original image and a prompt.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createImageVariation
Creates a variation of a given image.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createMessage
Create a message.
Parameters
thread_id
The ID of the thread to create a message for.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createModeration
Classifies if text is potentially harmful.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createRun
Create a run.
Parameters
thread_id
The ID of the thread to run.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createSpeech
Generates audio from the input text.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createThread
Create a thread.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createThreadAndRun
Create a thread and run it in one request.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createTranscription
Transcribes audio into the input language.
Examples
See the following files in the distribution for examples:
examples/transcribe-audio.pl
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createTranslation
Translates audio into English.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createVectorStore
Create a vector store.
This method does not take any path or URL parameters.
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createVectorStoreFile
Create a vector store file by attaching a File to a vector store.
Parameters
vector_store_id
The ID of the vector store for which to create a File.
Type: string
In: path
Required: True
Default: N/A
Example: vs_abc123
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
createVectorStoreFileBatch
Create a vector store file batch.
Parameters
vector_store_id
The ID of the vector store for which to create a File Batch.
Type: string
In: path
Required: True
Default: N/A
Example: vs_abc123
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
deleteAssistant
Delete an assistant.
Parameters
assistant_id
The ID of the assistant to delete.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
deleteFile
Delete a file.
Parameters
file_id
The ID of the file to use for this request.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
deleteMessage
Deletes a message.
Parameters
thread_id
The ID of the thread to which this message belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
message_id
The ID of the message to delete.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
deleteModel
Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
Parameters
model
The model to delete
Type: string
In: path
Required: True
Default: N/A
Example: ft:gpt-3.5-turbo:acemeco:suffix:abc123
Enum: N/A
deleteThread
Delete a thread.
Parameters
thread_id
The ID of the thread to delete.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
deleteVectorStore
Delete a vector store.
Parameters
vector_store_id
The ID of the vector store to delete.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
deleteVectorStoreFile
Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.
Parameters
vector_store_id
The ID of the vector store that the file belongs to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
file_id
The ID of the file to delete.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
downloadFile
Returns the contents of the specified file.
Parameters
file_id
The ID of the file to use for this request.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getAssistant
Retrieves an assistant.
Parameters
assistant_id
The ID of the assistant to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getMessage
Retrieve a message.
Parameters
thread_id
The ID of the thread to which this message belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
message_id
The ID of the message to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getRun
Retrieves a run.
Parameters
thread_id
The ID of the thread that was run.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
run_id
The ID of the run to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getRunStep
Retrieves a run step.
Parameters
thread_id
The ID of the thread to which the run and run step belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
run_id
The ID of the run to which the run step belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
step_id
The ID of the run step to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getThread
Retrieves a thread.
Parameters
thread_id
The ID of the thread to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getVectorStore
Retrieves a vector store.
Parameters
vector_store_id
The ID of the vector store to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
getVectorStoreFile
Retrieves a vector store file.
Parameters
vector_store_id
The ID of the vector store that the file belongs to.
Type: string
In: path
Required: True
Default: N/A
Example: vs_abc123
Enum: N/A
file_id
The ID of the file being retrieved.
Type: string
In: path
Required: True
Default: N/A
Example: file-abc123
Enum: N/A
getVectorStoreFileBatch
Retrieves a vector store file batch.
Parameters
vector_store_id
The ID of the vector store that the file batch belongs to.
Type: string
In: path
Required: True
Default: N/A
Example: vs_abc123
Enum: N/A
batch_id
The ID of the file batch being retrieved.
Type: string
In: path
Required: True
Default: N/A
Example: vsfb_abc123
Enum: N/A
listAssistants
Returns a list of assistants.
Parameters
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
listBatches
List your organization's batches.
Parameters
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
listFiles
Returns a list of files that belong to the user's organization.
Parameters
purpose
Only return files with the given purpose.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
listFilesInVectorStoreBatch
Returns a list of vector store files in a batch.
Parameters
vector_store_id
The ID of the vector store that the files belong to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
batch_id
The ID of the file batch that the files belong to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
filter
Filter by file status. One of in_progress
, completed
, failed
, cancelled
.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: in_progress, completed, failed, cancelled
listFineTuningEvents
Get status updates for a fine-tuning job.
Parameters
fine_tuning_job_id
The ID of the fine-tuning job to get events for.
Type: string
In: path
Required: True
Default: N/A
Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
Enum: N/A
after
Identifier for the last event from the previous pagination request.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
limit
Number of events to retrieve.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
listFineTuningJobCheckpoints
List checkpoints for a fine-tuning job.
Parameters
fine_tuning_job_id
The ID of the fine-tuning job to get checkpoints for.
Type: string
In: path
Required: True
Default: N/A
Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
Enum: N/A
after
Identifier for the last checkpoint ID from the previous pagination request.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
limit
Number of checkpoints to retrieve.
Type: integer
In: query
Required: False
Default: 10
Example: N/A
Enum: N/A
listMessages
Returns a list of messages for a given thread.
Parameters
thread_id
The ID of the thread the messages belong to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
run_id
Filter messages by the run ID that generated them.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
listModels
Lists the currently available models, and provides basic information about each one such as the owner and availability.
This method does not take any path or URL parameters.
listPaginatedFineTuningJobs
List your organization's fine-tuning jobs
Parameters
after
Identifier for the last job from the previous pagination request.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
limit
Number of fine-tuning jobs to retrieve.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
listRuns
Returns a list of runs belonging to a thread.
Parameters
thread_id
The ID of the thread the run belongs to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
listRunSteps
Returns a list of run steps belonging to a run.
Parameters
thread_id
The ID of the thread the run and run steps belong to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
run_id
The ID of the run the run steps belong to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
listVectorStoreFiles
Returns a list of vector store files.
Parameters
vector_store_id
The ID of the vector store that the files belong to.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
filter
Filter by file status. One of in_progress
, completed
, failed
, cancelled
.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: in_progress, completed, failed, cancelled
listVectorStores
Returns a list of vector stores.
Parameters
limit
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
Type: integer
In: query
Required: False
Default: 20
Example: N/A
Enum: N/A
order
Sort order by the C timestamp of the objects. C for ascending order and C for descending order.
Type: string
In: query
Required: False
Default: desc
Example: N/A
Enum: asc, desc
after
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the next page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
before
A cursor for use in pagination. C is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with objIfoo in order to fetch the previous page of the list.
Type: string
In: query
Required: False
Default: N/A
Example: N/A
Enum: N/A
modifyAssistant
Modifies an assistant.
Parameters
assistant_id
The ID of the assistant to modify.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
modifyMessage
Modifies a message.
Parameters
thread_id
The ID of the thread to which this message belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
message_id
The ID of the message to modify.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
modifyRun
Modifies a run.
Parameters
thread_id
The ID of the thread that was run.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
run_id
The ID of the run to modify.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
modifyThread
Modifies a thread.
Parameters
thread_id
The ID of the thread to modify. Only the metadata
can be modified.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
modifyVectorStore
Modifies a vector store.
Parameters
vector_store_id
The ID of the vector store to modify.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
retrieveBatch
Retrieves a batch.
Parameters
batch_id
The ID of the batch to retrieve.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
retrieveFile
Returns information about a specific file.
Parameters
file_id
The ID of the file to use for this request.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
retrieveFineTuningJob
Get info about a fine-tuning job.
Parameters
fine_tuning_job_id
The ID of the fine-tuning job.
Type: string
In: path
Required: True
Default: N/A
Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F
Enum: N/A
retrieveModel
Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
Parameters
model
The ID of the model to use for this request
Type: string
In: path
Required: True
Default: N/A
Example: gpt-3.5-turbo
Enum: N/A
submitToolOuputsToRun
When a run has the status: "requires_action"
and required_action.type
is submit_tool_outputs
, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
Parameters
thread_id
The ID of the thread to which this run belongs.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
run_id
The ID of the run that requires the tool output submission.
Type: string
In: path
Required: True
Default: N/A
Example: N/A
Enum: N/A
Request Body
The request body is complicated. See OpenAPI::Client::OpenAI::Schema for details.
COPYRIGHT AND LICENSE
Copyright (C) 2023-2024 by Nelson Ferraz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.