Package xyz.felh.openai
Class OpenAiService
java.lang.Object
xyz.felh.openai.OpenAiService
OpenAi Service Class
-
Constructor Summary
ConstructorsConstructorDescriptionOpenAiService(String token) Creates a new OpenAiService that wraps OpenAiApiOpenAiService(String token, Duration timeout) Creates a new OpenAiService that wraps OpenAiApiOpenAiService(OpenAiApi api, okhttp3.OkHttpClient client) Creates a new OpenAiService that wraps OpenAiApi. -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAiApicancelBatch(String batchId) Cancels an in-progress batch.cancelFineTuningJob(String fineTuningJobId) Immediately cancel a fine-tune job.cancelThreadRun(String threadId, String runId) POST https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/cancelcancelVectorStoreFileBatch(String vectorStoreId, String batchId) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel <p> Cancel vector store file batch @param vectorStoreId The ID of the vector store that the file batch belongs to. @param batchId The ID of the file batch to cancel. @return The modified {@link VectorStoreFileBatch} object.'createAssistant(CreateAssistantRequest request) POST https://api.openai.com/v1/assistantsTranscribes audio into the input language.whisper-1createBatch(CreateBatchRequest request) Creates and executes a batch from an uploaded file of requestsgpt-4, gpt-4-0314, gpt-4-32k, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-0301 gpt-3.5-turbo-1006, gpt-4-1106-previewcreateChatCompletion(CreateChatCompletionRequest request, Function<ChatCompletion, CreateChatCompletionRequest> toolCallsHandler) createEmbeddings(CreateEmbeddingRequest request) text-embedding-ada-002, text-search-ada-doc-001Creates a job that fine-tunes a specified model from a given dataset.createImage(CreateImageRequest request) createImageEdit(CreateEditRequest request) createModeration(CreateModerationRequest request) text-moderation-stable, text-moderation-latestbyte[]createSpeech(CreateSpeechRequest request) Generates audio from the input text.voidcreateSteamChatCompletion(String requestId, CreateChatCompletionRequest request, @NonNull StreamListener<ChatCompletion> listener) create chat completion by stream, user-side handled if there is tool_callsvoidcreateSteamChatCompletion(String requestId, CreateChatCompletionRequest request, @NonNull StreamListener<ChatCompletion> listener, BiFunction<String, ChatCompletion, StreamToolCallsRequest> toolCallsHandler) create chat completion by stream, sdk-side handled if there is tool_callscreateThread(CreateThreadRequest request) POST https://api.openai.com/v1/threadsvoidcreateThreadAndRun(String requestId, CreateThreadAndRunRequest request, @NonNull StreamListener<IOpenAiApiObject> listener) POST https://api.openai.com/v1/threads/runsPOST https://api.openai.com/v1/threads/runscreateThreadMessage(String threadId, CreateMessageRequest request) POST https://api.openai.com/v1/threads/{thread_id}/messagesvoidcreateThreadRun(String requestId, String threadId, CreateRunRequest request, @NonNull StreamListener<IOpenAiApiObject> listener) POST https://api.openai.com/v1/threads/{thread_id}/runscreateThreadRun(String threadId, CreateRunRequest request) POST https://api.openai.com/v1/threads/{thread_id}/runsinvalid input: 'https://api.openai.com/v1/vector_stores <p> Create a vector store. @param request Request body @return An {@link VectorStore } object.'createVectorStoreFile(String vectorStoreId, CreateVectorStoreFileRequest request) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/files <p> Create vector store file @param vectorStoreId The ID of the {@link VectorStore} for which to create a File. @param request Request body @return An {@link VectorStoreFile } object.'createVectorStoreFileBatch(String vectorStoreId, CreateVectorStoreFileBatchRequest request) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches <p> Create a vector store file batch. @param vectorStoreId The ID of the vector store for which to create a File Batch. @param request Request body @return An {@link VectorStoreFileBatch } object.'static okhttp3.OkHttpClientdefaultClient(String token, String orgId, String projectId, Duration timeout) static okhttp3.OkHttpClientdefaultClient(String token, Duration timeout) static com.fasterxml.jackson.databind.ObjectMapperstatic retrofit2.RetrofitdefaultRetrofit(okhttp3.OkHttpClient client, com.fasterxml.jackson.databind.ObjectMapper mapper) deleteAssistant(String assistantId) DELETE https://api.openai.com/v1/assistants/{assistant_id}deleteFile(String fileId) deleteThread(String threadId) DELETE https://api.openai.com/v1/threads/{thread_id}deleteVectorStore(String vectorStoreId) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id} <p> Delete a vector store. @param vectorStoreId The ID of the vector store to delete. @return Deletion status'deleteVectorStoreFile(String vectorStoreId, String fileId) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id} <p> Delete vector store file @param vectorStoreId The ID of the vector store that the file belongs to. @param fileId The ID of the file to delete. @return Deletion status'static <T> Texecute(io.reactivex.rxjava3.core.Single<T> apiCall) Calls the Open AI api, returns the response, and parses error messages if the request failslistAssistants(Integer limit, String order, String after, String before) GET https://api.openai.com/v1/assistantslistBatches(String after, Integer limit) List your organization's batches.listFineTuningEvents(String fineTuningJobId, String after, Integer limit) Get status updates for a fine-tuning job.listThreadMessages(String threadId, Integer limit, String order, String after, String before, String runId) GET https://api.openai.com/v1/threads/{thread_id}/messageslistThreadMessages(String threadId, String runId) listThreadRuns(String threadId) GET https://api.openai.com/v1/threads/{thread_id}/runslistThreadRunSteps(String threadId, String runId) listThreadRunSteps(String threadId, String runId, Integer limit, String order, String after, String before) GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/stepslistVectorStoreFileBatches(String vectorStoreId, String batchId, Integer limit, String order, String after, String before, String filter) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files <p> List vector store files in a batchBeta @param vectorStoreId The ID of the vector store that the files belong to. @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. @param after A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. @param before A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. @param batchId The ID of the file batch that the files belong to. @param filter Filter by file status. One of in_progress, completed, failed, cancelled.{@link xyz.felh.openai.assistant.vector.store.file.batch.VectorStoreFileBatch.Status} @return A list of {@link VectorStoreFileBatch} objects.'listVectorStoreFileBatches(String vectorStoreId, String batchId, String filter) listVectorStoreFiles(String vectorStoreId, Integer limit, String order, String after, String before, String filter) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/files <p> List vector store files @param vectorStoreId The ID of the vector store that the files belong to. @param filter Filter by file status. One of in_progress, completed, failed, cancelled of {@link xyz.felh.openai.assistant.vector.store.file.VectorStoreFile.Status}. @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. @param after A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. @param before A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. @return A list of {@link VectorStoreFile} objects.'listVectorStoreFiles(String vectorStoreId, String filter) listVectorStores(Integer limit, String order, String after, String before) invalid input: 'https://api.openai.com/v1/vector_stores <p> List vector stores @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. @param after A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. @param before A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. @return A list of {@link VectorStore} objects.'modifyAssistant(String assistantId, ModifyAssistantRequest request) POST https://api.openai.com/v1/assistants/{assistant_id}modifyThread(String threadId, ModifyThreadRequest request) GET https://api.openai.com/v1/threads/{thread_id}modifyThreadMessage(String threadId, String messageId, ModifyMessageRequest request) GET https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}modifyThreadRun(String threadId, String runId, ModifyRunRequest request) GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}modifyVectorStore(String vectorStoreId, ModifyVectorStoreRequest request) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id} <p> Modifies a vector store. @param vectorStoreId The ID of the vector store to modify. @param request Request body @return The modified {@link VectorStore} object.'retrieveAssistant(String assistantId) Retrieves an assistant.retrieveBatch(String batchId) Retrieves a batch.retrieveFile(String fileId) retrieveFileContent(String fileId) retrieveFineTuningJob(String fineTuningJobId) Get info about a fine-tuning job.retrieveThread(String threadId) GET https://api.openai.com/v1/threads/{thread_id}retrieveThreadMessage(String threadId, String messageId) GET https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}retrieveThreadRun(String threadId, String runId) GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}retrieveThreadRunStep(String threadId, String runId, String stepId) GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/steps/{step_id}retrieveVectorStore(String vectorStoreId) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id} <p> Retrieves a vector store. @param vectorStoreId The ID of the vector store to retrieve. @return The {@link VectorStore} object matching the specified ID.'retrieveVectorStoreFileBatch(String vectorStoreId, String batchId) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id} <p> Retrieves a vector store file batch. @param vectorStoreId The ID of the vector store that the file batch belongs to. @param batchId The ID of the file batch being retrieved. @return The {@link VectorStoreFileBatch} object matching the specified ID.'voidsubmitToolOutputs(String requestId, String threadId, String runId, SubmitToolOutputsRequest request, @NonNull StreamListener<IOpenAiApiObject> listener) POST https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputssubmitToolOutputs(String threadId, String runId, SubmitToolOutputsRequest request) POST https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputsuploadFile(File file, File.Purpose purpose) uploadFile(String filepath, File.Purpose purpose)
-
Constructor Details
-
OpenAiService
Creates a new OpenAiService that wraps OpenAiApi- Parameters:
token- OpenAi token string "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-
OpenAiService
Creates a new OpenAiService that wraps OpenAiApi- Parameters:
token- OpenAi token string "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"timeout- http read timeout, Duration.ZERO means no timeout
-
OpenAiService
Creates a new OpenAiService that wraps OpenAiApi. Use this if you need more customization.- Parameters:
api- OpenAiApi instance to use for all methods
-
-
Method Details
-
execute
public static <T> T execute(io.reactivex.rxjava3.core.Single<T> apiCall) Calls the Open AI api, returns the response, and parses error messages if the request fails -
buildApi
-
defaultObjectMapper
public static com.fasterxml.jackson.databind.ObjectMapper defaultObjectMapper() -
defaultClient
-
defaultClient
-
defaultRetrofit
public static retrofit2.Retrofit defaultRetrofit(okhttp3.OkHttpClient client, com.fasterxml.jackson.databind.ObjectMapper mapper) -
listModels
-
getModel
-
createChatCompletion
gpt-4, gpt-4-0314, gpt-4-32k, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-0301 gpt-3.5-turbo-1006, gpt-4-1106-preview- Parameters:
request- create chat completion request- Returns:
- chat completion
-
createChatCompletion
public ChatCompletion createChatCompletion(CreateChatCompletionRequest request, Function<ChatCompletion, CreateChatCompletionRequest> toolCallsHandler) - Parameters:
request- create chat completion requesttoolCallsHandler- handle tool calls and then build the next request- Returns:
- chat completion
-
createSteamChatCompletion
public void createSteamChatCompletion(String requestId, CreateChatCompletionRequest request, @NonNull @NonNull StreamListener<ChatCompletion> listener) create chat completion by stream, user-side handled if there is tool_calls- Parameters:
requestId- request ID, every observer is uniquerequest- detail of requestlistener- StreamChatCompletionListener
-
createSteamChatCompletion
public void createSteamChatCompletion(String requestId, CreateChatCompletionRequest request, @NonNull @NonNull StreamListener<ChatCompletion> listener, BiFunction<String, ChatCompletion, StreamToolCallsRequest> toolCallsHandler) create chat completion by stream, sdk-side handled if there is tool_calls- Parameters:
requestId- request ID, every observer is uniquerequest- detail of requestlistener- StreamChatCompletionListenertoolCallsHandler- handle tool calls and then build the next request
-
createImage
-
createImageEdit
-
createImageVariation
-
createEmbeddings
text-embedding-ada-002, text-search-ada-doc-001- Parameters:
request- create Embedding request- Returns:
- create embedding response
-
createSpeech
@POST("/v1/audio/speech") public byte[] createSpeech(CreateSpeechRequest request) throws IOException Generates audio from the input text.- Parameters:
request- create speech request- Returns:
- audio file
- Throws:
IOException
-
createAudioTranscription
Transcribes audio into the input language. whisper-1Supported formats: ['flac', 'm4a', 'mp3', 'mp4', 'mpeg', 'mpga', 'oga', 'ogg', 'wav', 'webm']
- Parameters:
request- create audio transcription request- Returns:
- audio response
-
createAudioTranslation
whisper-1Supported formats: ['flac', 'm4a', 'mp3', 'mp4', 'mpeg', 'mpga', 'oga', 'ogg', 'wav', 'webm']
- Parameters:
request- create audio traslation request- Returns:
- audio
-
listFiles
-
uploadFile
-
uploadFile
-
deleteFile
-
retrieveFile
-
retrieveFileContent
- Parameters:
fileId- file id- Returns:
- file content
-
createModeration
text-moderation-stable, text-moderation-latest- Parameters:
request- create moderation request- Returns:
- moderation response
-
createFineTuningJob
Creates a job that fine-tunes a specified model from a given dataset.- Parameters:
request- CreateFineTuningJobRequest- Returns:
- A fine-tuning.job object.
-
retrieveFineTuningJob
Get info about a fine-tuning job.- Parameters:
fineTuningJobId- fineTuningJobId- Returns:
- The fine-tuning object with the given ID.
-
cancelFineTuningJob
Immediately cancel a fine-tune job.- Parameters:
fineTuningJobId- fineTuningJobId- Returns:
- The cancelled fine-tuning object.
-
listFineTuningEvents
public List<FineTuningJobEvent> listFineTuningEvents(String fineTuningJobId, String after, Integer limit) Get status updates for a fine-tuning job.- Parameters:
fineTuningJobId- fineTuningJobIdafter- Identifier for the last event from the previous pagination request.limit- Number of events to retrieve.- Returns:
- A list of fine-tuning event objects.
-
createBatch
Creates and executes a batch from an uploaded file of requests- Parameters:
request- create batch request- Returns:
- a batch object
-
retrieveBatch
Retrieves a batch.- Parameters:
batchId- batch id- Returns:
- a batch object
-
cancelBatch
Cancels an in-progress batch.- Parameters:
batchId- batch id- Returns:
- a batch object
-
listBatches
List your organization's batches.- Parameters:
after- A cursor for use in paginationlimit- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.- Returns:
- a list of batch
-
createAssistant
POST https://api.openai.com/v1/assistantsCreate an assistant with a model and instructions.
- Parameters:
request- Request body- Returns:
- An
Assistantobject.
-
retrieveAssistant
Retrieves an assistant.- Parameters:
assistantId- The ID of the assistant to retrieve.- Returns:
- The
Assistantobject matching the specified ID.
-
modifyAssistant
POST https://api.openai.com/v1/assistants/{assistant_id}Modifies an assistant.
- Parameters:
assistantId- The ID of the assistant to modify.request- Request body- Returns:
- The modified
Assistantobject.
-
deleteAssistant
DELETE https://api.openai.com/v1/assistants/{assistant_id}Delete an assistant.
- Parameters:
assistantId- The ID of the assistant to delete.- Returns:
- Deletion status
-
listAssistants
public OpenAiApiListResponse<Assistant> listAssistants(Integer limit, String order, String after, String before) GET https://api.openai.com/v1/assistantsReturns 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.order- Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.after- A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before- A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.- Returns:
- A list of
Assistantobjects.
-
listAssistants
-
createThread
POST https://api.openai.com/v1/threadsCreate thread
- Parameters:
request- Request body- Returns:
- An
Threadobject.
-
retrieveThread
GET https://api.openai.com/v1/threads/{thread_id}Retrieve thread
- Parameters:
threadId- The ID of the thread to retrieve.- Returns:
- The
Threadobject matching the specified ID.
-
modifyThread
GET https://api.openai.com/v1/threads/{thread_id}Modify thread
- Parameters:
threadId- The ID of the thread to modify. Only the metadata can be modified.request- Request body- Returns:
- The modified
Threadobject matching the specified ID.
-
deleteThread
DELETE https://api.openai.com/v1/threads/{thread_id}Delete thread
- Parameters:
threadId- The ID of the thread to delete.- Returns:
- Deletion status
-
createThreadMessage
POST https://api.openai.com/v1/threads/{thread_id}/messagesCreate message
-
retrieveThreadMessage
GET https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}Retrieve message
-
modifyThreadMessage
GET https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}Modify message
- Parameters:
threadId- The ID of the thread to which this message belongs.messageId- The ID of the message to modify.request- Request body- Returns:
- The modified
Messageobject.
-
listThreadMessages
public OpenAiApiListResponse<Message> listThreadMessages(String threadId, Integer limit, String order, String after, String before, String runId) GET https://api.openai.com/v1/threads/{thread_id}/messagesList messages
- Parameters:
threadId- The ID of theThreadthe messages belong to.limit- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order- Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.after- A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before- A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.runId- Filter messages by the run ID that generated them.- Returns:
- A list of
Messageobjects.
-
listThreadMessages
-
createThreadRun
POST https://api.openai.com/v1/threads/{thread_id}/runsCreate a run.
- Parameters:
threadId- The ID of the thread to run.request- Request body- Returns:
- An
Runobject.
-
createThreadRun
public void createThreadRun(String requestId, String threadId, CreateRunRequest request, @NonNull @NonNull StreamListener<IOpenAiApiObject> listener) POST https://api.openai.com/v1/threads/{thread_id}/runsCreate a run with stream = true.
- Parameters:
threadId- The ID of the thread to run.request- Request bodylistener- listener
-
retrieveThreadRun
GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}Retrieves a run.
-
modifyThreadRun
GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}Modify message
-
listThreadRuns
public OpenAiApiListResponse<Run> listThreadRuns(String threadId, Integer limit, String order, String after, String before) GET https://api.openai.com/v1/threads/{thread_id}/runsList messages
- Parameters:
threadId- The ID of theThreadthe messages belong to.limit- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order- Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.after- A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before- A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.- Returns:
- A list of
Runobjects.
-
listThreadRuns
-
submitToolOutputs
POST https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputs -
submitToolOutputs
public void submitToolOutputs(String requestId, String threadId, String runId, SubmitToolOutputsRequest request, @NonNull @NonNull StreamListener<IOpenAiApiObject> listener) POST https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputs- Parameters:
threadId- The ID of theThreadto which this run belongs.runId- The ID of the run that requires the tool output submission.request- Request bodylistener- stream event listener
-
cancelThreadRun
POST https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/cancelCancels a run that is in_progress.
- Parameters:
threadId- The ID of the thread to which this run belongs.runId- The ID of the run to cancel.- Returns:
- The modified
Runobject matching the specified ID.
-
createThreadAndRun
POST https://api.openai.com/v1/threads/runsCreate a thread and run it in one request.
- Parameters:
request- Request body- Returns:
- A
Runobject.
-
createThreadAndRun
public void createThreadAndRun(String requestId, CreateThreadAndRunRequest request, @NonNull @NonNull StreamListener<IOpenAiApiObject> listener) POST https://api.openai.com/v1/threads/runsCreate a thread and run it in one request with stream = true.
- Parameters:
request- Request body
-
retrieveThreadRunStep
GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/steps/{step_id}Retrieves a run step.
- Parameters:
threadId- The ID of the thread to which the run and run step belongs.runId- The ID of the run to which the run step belongs.stepId- The ID of the run step to retrieve.- Returns:
- The
RunStepobject matching the specified ID.
-
listThreadRunSteps
public OpenAiApiListResponse<RunStep> listThreadRunSteps(String threadId, String runId, Integer limit, String order, String after, String before) GET https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/stepsList run steps
- Parameters:
threadId- The ID of theThreadthe messages belong to.runId- The ID of the run steps belong to.limit- A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.order- Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.after- A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.before- A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.- Returns:
- A list of
RunStepobjects.
-
listThreadRunSteps
-
createVectorStore
invalid input: 'https://api.openai.com/v1/vector_stores <p> Create a vector store. @param request Request body @return An {@link VectorStore } object.' -
retrieveVectorStore
invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id} <p> Retrieves a vector store. @param vectorStoreId The ID of the vector store to retrieve. @return The {@link VectorStore} object matching the specified ID.' -
modifyVectorStore
invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id} <p> Modifies a vector store. @param vectorStoreId The ID of the vector store to modify. @param request Request body @return The modified {@link VectorStore} object.' -
deleteVectorStore
invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id} <p> Delete a vector store. @param vectorStoreId The ID of the vector store to delete. @return Deletion status' -
listVectorStores
public OpenAiApiListResponse<VectorStore> listVectorStores(Integer limit, String order, String after, String before) invalid input: 'https://api.openai.com/v1/vector_stores <p> List vector stores @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. @param after A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. @param before A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. @return A list of {@link VectorStore} objects.' -
listVectorStores
-
createVectorStoreFile
public VectorStoreFile createVectorStoreFile(String vectorStoreId, CreateVectorStoreFileRequest request) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/files <p> Create vector store file @param vectorStoreId The ID of the {@link VectorStore} for which to create a File. @param request Request body @return An {@link VectorStoreFile } object.' -
deleteVectorStoreFile
invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id} <p> Delete vector store file @param vectorStoreId The ID of the vector store that the file belongs to. @param fileId The ID of the file to delete. @return Deletion status' -
listVectorStoreFiles
public OpenAiApiListResponse<VectorStoreFile> listVectorStoreFiles(String vectorStoreId, Integer limit, String order, String after, String before, String filter) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/files <p> List vector store files @param vectorStoreId The ID of the vector store that the files belong to. @param filter Filter by file status. One of in_progress, completed, failed, cancelled of {@link xyz.felh.openai.assistant.vector.store.file.VectorStoreFile.Status}. @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. @param after A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. @param before A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. @return A list of {@link VectorStoreFile} objects.' -
listVectorStoreFiles
public OpenAiApiListResponse<VectorStoreFile> listVectorStoreFiles(String vectorStoreId, String filter) -
createVectorStoreFileBatch
public VectorStoreFileBatch createVectorStoreFileBatch(String vectorStoreId, CreateVectorStoreFileBatchRequest request) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches <p> Create a vector store file batch. @param vectorStoreId The ID of the vector store for which to create a File Batch. @param request Request body @return An {@link VectorStoreFileBatch } object.' -
retrieveVectorStoreFileBatch
invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id} <p> Retrieves a vector store file batch. @param vectorStoreId The ID of the vector store that the file batch belongs to. @param batchId The ID of the file batch being retrieved. @return The {@link VectorStoreFileBatch} object matching the specified ID.' -
cancelVectorStoreFileBatch
invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel <p> Cancel vector store file batch @param vectorStoreId The ID of the vector store that the file batch belongs to. @param batchId The ID of the file batch to cancel. @return The modified {@link VectorStoreFileBatch} object.' -
listVectorStoreFileBatches
public OpenAiApiListResponse<VectorStoreFileBatch> listVectorStoreFileBatches(String vectorStoreId, String batchId, Integer limit, String order, String after, String before, String filter) invalid input: 'https://api.openai.com/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}/files <p> List vector store files in a batchBeta @param vectorStoreId The ID of the vector store that the files belong to. @param limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. @param order Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. @param after A cursor for use in pagination. after 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 obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. @param before A cursor for use in pagination. before 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 obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. @param batchId The ID of the file batch that the files belong to. @param filter Filter by file status. One of in_progress, completed, failed, cancelled.{@link xyz.felh.openai.assistant.vector.store.file.batch.VectorStoreFileBatch.Status} @return A list of {@link VectorStoreFileBatch} objects.' -
listVectorStoreFileBatches
public OpenAiApiListResponse<VectorStoreFileBatch> listVectorStoreFileBatches(String vectorStoreId, String batchId, String filter)
-