aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ChatBox/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/ChatBox/tools')
-rw-r--r--src/client/views/nodes/ChatBox/tools/RAGTool.ts52
1 files changed, 18 insertions, 34 deletions
diff --git a/src/client/views/nodes/ChatBox/tools/RAGTool.ts b/src/client/views/nodes/ChatBox/tools/RAGTool.ts
index 4b29d6bce..c7175326c 100644
--- a/src/client/views/nodes/ChatBox/tools/RAGTool.ts
+++ b/src/client/views/nodes/ChatBox/tools/RAGTool.ts
@@ -22,7 +22,7 @@ export class RAGTool extends BaseTool<{ hypothetical_document_chunk: string }> {
1. Overall Structure:
<answer>
- [Main content with nested grounded_text tags]
+ [Main content with grounded_text tags interspersed with normal plain text (information that is not derived from chunks' information)]
<citations>
[Individual citation tags]
</citations>
@@ -33,21 +33,8 @@ export class RAGTool extends BaseTool<{ hypothetical_document_chunk: string }> {
2. Grounded Text Tag Structure:
- Basic format:
- <grounded_text citation_index="[index number(s)]">
- [Your generated text based on chunk information]
- </grounded_text>
-
- - Nested format:
- <grounded_text citation_index="[index number(s)]">
- [General information]
- <grounded_text citation_index="[index number(s)]">
- [More specific information]
- </grounded_text>
- </grounded_text>
-
- - Multiple citation indices:
- <grounded_text citation_index="1,2,3">
- [Information synthesized from multiple chunks]
+ <grounded_text citation_index="[citation index number(s)]">
+ [Your generated text based on information from a subset of a chunk (a citation's direct text)]
</grounded_text>
3. Citation Tag Structure:
@@ -58,12 +45,11 @@ export class RAGTool extends BaseTool<{ hypothetical_document_chunk: string }> {
4. Detailed Grounded Text Guidelines:
a. Wrap all information derived from chunks in grounded_text tags.
- b. Nest grounded_text tags when presenting hierarchical or increasingly specific information or when a larger section of generated text is best grounded by one subset of a chunk and smaller sections of that generated text are best grounded by other subsets of either the same or different chunk(s).
- c. Use a single grounded_text tag for closely related information that references the same citation (subset of text from a chunk).
- d. Combine multiple citation indices for synthesized information from multiple citations.
- e. Ensure every grounded_text tag has at least one corresponding citation.
- f. Grounded text can be as short as a few words or as long as several sentences.
- d. Avoid overlapping grounded_text tags; instead, use nesting or sequential tags.
+ b. DO NOT PUT ANYTHING THAT IS NOT DIRECTLY DERIVED FROM INFORMATION FROM CHUNKS (EITHER IMAGE, TABLE, OR TEXT) IN GROUNDED_TEXT TAGS.
+ c. Use a single grounded_text tag for suquential and closely related information that references the same citation. If other citations' information are used sequentially, create new grounded_text tags.
+ d. Ensure every grounded_text tag has up to a few corresponding citations (should not be more than 3 and only 1 is fine). Multiple citation indices should be separated by commas.
+ e. Grounded text can be as short as a few words or as long as several sentences.
+ f. Avoid overlapping or nesting grounded_text tags; instead, use sequential tags.
5. Detailed Citation Guidelines:
a. Create a unique citation for each distinct piece of information from the chunks that is used to support grounded_text.
@@ -71,35 +57,33 @@ export class RAGTool extends BaseTool<{ hypothetical_document_chunk: string }> {
c. Specify the correct type: "text", "image", or "table".
d. For text chunks, include only the relevant subset of the original text that the grounded_text is based on.
e. For image/table chunks, leave the citation content empty.
- f. One citation can be used for multiple grounded_text tags if they are based on the same information.
- g. One text chunk can have multiple citations if different parts of the text have different important information.
- h. !!!DO NOT OVERCITE - only include citations for information that is directly relevant to the grounded_text.
+ f. One citation can be used for multiple grounded_text tags if they are based on the same chunk information.
+ g. !!!DO NOT OVERCITE - only include citations for information that is directly relevant to the grounded_text.
6. Structural Integrity Checks:
a. Ensure all opening tags have corresponding closing tags.
b. Verify that all grounded_text tags have valid citation_index attributes.
c. Check that all cited indices in grounded_text tags have corresponding citations.
- d. Confirm proper nesting - tags opened last should be closed first.
Example of grounded_text usage:
<answer>
<grounded_text citation_index="1,2">
Artificial Intelligence (AI) is revolutionizing various sectors, with healthcare experiencing significant transformations in areas such as diagnosis and treatment planning.
- <grounded_text citation_index="2,3,4">
- In the field of medical diagnosis, AI has shown remarkable capabilities, particularly in radiology. For instance, AI systems have drastically improved mammogram analysis, achieving 99% accuracy at a rate 30 times faster than human radiologists.
- <grounded_text citation_index="4">
- This advancement not only enhances the efficiency of healthcare systems but also significantly reduces the occurrence of false positives, leading to fewer unnecessary biopsies and reduced patient stress.
- </grounded_text>
- </grounded_text>
</grounded_text>
-
+ <grounded_text citation_index="2,3,4">
+ In the field of medical diagnosis, AI has shown remarkable capabilities, particularly in radiology. For instance, AI systems have drastically improved mammogram analysis, achieving 99% accuracy at a rate 30 times faster than human radiologists.
+ </grounded_text>
+ <grounded_text citation_index="4">
+ This advancement not only enhances the efficiency of healthcare systems but also significantly reduces the occurrence of false positives, leading to fewer unnecessary biopsies and reduced patient stress.
+ </grounded_text>
+
<grounded_text citation_index="5,6">
Beyond diagnosis, AI is playing a crucial role in drug discovery and development. By analyzing vast amounts of genetic and molecular data, AI algorithms can identify potential drug candidates much faster than traditional methods.
+ </grounded_text>
<grounded_text citation_index="6">
This could potentially reduce the time and cost of bringing new medications to market, especially for rare diseases that have historically received less attention due to limited market potential.
</grounded_text>
- </grounded_text>
[... rest of the content ...]