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

org.devlive.sdk.openai.utils.EnumsUtils 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 org.devlive.sdk.openai.model.CompletionModel;
import org.devlive.sdk.openai.model.MessageModel;

import java.util.Arrays;
import java.util.Optional;

public class EnumsUtils
{
    private EnumsUtils()
    {
    }

    public static CompletionModel getCompleteModel(final String name)
    {
        Optional optional = Arrays.stream(CompletionModel.values())
                .filter(item -> item.getName().equals(name))
                .findFirst();
        return optional.isPresent() ? optional.get() : null;
    }

    public static MessageModel getCompleteMessageModel(final String name)
    {
        Optional optional = Arrays.stream(MessageModel.values())
                .filter(item -> item.getName().equals(name))
                .findFirst();
        return optional.isPresent() ? optional.get() : null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy