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

io.quarkiverse.langchain4j.ollama.runtime.jackson.RoleDeserializer Maven / Gradle / Ivy

There is a newer version: 0.21.0
Show newest version
package io.quarkiverse.langchain4j.ollama.runtime.jackson;

import java.io.IOException;
import java.util.Locale;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

import io.quarkiverse.langchain4j.ollama.Role;

public class RoleDeserializer extends StdDeserializer {
    public RoleDeserializer() {
        super(Role.class);
    }

    @Override
    public Role deserialize(JsonParser jp, DeserializationContext deserializationContext)
            throws IOException, JacksonException {
        return Role.valueOf(jp.getValueAsString().toUpperCase(Locale.ROOT));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy