Package dev.langchain4j.adaptiverag
Record Class QuestionRewriter
java.lang.Object
java.lang.Record
dev.langchain4j.adaptiverag.QuestionRewriter
This class implements a
Function to rewrite questions for better vectorstore retrieval.
It uses an AI language model to rephrase input questions based on semantic intent and meaning.-
Constructor Summary
ConstructorsConstructorDescriptionQuestionRewriter(String openApiKey) Creates an instance of aQuestionRewriterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionApplies a natural language processing pipeline to improve a given question.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theopenApiKeyrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
QuestionRewriter
Creates an instance of aQuestionRewriterrecord class.- Parameters:
openApiKey- the value for theopenApiKeyrecord component
-
-
Method Details
-
apply
Applies a natural language processing pipeline to improve a given question. This method uses a ChatModel with specified configuration and an LLMService to generate and invoke a new, improved question based on the provided input. -
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
openApiKey
Returns the value of theopenApiKeyrecord component.- Returns:
- the value of the
openApiKeyrecord component
-