Class SolrLargeLanguageModel

java.lang.Object
org.apache.solr.languagemodels.model.SolrLanguageModel
org.apache.solr.languagemodels.model.SolrLargeLanguageModel
All Implemented Interfaces:
org.apache.lucene.util.Accountable

public class SolrLargeLanguageModel extends SolrLanguageModel implements org.apache.lucene.util.Accountable
This object wraps a ChatModel given a prompt and a ResponseFormat. It's meant to be used as a managed resource with the LargeLanguageModelStore
  • Constructor Details

    • SolrLargeLanguageModel

      public SolrLargeLanguageModel(String name, dev.langchain4j.model.chat.ChatModel chatModel, Map<String,Object> params)
  • Method Details

    • getInstance

      public static SolrLargeLanguageModel getInstance(SolrResourceLoader solrResourceLoader, String className, String name, Map<String,Object> params) throws LanguageModelException
      Throws:
      LanguageModelException
    • generate

      public String generate(String prompt, dev.langchain4j.model.chat.request.ResponseFormat responseFormat)
      Sends a structured chat request to the language model and returns the raw text response.
      Parameters:
      prompt - the user prompt to send to the language model
      responseFormat - the format specification that instructs the model to produce structured JSON output
      Returns:
      the raw text response from the language model
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.apache.lucene.util.Accountable
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getModelClassName

      public String getModelClassName()
      Description copied from class: SolrLanguageModel
      Returns the class name of the underlying langchain4j model instance.
      Specified by:
      getModelClassName in class SolrLanguageModel