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

me.zhangjh.gemini.pojo.ChatContent Maven / Gradle / Ivy

The newest version!
package me.zhangjh.gemini.pojo;

import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * @author [email protected]
 * @date 21:00 2023/12/23
 * @Description
 */
@Data
public class ChatContent {

    private String role;

    private List parts;

    /**
     * non multiTurnChat chat doesn't need role
     * */
    public static ChatContent buildBySingleText(String text) {
        ChatContent content = new ChatContent();
        content.setParts(Collections.singletonList(new TextPart(text)));
        return content;
    }

    public static ChatContent buildBySingleText(String text, String role) {
        ChatContent content = new ChatContent();
        content.setRole(role);
        content.setParts(Collections.singletonList(new TextPart(text)));
        return content;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy