org.devlive.sdk.openai.utils.EnumsUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openai-java-sdk Show documentation
Show all versions of openai-java-sdk Show documentation
Provides an easy-to-use SDK for Java developers to interact with the APIs of open AI models.
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;
}
}