Class NativeImageMetadataVisitor

java.lang.Object
io.micronaut.langchain4j.processor.NativeImageMetadataVisitor
All Implemented Interfaces:
io.micronaut.core.order.Ordered, io.micronaut.core.util.Toggleable, io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>

@Internal public final class NativeImageMetadataVisitor extends Object implements io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
Writes the GraalVM native image metadata (META-INF/native-image/.../reachability-metadata.json) of the types LangChain4j still reads and implements reflectively: the AI service interfaces, which LangChain4j implements with Proxy and whose methods, annotations and parameters it reads reflectively, and the agentic services and agents, which LangChain4j also implements with proxies combining the agent type with its own interfaces and whose static @Agent, @Output, @ExitCondition, ... methods it invokes reflectively.

The metadata also covers the structured outputs of the services and agents and the parameters and results of the tools, whose JSON schema LangChain4j derives from their fields. Tool classes themselves need no metadata: their @Tool methods are invoked through their Micronaut ExecutableMethod.

Since:
2.4.0
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.micronaut.inject.visitor.TypeElementVisitor

    io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind
     
    void
    visitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder

    Methods inherited from interface io.micronaut.core.util.Toggleable

    isEnabled

    Methods inherited from interface io.micronaut.inject.visitor.TypeElementVisitor

    finish, getClassType, getElementType, getSupportedOptions, query, start, visitConstructor, visitEnumConstant, visitField, visitMethod
  • Constructor Details

    • NativeImageMetadataVisitor

      public NativeImageMetadataVisitor()
  • Method Details

    • getSupportedAnnotationNames

      public Set<String> getSupportedAnnotationNames()
      Specified by:
      getSupportedAnnotationNames in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
    • getVisitorKind

      public io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind getVisitorKind()
      Specified by:
      getVisitorKind in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
    • visitClass

      public void visitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context)
      Specified by:
      visitClass in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>