Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
* @author Timo Salm
* @author Ilayaperumal Gopinathan
* @author Thomas Vitale
* @author Yanming Zhou
* @since 1.0.0
*/
public class QuestionAnswerAdvisor implements BaseAdvisor {
Expand Down Expand Up @@ -82,6 +83,12 @@ public class QuestionAnswerAdvisor implements BaseAdvisor {

private final int order;

/**
* Construct instance by given VectorStore
* @param vectorStore the given VectorStore
* @deprecated in favor of {@link #builder(VectorStore)}}
*/
@Deprecated
public QuestionAnswerAdvisor(VectorStore vectorStore) {
this(vectorStore, SearchRequest.builder().build(), DEFAULT_PROMPT_TEMPLATE, BaseAdvisor.DEFAULT_SCHEDULER,
DEFAULT_ORDER);
Expand Down Expand Up @@ -122,8 +129,9 @@ public ChatClientRequest before(ChatClientRequest chatClientRequest, AdvisorChai
Map<String, Object> context = new HashMap<>(chatClientRequest.context());
context.put(RETRIEVED_DOCUMENTS, documents);

String documentContext = documents == null ? ""
: documents.stream().map(Document::getText).collect(Collectors.joining(System.lineSeparator()));
String documentContext = documents.stream()
.map(Document::getText)
.collect(Collectors.joining(System.lineSeparator()));

// 3. Augment the user prompt with the document context.
UserMessage userMessage = chatClientRequest.prompt().getUserMessage();
Expand Down