Record Class ModelProvider.FromConfig

Object
Record
akka.javasdk.agent.ModelProvider.FromConfig
Record Components:
configPath - the configuration path to read model settings from, empty for the path named by akka.javasdk.agent.model-provider
additionalModelRequestHeaders - extra HTTP headers, added to the headers of the provider that configPath resolves to
All Implemented Interfaces:
ModelProvider
Enclosing interface:
ModelProvider

public static record ModelProvider.FromConfig(String configPath, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) extends Record implements ModelProvider
A model provider selected by configuration, resolved when the agent makes the request.
  • Constructor Details

    • FromConfig

      public FromConfig(String configPath)
    • FromConfig

      public FromConfig(String configPath, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders)
      Creates an instance of a FromConfig record class.
      Parameters:
      configPath - the value for the configPath record component
      additionalModelRequestHeaders - the value for the additionalModelRequestHeaders record component
  • Method Details

    • withAdditionalModelRequestHeaders

      public ModelProvider.FromConfig withAdditionalModelRequestHeaders(List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders)
      Description copied from interface: ModelProvider
      Returns a copy of this provider with the given extra HTTP headers on every request to the model API. Use it for authentication tokens to an AI gateway or proxy, or for routing and tracing headers.

      For a provider built in code, the given headers replace whatever the configuration set for that provider. For ModelProvider.FromConfig, they are added to the headers of the provider that the configuration resolves to, and a header named in both takes the value given here.

      ModelProvider.Custom throws UnsupportedOperationException unless the implementation overrides this method.

      Specified by:
      withAdditionalModelRequestHeaders in interface ModelProvider
      Parameters:
      additionalModelRequestHeaders - the headers to add to each model request
      Returns:
      a copy of this provider carrying the given headers
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • configPath

      public String configPath()
      Returns the value of the configPath record component.
      Returns:
      the value of the configPath record component
    • additionalModelRequestHeaders

      public List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders()
      Returns the value of the additionalModelRequestHeaders record component.
      Returns:
      the value of the additionalModelRequestHeaders record component