Record Class ResponseFormatSchemas

java.lang.Object
java.lang.Record
io.micronaut.langchain4j.jsonschema.ResponseFormatSchemas
Record Components:
schemas - The schemas by name
All Implemented Interfaces:
Function<dev.langchain4j.model.chat.request.ChatRequest, dev.langchain4j.model.chat.request.ChatRequest>, UnaryOperator<dev.langchain4j.model.chat.request.ChatRequest>

@Internal public record ResponseFormatSchemas(Map<String, dev.langchain4j.model.chat.request.json.JsonSchema> schemas) extends Record implements UnaryOperator<dev.langchain4j.model.chat.request.ChatRequest>
The JSON schemas of the structured outputs of one AI service or agent, keyed by the name LangChain4j gives the schema of the response format (the simple name of the return type, or List_of_<Type> for a list).

Applied to a ChatRequest, it replaces the schema LangChain4j derived reflectively with the provided one.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ResponseFormatSchemas(Map<String, dev.langchain4j.model.chat.request.json.JsonSchema> schemas)
    Creates an instance of a ResponseFormatSchemas record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.langchain4j.model.chat.request.ChatRequest
    apply(dev.langchain4j.model.chat.request.ChatRequest chatRequest)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Map<String, dev.langchain4j.model.chat.request.json.JsonSchema>
    Returns the value of the schemas record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface Function

    andThen, compose
  • Constructor Details

    • ResponseFormatSchemas

      public ResponseFormatSchemas(Map<String, dev.langchain4j.model.chat.request.json.JsonSchema> schemas)
      Creates an instance of a ResponseFormatSchemas record class.
      Parameters:
      schemas - the value for the schemas record component
  • Method Details

    • apply

      public dev.langchain4j.model.chat.request.ChatRequest apply(dev.langchain4j.model.chat.request.ChatRequest chatRequest)
      Specified by:
      apply in interface Function<dev.langchain4j.model.chat.request.ChatRequest, dev.langchain4j.model.chat.request.ChatRequest>
    • 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.
    • schemas

      public Map<String, dev.langchain4j.model.chat.request.json.JsonSchema> schemas()
      Returns the value of the schemas record component.
      Returns:
      the value of the schemas record component