Annotation Interface AiProvider.ModelConfig

Enclosing class:
AiProvider

@Target(TYPE) @Repeatable(ModelConfigs.class) public static @interface AiProvider.ModelConfig
Annotation used to define a configuration for a specific LangChain4j model class. This configuration is used during code generation for creating service bean providers and configuration blueprints.
Configuration example:

 langchain4j:
   # provider key
   open-ai:
     # model type
     chat-model:
       # properties introspected from
       api-key: api-key
       model-name: model-name
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    LangChain4j model class to be introspected for code-generated service bean providers.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the builder class associated with the LangChain4j model, for configuration introspection.
    Specifies a unique configuration key to identify the service provider for the associated LangChain4j model.
    Specifies property names or configurations to skip in the configuration blueprint.
    double
    Defines the weight of the generated model factory bean.
  • Element Details

    • value

      Class<?> value
      LangChain4j model class to be introspected for code-generated service bean providers.
      Returns:
      LangChain4j model class
    • builder

      Class<?> builder
      Specifies the builder class associated with the LangChain4j model, for configuration introspection.
      Returns:
      the builder class, or Void.class if no builder is specified.
      Default:
      java.lang.Void.class
    • skip

      String[] skip
      Specifies property names or configurations to skip in the configuration blueprint.
      Returns:
      an array of property names or configurations to exclude
      Default:
      {}
    • providerKey

      String providerKey
      Specifies a unique configuration key to identify the service provider for the associated LangChain4j model. If not specified, key is derived from the configuration parent class, example: OpenAiConfiguration.java -> open-ai
      Returns:
      the unique provider key, or an empty string if not specified.
      Default:
      ""
    • weight

      double weight
      Defines the weight of the generated model factory bean. A higher weight indicates higher significance.
      Returns:
      the weight value, default is Weighted.DEFAULT_WEIGHT in no constant of the double type is defined and annotated with AiProvider.DefaultWeight in the same class.
      Default:
      100.0