All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.devlive.sdk.common.DefaultApi Maven / Gradle / Ivy

package org.devlive.sdk.common;

import io.reactivex.Single;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import org.devlive.sdk.openai.entity.ChatEntity;
import org.devlive.sdk.openai.entity.CompletionEntity;
import org.devlive.sdk.openai.entity.EditEntity;
import org.devlive.sdk.openai.entity.EmbeddingEntity;
import org.devlive.sdk.openai.entity.FileEntity;
import org.devlive.sdk.openai.entity.FineTuningEntity;
import org.devlive.sdk.openai.entity.ImageEntity;
import org.devlive.sdk.openai.entity.ModelEntity;
import org.devlive.sdk.openai.entity.ModerationEntity;
import org.devlive.sdk.openai.entity.UserKeyEntity;
import org.devlive.sdk.openai.entity.beta.AssistantsEntity;
import org.devlive.sdk.openai.entity.beta.AssistantsFileEntity;
import org.devlive.sdk.openai.entity.beta.ThreadEntity;
import org.devlive.sdk.openai.response.AudioResponse;
import org.devlive.sdk.openai.response.ChatResponse;
import org.devlive.sdk.openai.response.CompleteResponse;
import org.devlive.sdk.openai.response.EditResponse;
import org.devlive.sdk.openai.response.EmbeddingResponse;
import org.devlive.sdk.openai.response.FileResponse;
import org.devlive.sdk.openai.response.FineTuningResponse;
import org.devlive.sdk.openai.response.ImageResponse;
import org.devlive.sdk.openai.response.ModelResponse;
import org.devlive.sdk.openai.response.ModerationResponse;
import org.devlive.sdk.openai.response.UserKeyResponse;
import org.devlive.sdk.openai.response.beta.AssistantsFileResponse;
import org.devlive.sdk.openai.response.beta.AssistantsResponse;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Url;

import java.util.Map;

public interface DefaultApi
{
    /**
     * Lists the currently available models
     */
    @GET
    Single fetchModels(@Url String url);

    /**
     * Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
     *
     * @param model The ID of the model to use for this request
     */
    @GET(value = "v1/models/{model}")
    Single fetchModel(@Path("model") String model);

    /**
     * Creates a completion for the provided prompt and parameters.
     */
    @POST
    Single fetchCompletions(@Url String url,
            @Body CompletionEntity configure);

    /**
     * Fetches the completions for PaLM.
     *
     * @param url the URL to fetch the completions from
     * @param configure the configuration entity for the completions
     * @return the complete response containing the fetched completions
     */
    @POST
    Single fetchPaLMCompletions(@Url String url,
            @Body org.devlive.sdk.openai.entity.google.CompletionEntity configure);

    /**
     * Fetches the PaLM Chat data from the specified URL.
     *
     * @param url the URL to fetch the data from
     * @param configure the configuration of the chat entity
     * @return a Single object representing the complete response
     */
    @POST
    Single fetchPaLMChat(@Url String url,
            @Body org.devlive.sdk.openai.entity.google.ChatEntity configure);

    /**
     * Creates a model response for the given chat conversation.
     */
    @POST
    Single fetchChatCompletions(@Url String url,
            @Body ChatEntity configure);

    /**
     * Get all keys
     */
    @GET(value = "dashboard/user/api_keys")
    Single fetchUserAPIKeys();

    /**
     * Create a key for the given
     */
    @POST(value = "dashboard/user/api_keys")
    Single fetchCreateUserAPIKey(@Body UserKeyEntity configure);

    /**
     * Creates an image given a prompt.
     */
    @POST
    Single fetchImagesGenerations(@Url String url,
            @Body ImageEntity configure);

    /**
     * Creates an edited or extended image given an original image and a prompt.
     */
    @POST
    @Multipart
    Single fetchImagesEdits(@Url String url,
            @Part() MultipartBody.Part image,
            @Part() MultipartBody.Part mask,
            @PartMap Map configure);

    /**
     * Creates a variation of a given image.
     */
    @POST
    @Multipart
    Single fetchImagesVariations(@Url String url,
            @Part() MultipartBody.Part image,
            @PartMap Map configure);

    /**
     * Creates an embedding vector representing the input text.
     */
    @POST
    Single fetchEmbeddings(@Url String url,
            @Body EmbeddingEntity configure);

    /**
     * Transcribes audio into the input language.
     * 将音频转录为输入语言。
     */
    @POST
    @Multipart
    Single fetchAudioTranscriptions(@Url String url,
            @Part() MultipartBody.Part audio,
            @PartMap Map configure);

    /**
     * Classifies if text violates OpenAI's Content Policy
     * 对文本是否违反 OpenAI 的内容政策进行分类
     */
    @POST
    Single fetchModerations(@Url String url,
            @Body ModerationEntity configure);

    /**
     * Creates a new edit for the provided input, instruction, and parameters.
     * 为提供的输入、指令和参数创建新的编辑。
     */
    @POST
    Single fetchEdits(@Url String url,
            @Body EditEntity configure);

    /**
     * Returns a list of files that belong to the user's organization.
     * 返回属于用户组织的文件列表。
     */
    @GET
    Single fetchFiles(@Url String url);

    /**
     * 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 us if you need to increase the storage limit.
     * 上传包含要在各种端点/功能之间使用的文档的文件。目前,一个组织上传的所有文件大小最大可达1GB。如果您需要增加存储限制,请联系我们。
     */
    @POST
    @Multipart
    Single fetchUploadFile(@Url String url,
            @Part() MultipartBody.Part file,
            @PartMap Map configure);

    /**
     * Delete a file.
     * 删除文件。
     */
    @DELETE
    Single fetchDeleteFile(@Url String url);

    /**
     * Returns information about a specific file.
     * 返回有关特定文件的信息。
     */
    @GET
    Single fetchRetrieveFile(@Url String url);

    /**
     * Returns the contents of the specified file
     * 返回指定文件的内容
     */
    @GET
    Single fetchRetrieveFileContent(@Url String url);

    /**
     * List your organization's fine-tuning jobs
     * 列出组织的微调作业
     */
    @GET
    Single fetchFineTuningJobs(@Url String url);

    /**
     * Creates a job that fine-tunes a specified model from a given dataset.
     * 创建一个作业,用于微调给定数据集中的指定模型。
     */
    @POST
    Single fetchCreateFineTuningJob(@Url String url,
            @Body FineTuningEntity configure);

    /**
     * Get status updates for a fine-tuning job.
     * 获取微调作业的状态更新。
     */
    @GET
    Single fetchFineTuningJobEvents(@Url String url);

    /**
     * Get info about a fine-tuning job.
     * 获取有关微调作业的信息。
     */
    @GET
    Single fetchFineTuningJobContent(@Url String url);

    /**
     * Immediately cancel a fine-tune job.
     * 立即取消微调作业。
     */
    @POST
    Single fetchCancelFineTuningJob(@Url String url);

    /**
     * Create an assistant with a model and instructions.
     * 创建具有模型和说明的助手。
     */
    @POST
    Single fetchCreateAssistants(@Url String url,
            @Body AssistantsEntity configure);

    /**
     * Create an assistant file by attaching a File to an assistant.
     * 通过将文件附加到助手来创建助手文件。
     */
    @POST
    Single fetchCreateAssistantFile(@Url String url,
            @Body Map configure);

    /**
     * Returns a list of assistants.
     * 返回助手列表。
     */
    @GET
    Single fetchAssistants(@Url String url);

    /**
     * Returns a list of assistant files.
     * 返回助手文件的列表。
     */
    @GET
    Single fetchAssistantFiles(@Url String url);

    /**
     * Retrieves an assistant.
     * 检索助手。
     */
    @GET
    Single fetchRetrieveAssistant(@Url String url);

    /**
     * Retrieves an AssistantFile.
     * 检索助手文件。
     */
    @GET
    Single fetchRetrieveAssistantFile(@Url String url);

    /**
     * Modifies an assistant.
     * 修改助手。
     */
    @POST
    Single fetchUpdateAssistant(@Url String url,
            @Body AssistantsEntity configure);

    /**
     * Delete an assistant.
     * 删除助手
     */
    @DELETE
    Single fetchDeleteAssistant(@Url String url);

    /**
     * Delete assistant file
     * 删除助手文件
     */
    @DELETE
    Single fetchDeleteAssistantFile(@Url String url);

    /**
     * Create a thread.
     * 创建线程。
     */
    @POST
    Single fetchCreateThread(@Url String url,
            @Body ThreadEntity configure);

    /**
     * Retrieves a thread.
     * 检索线程。
     */
    @GET
    Single fetchRetrieveThread(@Url String url);

    /**
     * Modifies a thread.
     * 修改线程。
     */
    @POST
    Single fetchUpdateThread(@Url String url,
            @Body ThreadEntity configure);

    /**
     * Deletes a thread.
     * 删除线程。
     */
    @DELETE
    Single fetchDeleteThread(@Url String url);
}