public interface OpenAIApiService
| 限定符和类型 | 方法和说明 |
|---|---|
FineTune |
cancelFineTune(String fineTuneId)
|
CreateAnswerResponse |
createAnswer(CreateAnswerRequest createAnswerRequest)
openaai doc
`
POST /answers
Answers the specified question using the provided documents and examples.
|
CreateChatCompletionResponse |
createChatCompletion(CreateChatCompletionRequest createChatCompletionRequest)
openaai doc
POST /chat/completions
Creates a completion for the chat message
为聊天消息创建一个 completions
|
CreateClassificationResponse |
createClassification(CreateClassificationRequest createClassificationRequest)
openaai doc
POST /classifications
Classifies the specified `query` using provided examples.
|
CreateCompletionResponse |
createCompletion(CreateCompletionRequest createCompletionRequest)
openaai doc
POST /completions
Creates a completion for the provided prompt and parameters
为提供的提示和参数创建完成
|
CreateEditResponse |
createEdit(CreateEditRequest createEditRequest)
openaai doc
POST /edits
Creates a new edit for the provided input, instruction, and parameters.
|
CreateEmbeddingResponse |
createEmbedding(CreateEmbeddingRequest createEmbeddingRequest)
|
OpenAIFile |
createFile(File file,
String purpose) |
FineTune |
createFineTune(CreateFineTuneRequest createFineTuneRequest)
openaai doc
POST /fine-tunes
Creates a job that fine-tunes a specified model from a given dataset.
|
ImagesResponse |
createImage(CreateImageRequest createImageRequest)
openaai doc
POST /images/generations
Creates an image given a prompt.
|
default ImagesResponse |
createImageEdit(File image,
String prompt) |
ImagesResponse |
createImageEdit(File image,
String prompt,
File mask,
Number n,
String size,
String responseFormat,
String user) |
default ImagesResponse |
createImageVariation(File image) |
ImagesResponse |
createImageVariation(File image,
Number n,
String size,
String responseFormat,
String user) |
CreateModerationResponse |
createModeration(CreateModerationRequest createModerationRequest)
openaai doc
POST /moderations
Classifies if text violates OpenAI\'s Content Policy
如果文本违反OpenAI\的内容策略,则进行分类
|
CreateSearchResponse |
createSearch(String engineId,
CreateSearchRequest createSearchRequest)
已过时。
|
default CreateTranscriptionResponse |
createTranscription(File file,
String model) |
CreateTranscriptionResponse |
createTranscription(File file,
String model,
String prompt,
String responseFormat,
Number temperature,
String language) |
default CreateTranslationResponse |
createTranslation(File file,
String model) |
CreateTranslationResponse |
createTranslation(File file,
String model,
String prompt,
String responseFormat,
Number temperature) |
DeleteFileResponse |
deleteFile(String fileId) |
DeleteModelResponse |
deleteModel(String model) |
String |
downloadFile(String fileId) |
ListEnginesResponse |
listEngines()
已过时。
|
ListFilesResponse |
listFiles() |
default ListFineTuneEventsResponse |
listFineTuneEvents(String fineTuneId) |
ListFineTuneEventsResponse |
listFineTuneEvents(String fineTuneId,
Boolean stream) |
ListFineTunesResponse |
listFineTunes()
openaai doc
GET /fine-tunes
List your organization\'s fine-tuning jobs
|
ListModelsResponse |
listModels()
openaai doc
GET /models
Lists the currently available models, and provides basic information about each one such as the owner and availability.
|
Engine |
retrieveEngine(String engineId)
已过时。
|
OpenAIFile |
retrieveFile(String fileId)
openaai doc
GET /files/{file_id}
Returns information about a specific file.
|
FineTune |
retrieveFineTune(String fineTuneId)
openaai doc
GET /fine-tunes/{fine_tune_id}
Gets info about the fine-tune job.
|
Model |
retrieveModel(String model)
openaai doc
GET /models/{model}
Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
|
FineTune cancelFineTune(String fineTuneId) throws OpenaiException
fineTuneId - fineTuneId要取消的微调作业的ID
POST /fine-tunes/{fine_tune_id}/cancel
Immediately cancel a fine-tune job.
立即取消微调作业。
OpenaiException - OpenaiExceptionCreateAnswerResponse createAnswer(CreateAnswerRequest createAnswerRequest) throws OpenaiException
POST /answers
Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
使用提供的文档和示例回答指定的问题。端点首先对提供的文档或文件进行[搜索](/docs/api reference/searchs)以查找相关上下文。相关上下文与提供的示例和问题相结合,以创建[完成](/docs/api reference/completions)的提示。
OpenaiExceptionCreateChatCompletionResponse createChatCompletion(CreateChatCompletionRequest createChatCompletionRequest) throws OpenaiException
OpenaiExceptionCreateCompletionResponse createCompletion(CreateCompletionRequest createCompletionRequest) throws OpenaiException
POST /completions
Creates a completion for the provided prompt and parameters为提供的提示和参数创建完成
OpenaiExceptionListModelsResponse listModels() throws OpenaiException
GET /models
Lists the currently available models, and provides basic information about each one such as the owner and availability.列出当前可用的型号,并提供每个型号的基本信息,
OpenaiExceptionCreateClassificationResponse createClassification(CreateClassificationRequest createClassificationRequest) throws OpenaiException
POST /classifications
Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.OpenaiExceptionCreateEditResponse createEdit(CreateEditRequest createEditRequest) throws OpenaiException
POST /edits
Creates a new edit for the provided input, instruction, and parameters.OpenaiExceptionCreateEmbeddingResponse createEmbedding(CreateEmbeddingRequest createEmbeddingRequest) throws OpenaiException
OpenaiExceptionOpenAIFile createFile(File file, String purpose) throws OpenaiException
file - Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) 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](/docs/guides/fine-tuning/prepare-training-data).purpose - The intended purpose of the uploaded documents. Use \\\"fine-tune\\\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.OpenaiExceptionFineTune createFineTune(CreateFineTuneRequest createFineTuneRequest) throws OpenaiException
POST /fine-tunes
Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)OpenaiExceptionImagesResponse createImage(CreateImageRequest createImageRequest) throws OpenaiException
OpenaiExceptionImagesResponse createImageEdit(File image, String prompt, File mask, Number n, String size, String responseFormat, String user) throws OpenaiException
image - The image to edit. 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(s). The maximum length is 1000 characters.mask - An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.n - The number of images to generate. Must be between 1 and 10.size - The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.responseFormat - The format in which the generated images are returned. Must be one of `url` or `b64_json`.user - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).OpenaiExceptiondefault ImagesResponse createImageEdit(File image, String prompt) throws OpenaiException
OpenaiExceptionImagesResponse createImageVariation(File image, Number n, String size, String responseFormat, String user) throws OpenaiException
image - The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.n - The number of images to generate. Must be between 1 and 10.size - The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.responseFormat - The format in which the generated images are returned. Must be one of `url` or `b64_json`.user - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).OpenaiExceptiondefault ImagesResponse createImageVariation(File image) throws OpenaiException
OpenaiExceptionCreateModerationResponse createModeration(CreateModerationRequest createModerationRequest) throws OpenaiException
POST /moderations
Classifies if text violates OpenAI\'s Content Policy 如果文本违反OpenAI\的内容策略,则进行分类OpenaiException@Deprecated CreateSearchResponse createSearch(String engineId, CreateSearchRequest createSearchRequest) throws OpenaiException
engineId - engineId The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
POST /engines/{engine_id}/search
The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query. openaai docOpenaiExceptionCreateTranscriptionResponse createTranscription(File file, String model, String prompt, String responseFormat, Number temperature, String language) throws OpenaiException
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.prompt - An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.responseFormat - The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.temperature - The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.language - The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency.
Transcribes audio into the input language.
openaai doc
POST /audio/transcriptions "Content-Type: multipart/form-data"
创建听录OpenaiExceptiondefault CreateTranscriptionResponse createTranscription(File file, String model) throws OpenaiException
OpenaiExceptionCreateTranslationResponse createTranslation(File file, String model, String prompt, String responseFormat, Number temperature) throws OpenaiException
file - file The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.model - model ID of the model to use. Only `whisper-1` is currently available.prompt - An optional text to guide the model\\\'s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.responseFormat - The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.temperature - The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
openaai doc
POST /audio/translations ['Content-Type'] = 'multipart/form-data'
翻译 Translates audio into into English.
OpenaiExceptiondefault CreateTranslationResponse createTranslation(File file, String model) throws OpenaiException
OpenaiExceptionDeleteFileResponse deleteFile(String fileId) throws OpenaiException
fileId - The ID of the file to use for this request
openaai doc
DELETE /files/{file_id}
Delete a file.OpenaiExceptionDeleteModelResponse deleteModel(String model) throws OpenaiException
model - model The model to delete
openaai doc
DELETE /models/{model}
Delete a fine-tuned model. You must have the Owner role in your organization.OpenaiExceptionString downloadFile(String fileId) throws OpenaiException
fileId - The ID of the file to use for this requestGET /files/{file_id}/content
Returns the contents of the specified fileOpenaiException@Deprecated ListEnginesResponse listEngines() throws OpenaiException
GET /engines
Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability.OpenaiExceptionListFilesResponse listFiles() throws OpenaiException
GET /files
Returns a list of files that belong to the user\'s organization.OpenaiExceptionListFineTuneEventsResponse listFineTuneEvents(String fineTuneId, Boolean stream) throws OpenaiException
fineTuneId - The ID of the fine-tune job to get events for.stream - Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a `data: [DONE]` message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
openaai doc
GET /fine-tunes/{fine_tune_id}/events
Get fine-grained status updates for a fine-tune job.OpenaiExceptiondefault ListFineTuneEventsResponse listFineTuneEvents(String fineTuneId) throws OpenaiException
OpenaiExceptionListFineTunesResponse listFineTunes() throws OpenaiException
GET /fine-tunes
List your organization\'s fine-tuning jobsOpenaiException@Deprecated Engine retrieveEngine(String engineId) throws OpenaiException
engineId - The ID of the engine to use for this request
openaai doc
GET /engines/{engine_id}
Retrieves a model instance, providing basic information about it such as the owner and availability.OpenaiExceptionOpenAIFile retrieveFile(String fileId) throws OpenaiException
GET /files/{file_id}
Returns information about a specific file.fileId - The ID of the file to use for this requestOpenaiExceptionFineTune retrieveFineTune(String fineTuneId) throws OpenaiException
GET /fine-tunes/{fine_tune_id}
Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)fineTuneId - The ID of the fine-tune jobOpenaiExceptionModel retrieveModel(String model) throws OpenaiException
GET /models/{model}
Retrieves a model instance, providing basic information about the model such as the owner and permissioning.model - The ID of the model to use for this requestOpenaiExceptionCopyright © 2023. All rights reserved.