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

org.devlive.sdk.openai.utils.MultipartBodyUtils Maven / Gradle / Ivy

Go to download

Provides an easy-to-use SDK for Java developers to interact with the APIs of open AI models.

There is a newer version: 2024.01.3
Show newest version
package org.devlive.sdk.openai.utils;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

import java.io.File;

public class MultipartBodyUtils
{
    public static final MediaType TYPE = MediaType.parse("multipart/form-data");
    public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");

    private MultipartBodyUtils()
    {
    }

    public static MultipartBody.Part getPart(File image, String name)
    {
        RequestBody body = RequestBody.create(TYPE, image);
        return MultipartBody.Part.createFormData(name, image.getName(), body);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy