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

io.github.sinri.AiOnHttpMix.azure.openai.chatgpt.chunk.OpenAIResponseChunkImpl Maven / Gradle / Ivy

package io.github.sinri.AiOnHttpMix.azure.openai.chatgpt.chunk;

import io.github.sinri.keel.core.json.UnmodifiableJsonifiableEntityImpl;
import io.vertx.core.json.JsonObject;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

class OpenAIResponseChunkImpl extends UnmodifiableJsonifiableEntityImpl implements OpenAIResponseChunk {
    public OpenAIResponseChunkImpl(@NotNull JsonObject jsonObject) {
        super(jsonObject);
    }

    @Override
    public @NotNull List getChoices() {
        List list = new ArrayList<>();

        List choices = readJsonObjectArray("choices");
        if (choices != null) {
            choices.forEach(jsonObject -> {
                OpenAIChatGptResponseChunkChoiceImpl x = new OpenAIChatGptResponseChunkChoiceImpl(jsonObject);
                list.add(x);
            });
        }
        return list;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy