You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/next/src/content/docs/llamaindex/modules/prompt/index.mdx
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,14 +28,21 @@ Answer:`;
28
28
29
29
### 1. Customizing the default prompt on initialization
30
30
31
-
The first method is to create a new instance of `ResponseSynthesizer`(or the module you would like to update the prompt) and pass the custom prompt to the `responseBuilder` parameter. Then, pass the instance to the `asQueryEngine` method of the index.
31
+
The first method is to create a new instance of a Response Synthesizer (or the module you would like to update the prompt) by using the getResponseSynthesizer function. Instead of passing the custom prompt to the deprecated responseBuilder parameter, call getResponseSynthesizer with the mode as the first argument and supply the new prompt via the options parameter.
Copy file name to clipboardExpand all lines: apps/next/src/content/docs/llamaindex/modules/response_synthesizer.mdx
+12-9Lines changed: 12 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: ResponseSynthesizer
2
+
title: Response Synthesizer
3
3
---
4
4
5
5
The ResponseSynthesizer is responsible for sending the query, nodes, and prompt templates to the LLM to generate a response. There are a few key modes for generating a response:
@@ -12,15 +12,17 @@ The ResponseSynthesizer is responsible for sending the query, nodes, and prompt
12
12
multiple compact prompts. The same as `refine`, but should result in less LLM calls.
13
13
-`TreeSummarize`: Given a set of text chunks and the query, recursively construct a tree
14
14
and return the root node as the response. Good for summarization purposes.
15
-
-`SimpleResponseBuilder`: Given a set of text chunks and the query, apply the query to each text
16
-
chunk while accumulating the responses into an array. Returns a concatenated string of all
17
-
responses. Good for when you need to run the same query separately against each text
18
-
chunk.
15
+
-`MultiModal`: Combines textual inputs with additional modality-specific metadata to generate an integrated response.
16
+
It leverages a text QA template to build a prompt that incorporates various input types and produces either streaming or complete responses.
17
+
This approach is ideal for use cases where enriching the answer with multi-modal context (such as images, audio, or other data)
Copy file name to clipboardExpand all lines: packages/core/src/response-synthesizers/factory.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ import {
23
23
}from"./base-synthesizer";
24
24
import{createMessageContent}from"./utils";
25
25
26
-
constresponseModeSchema=z.enum([
26
+
exportconstresponseModeSchema=z.enum([
27
27
"refine",
28
28
"compact",
29
29
"tree_summarize",
@@ -35,7 +35,7 @@ export type ResponseMode = z.infer<typeof responseModeSchema>;
35
35
/**
36
36
* A response builder that uses the query to ask the LLM generate a better response using multiple text chunks.
37
37
*/
38
-
classRefineextendsBaseSynthesizer{
38
+
exportclassRefineextendsBaseSynthesizer{
39
39
textQATemplate: TextQAPrompt;
40
40
refineTemplate: RefinePrompt;
41
41
@@ -213,7 +213,7 @@ class Refine extends BaseSynthesizer {
213
213
/**
214
214
* CompactAndRefine is a slight variation of Refine that first compacts the text chunks into the smallest possible number of chunks.
215
215
*/
216
-
classCompactAndRefineextendsRefine{
216
+
exportclassCompactAndRefineextendsRefine{
217
217
asyncgetResponse(
218
218
query: MessageContent,
219
219
nodes: NodeWithScore[],
@@ -267,7 +267,7 @@ class CompactAndRefine extends Refine {
267
267
/**
268
268
* TreeSummarize repacks the text chunks into the smallest possible number of chunks and then summarizes them, then recursively does so until there's one chunk left.
269
269
*/
270
-
classTreeSummarizeextendsBaseSynthesizer{
270
+
exportclassTreeSummarizeextendsBaseSynthesizer{
271
271
summaryTemplate: TreeSummarizePrompt;
272
272
273
273
constructor(
@@ -370,7 +370,7 @@ class TreeSummarize extends BaseSynthesizer {
0 commit comments