The easy-to-use OpenAi Java SDK 1.4.0 is released

Recommend a set of full-platform data (database management tools) developed based on SpringBoot. The functions are relatively complete. It is recommended to download and use: github.com/EdurtIO/datacap currently supports more than 40+ data sources. The first project in China to apply ChatGPT to the data management system.

OpenAI Java SDK mainly provides an easy-to-use SDK for Java developers to interact with OpenAI's API.

Support for creating images

ImageEntity configure=ImageEntity.builder()
        .prompt("Create a bus")
        .build();
client.createImages(configure)

Support image editing

String file=this.getClass().getResource("/logo.png").getFile();
ImageEntity configure=ImageEntity.builder()
        .prompt("Add hello to image")
        .image(new File(file))
        .isEdit(Boolean.TRUE)
        .build();
client.editImages(configure);

Supports image variants

String file=this.getClass().getResource("/logo.png").getFile();
ImageEntity configure=ImageEntity.builder()
        .image(new File(file))
        .isVariation(Boolean.TRUE)
        .build();
client.variationsImages(configure);

Support Embeddings

EmbeddingEntity configure=EmbeddingEntity.builder()
        .model("text-similarity-ada-001")
        .input("Hello OpenAi Java SDK")
        .build();
client.createEmbeddings(configure);

how to use?

<properties>
    <openai.version>LATEST</openai.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.devlive.sdk</groupId>
        <artifactId>openai-java-sdk</artifactId>
        <version>${openai.version}</version>
    </dependency>
</dependencies>

LATEST The latest version will be used by default.

Guess you like

Origin www.oschina.net/news/248878/openai-java-sdk-1-4-0