OpenAI

sttp.openai.OpenAI
class OpenAI(authToken: String, baseUri: Uri)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def addUploadPart(uploadId: String, data: File): Request[Either[OpenAIException, UploadPartResponse]]

Adds a Part to an Upload object. A Part represents a chunk of bytes from the file you are trying to upload.

Adds a Part to an Upload object. A Part represents a chunk of bytes from the file you are trying to upload.

Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.

It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you complete the Upload.

https://platform.openai.com/docs/api-reference/uploads/add-part

Value parameters

data

The chunk of bytes for this Part.

uploadId

The ID of the Upload.

Attributes

Returns

The upload Part object.

def cancelBatch(batchId: String): Request[Either[OpenAIException, BatchResponse]]

Cancels an in-progress batch. The batch will be in status cancelling for up to 10 minutes, before changing to cancelled, where it will have partial results (if any) available in the output file.

Cancels an in-progress batch. The batch will be in status cancelling for up to 10 minutes, before changing to cancelled, where it will have partial results (if any) available in the output file.

https://platform.openai.com/docs/api-reference/batch/cancel

Value parameters

batchId

The ID of the batch to cancel.

Attributes

Returns

The Batch object matching the specified ID.

def cancelFineTuningJob(fineTuningJobId: String): Request[Either[OpenAIException, FineTuningJobResponse]]

Immediately cancel a fine-tune job.

Value parameters

fineTuningJobId

The ID of the fine-tuning job to cancel.

Attributes

def cancelRun(threadId: String, runId: String): Request[Either[OpenAIException, RunData]]

Cancels a run that is in_progress.

Value parameters

runId

The ID of the run to cancel.

threadId

The ID of the thread to which this run belongs.

Attributes

def cancelUpload(uploadId: String): Request[Either[OpenAIException, UploadResponse]]

Cancels the Upload. No Parts may be added after an Upload is cancelled.

Cancels the Upload. No Parts may be added after an Upload is cancelled.

https://platform.openai.com/docs/api-reference/uploads/cancel

Value parameters

uploadId

The ID of the Upload.

Attributes

Returns

The Upload object with status cancelled.

def completeUpload(uploadId: String, requestBody: CompleteUploadRequestBody): Request[Either[OpenAIException, UploadResponse]]

Completes the Upload.

Completes the Upload.

Within the returned Upload object, there is a nested File object that is ready to use in the rest of the platform.

You can specify the order of the Parts by passing in an ordered list of the Part IDs.

The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.

https://platform.openai.com/docs/api-reference/uploads/complete

Value parameters

requestBody

Request body that will be used to complete an upload.

uploadId

The ID of the Upload.

Attributes

Returns

The Upload object with status completed with an additional file property containing the created usable File object.

def createAdminApiKey(createAdminApiKeyRequest: AdminApiKeyRequestBody): Request[Either[OpenAIException, AdminApiKeyResponse]]

Create an organization admin API key

Value parameters

createAdminApiKeyRequest

Request body that will be used to create an admin API key.

Attributes

Returns

The created admin API key object.

def createAssistant(createAssistantBody: CreateAssistantBody): Request[Either[OpenAIException, AssistantData]]

Create an assistant with a model and instructions.

Create an assistant with a model and instructions.

https://platform.openai.com/docs/api-reference/assistants/createAssistant

Value parameters

createAssistantBody

Create completion request body.

Attributes

def createBatch(createBatchRequest: BatchRequestBody): Request[Either[OpenAIException, BatchResponse]]

Creates and executes a batch from an uploaded file of requests

Creates and executes a batch from an uploaded file of requests

https://platform.openai.com/docs/api-reference/batch/create

Value parameters

createBatchRequest

Request body that will be used to create a batch.

Attributes

Returns

The created Batch object.

def createChatCompletion(chatBody: ChatBody): Request[Either[OpenAIException, ChatResponse]]

Creates a model response for the given chat conversation defined in chatBody.

Creates a model response for the given chat conversation defined in chatBody.

https://platform.openai.com/docs/api-reference/chat/create

Value parameters

chatBody

Chat request body.

Attributes

def createChatCompletionAsBinaryStream[S](s: Streams[S], chatBody: ChatBody): StreamRequest[Either[OpenAIException, s.BinaryStream], S]

Creates a model response for the given chat conversation defined in chatBody.

Creates a model response for the given chat conversation defined in chatBody.

The response is streamed in chunks as server-sent events, which are returned unparsed as a binary stream, using the given streams implementation.

https://platform.openai.com/docs/api-reference/chat/create

Value parameters

chatBody

Chat request body.

s

The streams implementation to use.

Attributes

def createChatCompletionAsInputStream(chatBody: ChatBody): Request[Either[OpenAIException, InputStream]]

Creates a model response for the given chat conversation defined in chatBody.

Creates a model response for the given chat conversation defined in chatBody.

The response is streamed in chunks as server-sent events, which are returned unparsed as a InputStream.

https://platform.openai.com/docs/api-reference/chat/create

Value parameters

chatBody

Chat request body.

Attributes

def createCompletion(completionBody: CompletionsBody): Request[Either[OpenAIException, CompletionsResponse]]

Creates a completion for the provided prompt and parameters given in request body.

Creates a completion for the provided prompt and parameters given in request body.

https://platform.openai.com/docs/api-reference/completions/create

Value parameters

completionBody

Create completion request body.

Attributes

def createEmbeddings(embeddingsBody: EmbeddingsBody): Request[Either[OpenAIException, EmbeddingResponse]]

Gets info about the fine-tune job.

Value parameters

embeddingsBody

Embeddings request body.

Attributes

Creates a fine-tuning job which begins the process of creating a new model from a given dataset.

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.

https://platform.openai.com/docs/api-reference/fine-tuning/create

Value parameters

fineTuningRequestBody

Request body that will be used to create a fine-tuning job.

Attributes

def createImage(imageCreationBody: ImageCreationBody): Request[Either[OpenAIException, ImageResponse]]

Creates an image given a prompt in request body.

Creates an image given a prompt in request body.

https://platform.openai.com/docs/api-reference/images/create

Value parameters

imageCreationBody

Create image request body.

Attributes

def createModeration(moderationsBody: ModerationsBody): Request[Either[OpenAIException, ModerationData]]

Classifies if text violates OpenAI's Content Policy.

Classifies if text violates OpenAI's Content Policy.

https://platform.openai.com/docs/api-reference/moderations/create

Value parameters

moderationsBody

Moderation request body.

Attributes

def createRun(threadId: String, createRun: CreateRun): Request[Either[OpenAIException, RunData]]

Create a run.

Value parameters

createRun

Create run request body.

threadId

The ID of the thread to run.

Attributes

def createSpeechAsBinaryStream[S](s: Streams[S], requestBody: SpeechRequestBody): StreamRequest[Either[OpenAIException, s.BinaryStream], S]

Generates audio from the input text.

Value parameters

requestBody

Request body that will be used to create a speech.

s

The streams implementation to use.

Attributes

Returns

The audio file content.

def createSpeechAsInputStream(requestBody: SpeechRequestBody): Request[Either[OpenAIException, InputStream]]

Generates audio from the input text.

Value parameters

requestBody

Request body that will be used to create a speech.

Attributes

Returns

The audio file content.

def createThread(createThreadBody: CreateThreadBody): Request[Either[OpenAIException, ThreadData]]

Create a thread.

Value parameters

createThreadBody

Create completion request body.

Attributes

def createThreadAndRun(createThreadAndRun: CreateThreadAndRun): Request[Either[OpenAIException, RunData]]

Create a thread and run it in one request.

Value parameters

createThreadAndRun

Create thread and run request body.

Attributes

def createThreadMessage(threadId: String, message: CreateMessage): Request[Either[OpenAIException, MessageData]]

Create a message.

Value parameters

threadId

The ID of the thread to create a message for.

Attributes

def createTranscription(file: File, model: RecognitionModel): Request[Either[OpenAIException, AudioResponse]]

Transcribes audio into the input language.

Transcribes audio into the input language.

https://platform.openai.com/docs/api-reference/audio/create

Value parameters

file

The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.

model

ID of the model to use. Only whisper-1 is currently available.

Attributes

def createTranscription(systemPath: String, model: RecognitionModel): Request[Either[OpenAIException, AudioResponse]]

Transcribes audio into the input language.

Transcribes audio into the input language.

https://platform.openai.com/docs/api-reference/audio/create

Value parameters

model

ID of the model to use. Only whisper-1 is currently available.

systemPath

The audio systemPath to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.

Attributes

def createTranscription(transcriptionConfig: TranscriptionConfig): Request[Either[OpenAIException, AudioResponse]]

Transcribes audio into the input language.

Transcribes audio into the input language.

Value parameters

transcriptionConfig

An instance of the case class TranscriptionConfig containing the necessary parameters for the audio transcription

Attributes

Returns

An url to edited image.

def createTranslation(file: File, model: RecognitionModel): Request[Either[OpenAIException, AudioResponse]]

Translates audio into English text.

Value parameters

file

The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.

model

ID of the model to use. Only whisper-1 is currently available.

Attributes

def createTranslation(systemPath: String, model: RecognitionModel): Request[Either[OpenAIException, AudioResponse]]

Translates audio into English text.

Value parameters

model

ID of the model to use. Only whisper-1 is currently available.

systemPath

The audio systemPath to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.

Attributes

def createTranslation(translationConfig: TranslationConfig): Request[Either[OpenAIException, AudioResponse]]

Translates audio into English text.

Value parameters

translationConfig

An instance of the case class TranslationConfig containing the necessary parameters for the audio translation.

Attributes

def createUpload(uploadRequestBody: UploadRequestBody): Request[Either[OpenAIException, UploadResponse]]

Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.

Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it.

Once you complete the Upload, we will create a File object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object.

For certain purposes, the correct mime_type must be specified. Please refer to documentation for the supported MIME types for your use case:

null.

For guidance on the proper filename extensions for each purpose, please follow the documentation on creating a File.

https://platform.openai.com/docs/api-reference/uploads/create

Value parameters

uploadRequestBody

Request body that will be used to create an upload.

Attributes

Returns

The Upload object with status pending.

def createVectorStore(createVectorStoreBody: CreateVectorStoreBody): Request[Either[OpenAIException, VectorStore]]

Creates vector store

Creates vector store

Value parameters

createVectorStoreBody

Options for new vector store

Attributes

Returns

Newly created vector store or exception

def createVectorStoreFile(vectorStoreId: String, createVectorStoreFileBody: CreateVectorStoreFileBody): Request[Either[OpenAIException, VectorStoreFile]]

Creates vector store file

Creates vector store file

Value parameters

createVectorStoreFileBody

Properties of file

vectorStoreId

Id of vector store for file

Attributes

Returns

Newly created vector store file

def deleteAdminApiKey(keyId: String): Request[Either[OpenAIException, DeleteAdminApiKeyResponse]]

Delete an organization admin API key

Value parameters

keyId

Key id used to delete an admin API key.

Attributes

Returns

A confirmation object indicating the key was deleted.

def deleteAssistant(assistantId: String): Request[Either[OpenAIException, DeleteAssistantResponse]]

Delete an assistant.

Value parameters

assistantId

The ID of the assistant to delete.

Attributes

def deleteChatCompletion(completionId: String): Request[Either[OpenAIException, DeleteChatCompletionResponse]]

Delete a stored chat completion. Only chat completions that have been created with the store parameter set to true can be deleted.

Delete a stored chat completion. Only chat completions that have been created with the store parameter set to true can be deleted.

https://platform.openai.com/docs/api-reference/chat/delete

Value parameters

completionId

The ID of the chat completion to delete.

Attributes

Returns

A deletion confirmation object.

def deleteFile(fileId: String): Request[Either[OpenAIException, DeletedFileData]]

Delete a file.

Value parameters

fileId

The ID of the file to use for this request.

Attributes

def deleteMessage(threadId: String, messageId: String): Request[Either[OpenAIException, DeleteMessageResponse]]

Deletes a message.

Value parameters

messageId

The ID of the message to delete.

threadId

The ID of the thread to which this message belongs.

Attributes

Returns

Deletion status

def deleteModel(modelId: String): Request[Either[OpenAIException, DeletedModelData]]

Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.

Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.

https://platform.openai.com/docs/api-reference/models/delete

Value parameters

modelId

The model to delete

Attributes

Returns

Deletion status.

def deleteThread(threadId: String): Request[Either[OpenAIException, DeleteThreadResponse]]

Delete a thread.

Value parameters

threadId

The ID of the thread to delete.

Attributes

def deleteVectorStore(vectorStoreId: String): Request[Either[OpenAIException, DeleteVectorStoreResponse]]

Deletes vector store

Deletes vector store

Value parameters

vectorStoreId

Id of vector store to be deleted

Attributes

Returns

Result of deleted operation

def deleteVectorStoreFile(vectorStoreId: String, fileId: String): Request[Either[OpenAIException, DeleteVectorStoreFileResponse]]

Deletes vector store file by id

Deletes vector store file by id

Value parameters

fileId

Id of vector store file

vectorStoreId

Id of vector store

Attributes

Returns

Result of delete operation

def getChatCompletion(completionId: String): Request[Either[OpenAIException, ChatResponse]]

Get a stored chat completion. Only chat completions that have been created with the store parameter set to true will be returned.

Get a stored chat completion. Only chat completions that have been created with the store parameter set to true will be returned.

https://platform.openai.com/docs/api-reference/chat/get

Value parameters

completionId

The ID of the chat completion to retrieve.

Attributes

Returns

The ChatCompletion object matching the specified ID.

def getChatMessages(completionId: String, queryParameters: ListMessagesQueryParameters): Request[Either[OpenAIException, ListMessageResponse]]

Get the messages in a stored chat completion. Only chat completions that have been created with the store parameter set to true will be returned.

Get the messages in a stored chat completion. Only chat completions that have been created with the store parameter set to true will be returned.

https://platform.openai.com/docs/api-reference/chat/getMessages

Value parameters

completionId

The ID of the chat completion to retrieve messages from.

Attributes

Returns

A list of messages for the specified chat completion.

def getFiles: Request[Either[OpenAIException, FilesResponse]]

Returns a list of files that belong to the user's organization.

Returns a list of files that belong to the user's organization.

https://platform.openai.com/docs/api-reference/files

Attributes

def getModels: Request[Either[OpenAIException, ModelsResponse]]

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Lists the currently available models, and provides basic information about each one such as the owner and availability.

https://platform.openai.com/docs/api-reference/models

Attributes

def imageEdits(image: File, prompt: String): Request[Either[OpenAIException, ImageResponse]]

Creates edited or extended images given an original image and a prompt.

Creates edited or extended images given an original image and a prompt.

https://platform.openai.com/docs/api-reference/images/create-edit

Value parameters

image

The image to be edited. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.

prompt

A text description of the desired image. The maximum length is 1000 characters.

Attributes

def imageEdits(systemPath: String, prompt: String): Request[Either[OpenAIException, ImageResponse]]

Creates edited or extended images given an original image and a prompt.

Creates edited or extended images given an original image and a prompt.

https://platform.openai.com/docs/api-reference/images/create-edit

Value parameters

prompt

A text description of the desired image. The maximum length is 1000 characters.

systemPath

Path to the image to be edited. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask

Attributes

def imageEdits(imageEditsConfig: ImageEditsConfig): Request[Either[OpenAIException, ImageResponse]]

Creates edited or extended images given an original image and a prompt.

Creates edited or extended images given an original image and a prompt.

https://platform.openai.com/docs/api-reference/images/create-edit

Value parameters

imageEditsConfig

An instance of the case class ImageEditConfig containing the necessary parameters for editing the image.

Attributes

def imageVariations(image: File): Request[Either[OpenAIException, ImageResponse]]

Creates a variation of a given image.

Value parameters

image

The image to use as the basis for the variation. Must be a valid PNG file, less than 4MB, and square.

Attributes

def imageVariations(systemPath: String): Request[Either[OpenAIException, ImageResponse]]

Creates a variation of a given image.

Value parameters

systemPath

Path to the image to use as the basis for the variation. Must be a valid PNG file, less than 4MB, and square.

Attributes

def imageVariations(imageVariationsConfig: ImageVariationsConfig): Request[Either[OpenAIException, ImageResponse]]

Creates a variation of a given image.

Value parameters

imageVariationsConfig

An instance of the case class ImageVariationsConfig containing the necessary parameters for the image variation.

Attributes

def listAdminApiKeys(queryParameters: QueryParameters): Request[Either[OpenAIException, ListAdminApiKeyResponse]]

List organization API keys

Attributes

Returns

A list of admin API key objects.

def listAssistants(queryParameters: QueryParameters): Request[Either[OpenAIException, ListAssistantsResponse]]

Returns a list of assistants.

def listBatches(queryParameters: QueryParameters): Request[Either[OpenAIException, ListBatchResponse]]

List your organization's batches.

Attributes

Returns

A list of paginated Batch objects.

List stored chat completions. Only chat completions that have been stored with the store parameter set to true will be returned.

List stored chat completions. Only chat completions that have been stored with the store parameter set to true will be returned.

https://platform.openai.com/docs/api-reference/chat/list

Attributes

Returns

A list of chat completions matching the specified filters.

def listFineTuningJobCheckpoints(fineTuningJobId: String, queryParameters: QueryParameters): Request[Either[OpenAIException, ListFineTuningJobCheckpointResponse]]

List checkpoints for a fine-tuning job.

Value parameters

fineTuningJobId

The ID of the fine-tuning job to get checkpoints for.

Attributes

def listFineTuningJobEvents(fineTuningJobId: String, queryParameters: QueryParameters): Request[Either[OpenAIException, ListFineTuningJobEventResponse]]

Get status updates for a fine-tuning job.

Value parameters

fineTuningJobId

The ID of the fine-tuning job to get checkpoints for.

Attributes

List your organization's fine-tuning jobs

List your organization's fine-tuning jobs

https://platform.openai.com/docs/api-reference/fine-tuning/list

Attributes

def listRunSteps(threadId: String, runId: String, queryParameters: QueryParameters): Request[Either[OpenAIException, ListRunStepsResponse]]

Returns a list of run steps belonging to a run.

Returns a list of run steps belonging to a run.

https://platform.openai.com/docs/api-reference/runs/listRunSteps

Value parameters

runId

The ID of the run the run steps belong to.

threadId

The ID of the thread the run and run steps belong to.

Attributes

def listRuns(threadId: String): Request[Either[OpenAIException, ListRunsResponse]]

Returns a list of runs belonging to a thread..

Returns a list of runs belonging to a thread..

https://platform.openai.com/docs/api-reference/runs/listRuns

Value parameters

threadId

The ID of the thread the run belongs to.

Attributes

def listThreadMessages(threadId: String, queryParameters: QueryParameters): Request[Either[OpenAIException, ListMessagesResponse]]

Returns a list of messages for a given thread.

Returns a list of messages for a given thread.

https://platform.openai.com/docs/api-reference/messages/listMessages

Value parameters

threadId

The ID of the thread the messages belong to.

Attributes

def listVectorStoreFiles(vectorStoreId: String, queryParameters: ListVectorStoreFilesBody): Request[Either[OpenAIException, ListVectorStoreFilesResponse]]

List files belonging to particular datastore

List files belonging to particular datastore

Value parameters

queryParameters

Search params

vectorStoreId

Id of vector store

Attributes

Returns

List of vector store files

Lists vector store

Lists vector store

Value parameters

queryParameters

Search params

Attributes

Returns

List of vector stores matching criteria or exception

def modifyAssistant(assistantId: String, modifyAssistantBody: ModifyAssistantBody): Request[Either[OpenAIException, AssistantData]]

Modifies an assistant.

Value parameters

assistantId

The ID of the assistant to modify.

modifyAssistantBody

Modify assistant request body.

Attributes

def modifyMessage(threadId: String, messageId: String, metadata: Map[String, String]): Request[Either[OpenAIException, MessageData]]

Modifies a message.

Value parameters

messageId

The ID of the message to modify.

threadId

The ID of the thread to which this message belongs.

Attributes

def modifyRun(threadId: String, runId: String, metadata: Map[String, String]): Request[Either[OpenAIException, RunData]]

Modifies a run.

Value parameters

runId

The ID of the run to modify.

threadId

The ID of the thread that was run.

Attributes

def modifyThread(threadId: String, metadata: Map[String, String]): Request[Either[OpenAIException, ThreadData]]

Modifies a thread.

Value parameters

threadId

The ID of the thread to modify. Only the metadata can be modified.

Attributes

def modifyVectorStore(vectorStoreId: String, modifyVectorStoreBody: ModifyVectorStoreBody): Request[Either[OpenAIException, VectorStore]]

Modifies vector store

Modifies vector store

Value parameters

modifyVectorStoreBody

New values for store properties

vectorStoreId

Id of vector store to modify

Attributes

Returns

Modified vector store object

def retrieveAdminApiKey(keyId: String): Request[Either[OpenAIException, AdminApiKeyResponse]]

Retrieve a single organization API key

Value parameters

keyId

Key id used to retrieve an admin API key.

Attributes

Returns

The requested admin API key object.

def retrieveAssistant(assistantId: String): Request[Either[OpenAIException, AssistantData]]

Retrieves an assistant.

Value parameters

assistantId

The ID of the assistant to retrieve.

Attributes

def retrieveBatch(batchId: String): Request[Either[OpenAIException, BatchResponse]]

Retrieves a batch.

Value parameters

batchId

The ID of the batch to retrieve.

Attributes

Returns

The Batch object matching the specified ID.

def retrieveFile(fileId: String): Request[Either[OpenAIException, FileData]]

Returns information about a specific file.

Returns information about a specific file.

https://platform.openai.com/docs/api-reference/files/retrieve

Value parameters

fileId

The ID of the file to use for this request.

Attributes

def retrieveFileContent(fileId: String): Request[Either[OpenAIException, String]]

Returns the contents of the specified file.

Returns the contents of the specified file.

https://platform.openai.com/docs/api-reference/files/retrieve-content

Value parameters

fileId

The ID of the file.

Attributes

def retrieveFineTuningJob(fineTuningJobId: String): Request[Either[OpenAIException, FineTuningJobResponse]]

Get info about a fine-tuning job.

Value parameters

fineTuningJobId

The ID of the fine-tuning job.

Attributes

def retrieveModel(modelId: String): Request[Either[OpenAIException, ModelData]]

Retrieves a model instance, providing basic information about the model such as the owner and permissions.

Retrieves a model instance, providing basic information about the model such as the owner and permissions.

https://platform.openai.com/docs/api-reference/models/retrieve

Value parameters

modelId

The ID of the model to use for this request.

Attributes

def retrieveRun(threadId: String, runId: String): Request[Either[OpenAIException, RunData]]

Retrieves a run.

Value parameters

runId

The ID of the run to retrieve.

threadId

The ID of the thread that was run.

Attributes

def retrieveRunStep(threadId: String, runId: String, stepId: String): Request[Either[OpenAIException, RunStepData]]

Retrieves a run step.

Value parameters

runId

The ID of the run to which the run step belongs.

stepId

The ID of the run step to retrieve.

threadId

The ID of the thread to which the run and run step belongs.

Attributes

def retrieveThread(threadId: String): Request[Either[OpenAIException, ThreadData]]

Retrieves a thread.

Value parameters

threadId

The ID of the thread to retrieve.

Attributes

def retrieveThreadMessage(threadId: String, messageId: String): Request[Either[OpenAIException, MessageData]]

Retrieve a message.

Value parameters

messageId

The ID of the message to retrieve.

threadId

The ID of the thread to which this message belongs.

Attributes

def retrieveVectorStore(vectorStoreId: String): Request[Either[OpenAIException, VectorStore]]

Retrieves vector store by id

Retrieves vector store by id

Value parameters

vectorStoreId

Id of vector store

Attributes

Returns

Vector store object or exception

def retrieveVectorStoreFile(vectorStoreId: String, fileId: String): Request[Either[OpenAIException, VectorStoreFile]]

Retrieves vector store file by id

Retrieves vector store file by id

Value parameters

fileId

Id of vector store file

vectorStoreId

Id of vector store

Attributes

Returns

Vector store file

def submitToolOutputs(threadId: String, runId: String, toolOutputs: Seq[ToolOutput]): Request[Either[OpenAIException, RunData]]

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.

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.

https://platform.openai.com/docs/api-reference/runs/submitToolOutputs

Value parameters

runId

The ID of the run that requires the tool output submission.

threadId

The ID of the thread to which this run belongs.

toolOutputs

A list of tools for which the outputs are being submitted.

Attributes

def updateChatCompletion(completionId: String, requestBody: UpdateChatCompletionRequestBody): Request[Either[OpenAIException, ChatResponse]]

Modify a stored chat completion. Only chat completions that have been created with the store parameter set to true can be modified. Currently, the only supported modification is to update the metadata field.

Modify a stored chat completion. Only chat completions that have been created with the store parameter set to true can be modified. Currently, the only supported modification is to update the metadata field.

https://platform.openai.com/docs/api-reference/chat/update

Value parameters

completionId

The ID of the chat completion to update.

requestBody

Chat completion update request body.

Attributes

Returns

The ChatCompletion object matching the specified ID.

def uploadFile(file: File, purpose: String): Request[Either[OpenAIException, FileData]]

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.

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.

https://platform.openai.com/docs/api-reference/files/upload

Value parameters

file

JSON Lines file to be uploaded. If the purpose is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your training examples.

purpose

The intended purpose of the uploaded documents. Use "fine-tune" for Fine-tuning. This allows OpenAI to validate the format of the uploaded file.

Attributes

def uploadFile(file: File): Request[Either[OpenAIException, FileData]]

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.

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.

https://platform.openai.com/docs/api-reference/files/upload

Value parameters

file

JSON Lines file to be uploaded and the purpose is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your training examples.

Attributes

def uploadFile(systemPath: String, purpose: String): Request[Either[OpenAIException, FileData]]

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.

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.

https://platform.openai.com/docs/api-reference/files/upload

Value parameters

purpose

The intended purpose of the uploaded documents. Use "fine-tune" for Fine-tuning. This allows OpenAI to validate the format of the uploaded file.

systemPath

Path to the JSON Lines file to be uploaded. If the purpose is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your training examples.

Attributes

def uploadFile(systemPath: String): Request[Either[OpenAIException, FileData]]

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.

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.

https://platform.openai.com/docs/api-reference/files/upload

Value parameters

systemPath

Path to the JSON Lines file to be uploaded and the purpose is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your training examples.

Attributes