Class ServiceOutputParser

java.lang.Object
dev.langchain4j.service.output.ServiceOutputParser

public class ServiceOutputParser extends Object
  • Constructor Details

    • ServiceOutputParser

      public ServiceOutputParser()
  • Method Details

    • parse

      public Object parse(ChatResponse chatResponse, Type returnType)
    • parseText

      public Object parseText(Type returnType, String text)
    • jsonSchema

      public Optional<JsonSchema> jsonSchema(Type returnType)
    • outputFormatInstructions

      public String outputFormatInstructions(Type returnType)
    • isReturnedAsIs

      public static boolean isReturnedAsIs(Class<?> type)
      Whether the given raw class is a LangChain4j type (e.g. ChatResponse) that AI Services take from the model response themselves, without asking the LLM to produce it. For such types, no output format instructions and no JSON schema are sent to the LLM. Image return types are detected separately.