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

dev.langchain4j.model.ollama.Message Maven / Gradle / Ivy

There is a newer version: 0.36.0
Show newest version
package dev.langchain4j.model.ollama;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.List;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(NON_NULL)
@JsonNaming(SnakeCaseStrategy.class)
class Message {

    private Role role;
    private String content;
    private List images;
    private List toolCalls;

    Message() {
    }

    public Message(Role role, String content, List images, List toolCalls) {
        this.role = role;
        this.content = content;
        this.images = images;
        this.toolCalls = toolCalls;
    }

    static Builder builder() {
        return new Builder();
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public List getImages() {
        return images;
    }

    public void setImages(List images) {
        this.images = images;
    }

    public List getToolCalls() {
        return toolCalls;
    }

    public void setToolCalls(List toolCalls) {
        this.toolCalls = toolCalls;
    }

    static class Builder {

        private Role role;
        private String content;
        private List images;
        private List toolCalls;

        Builder role(Role role) {
            this.role = role;
            return this;
        }

        Builder content(String content) {
            this.content = content;
            return this;
        }

        Builder images(List images) {
            this.images = images;
            return this;
        }

        Builder toolCalls(List toolCalls) {
            this.toolCalls = toolCalls;
            return this;
        }

        Message build() {
            return new Message(role, content, images, toolCalls);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy