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-
Field Summary
Fields inherited from class org.apache.solr.languagemodels.model.SolrLanguageModel
MAX_RETRIES_PARAM, name, params, TIMEOUT_PARAMFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
ConstructorsConstructorDescriptionSolrLargeLanguageModel(String name, dev.langchain4j.model.chat.ChatModel chatModel, Map<String, Object> params) -
Method Summary
Modifier and TypeMethodDescriptionbooleanSends a structured chat request to the language model and returns the raw text response.static SolrLargeLanguageModelgetInstance(SolrResourceLoader solrResourceLoader, String className, String name, Map<String, Object> params) Returns the class name of the underlying langchain4j model instance.inthashCode()longtoString()Methods inherited from class org.apache.solr.languagemodels.model.SolrLanguageModel
getName, getParamsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Constructor Details
-
SolrLargeLanguageModel
-
-
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 modelresponseFormat- the format specification that instructs the model to produce structured JSON output- Returns:
- the raw text response from the language model
-
toString
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
hashCode
public int hashCode() -
equals
-
getModelClassName
Description copied from class:SolrLanguageModelReturns the class name of the underlying langchain4j model instance.- Specified by:
getModelClassNamein classSolrLanguageModel
-