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

io.quarkiverse.langchain4j.runtime.QuarkusServiceOutputParser Maven / Gradle / Ivy

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

import static dev.langchain4j.service.TypeUtils.getRawClass;

import java.lang.reflect.Type;

import dev.langchain4j.service.output.ServiceOutputParser;
import io.smallrye.mutiny.Multi;

public class QuarkusServiceOutputParser extends ServiceOutputParser {

    @Override
    public String outputFormatInstructions(Type returnType) {
        Class rawClass = getRawClass(returnType);
        if (Multi.class.equals(rawClass)) {
            // when Multi is used as the return type, Multi is the only supported type, thus we don't need want any formatting instructions
            return "";
        }
        return super.outputFormatInstructions(returnType);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy