Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

FEAT - Add Default Prompt (#106)

Tahier Hussaind9dab3dd8402
diff --git a/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx b/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx
index f0b2379d3..f1e70f4ba 100644
--- a/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx
+++ b/frontend/src/components/custom-tools/document-manager/DocumentManager.jsx
@@ -40,7 +40,7 @@ try {
require("../../../plugins/summarize-tab/SummarizeTab").tabLabel;
if (tabLabel) {
items.push({
- key: 3,
+ key: "3",
label: tabLabel,
});
}
diff --git a/frontend/src/components/custom-tools/pre-and-post-amble-modal/DefaultPrompts.json b/frontend/src/components/custom-tools/pre-and-post-amble-modal/DefaultPrompts.json
new file mode 100644
index 000000000..cd6833a7d
--- /dev/null
+++ b/frontend/src/components/custom-tools/pre-and-post-amble-modal/DefaultPrompts.json
@@ -0,0 +1,4 @@
+{
+ "preamble": "Your ability to extract and summarize this information accurately is essential for effective contract analysis, negotiation, and dispute resolution in the legal field. Pay close attention to the contract's language, structure, and any cross-references to ensure a comprehensive and precise extraction of information. Do not use prior knowledge or information from outside the context to answer the questions. Only use the information provided in the context to answer the questions.",
+ "postamble": "Do not include any explanation in the reply. Only include the extracted information in the reply."
+}
diff --git a/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx b/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx
index 268852a76..1d29186eb 100644
--- a/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx
+++ b/frontend/src/components/custom-tools/pre-and-post-amble-modal/PreAndPostAmbleModal.jsx
@@ -1,4 +1,4 @@
-import { Input, Space, Typography } from "antd";
+import { Button, Input, Space, Typography } from "antd";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
import "./PreAndPostAmbleModal.css";
@@ -8,6 +8,7 @@ import { useCustomToolStore } from "../../../store/custom-tool-store";
import { CustomButton } from "../../widgets/custom-button/CustomButton";
import { useExceptionHandler } from "../../../hooks/useExceptionHandler";
import SpaceWrapper from "../../widgets/space-wrapper/SpaceWrapper";
+import DefaultPrompts from "./DefaultPrompts.json";
const fieldNames = {
preamble: "PREAMBLE",
@@ -24,16 +25,27 @@ function PreAndPostAmbleModal({ type, handleUpdateTool }) {
useEffect(() => {
if (type === fieldNames.preamble) {
setTitle("Preamble");
- setText(details?.preamble || "");
+ setText(details?.preamble || DefaultPrompts.preamble);
return;
}
if (type === fieldNames.postamble) {
setTitle("Postamble");
- setText(details?.postamble || "");
+ setText(details?.postamble || DefaultPrompts.postamble);
}
}, [type]);
+ const setDefaultPrompt = () => {
+ if (type === fieldNames.preamble) {
+ setText(DefaultPrompts.preamble);
+ return;
+ }
+
+ if (type === fieldNames.postamble) {
+ setText(DefaultPrompts.postamble);
+ }
+ };
+
const handleSave = () => {
const body = {};
if (type === fieldNames.preamble) {
@@ -77,10 +89,13 @@ function PreAndPostAmbleModal({ type, handleUpdateTool }) {
</div>
<div>
<Input.TextArea
- rows={3}
+ rows={4}
value={text}
onChange={(e) => setText(e.target.value)}
/>
+ <Button size="small" type="link" onClick={setDefaultPrompt}>
+ Add default prompt
+ </Button>
</div>
<div className="display-flex-right">
<Space>