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

io.quarkiverse.langchain4j.runtime.tool.JsonObjectSchemaObjectSubstitution Maven / Gradle / Ivy

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

import java.util.List;
import java.util.Map;

import dev.langchain4j.model.chat.request.json.JsonObjectSchema;
import dev.langchain4j.model.chat.request.json.JsonSchemaElement;
import io.quarkus.runtime.ObjectSubstitution;
import io.quarkus.runtime.annotations.RecordableConstructor;

public class JsonObjectSchemaObjectSubstitution
        implements ObjectSubstitution {
    @Override
    public Serialized serialize(JsonObjectSchema obj) {
        return new Serialized(obj.description(), obj.properties(), obj.required(), obj.additionalProperties(),
                obj.definitions());
    }

    @Override
    public JsonObjectSchema deserialize(Serialized obj) {
        return JsonObjectSchema.builder()
                .description(obj.description)
                .properties(obj.properties)
                .required(obj.required)
                .additionalProperties(obj.additionalProperties)
                .definitions(obj.definitions)
                .build();
    }

    public record Serialized(String description, Map properties, List required,
            Boolean additionalProperties, Map definitions) {
        @RecordableConstructor
        public Serialized {
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy