Skip to content

Commit 1b950e2

Browse files
authored
Update enrich prompt (#12)
1 parent f59f390 commit 1b950e2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/extractors.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ${content}
104104
`;
105105

106106
if (dataToEnrich) {
107-
promptTemplate += `Format: JSON
107+
promptTemplate += `Original JSON object:
108108
---
109109
${JSON.stringify(dataToEnrich, null, 2)}
110110
------
@@ -116,9 +116,9 @@ Your task is: ${extractionTask}
116116
## Guidelines:
117117
1. Extract ONLY information explicitly stated in the context
118118
2. Enrich the original JSON object with information from the context
119-
3. Fill additional fields based on relevant information in the context
120-
4. Do not make assumptions or infer missing data
121-
5. Leave fields empty when information is not present or you are uncertain
119+
3. Do not remove any fields from the original JSON object
120+
4. Only update existing fields and fill in additional fields if new and relevant information is available in the context
121+
5. Do not make assumptions or infer missing data
122122
6. Do not include information that appears incomplete or truncated
123123
124124
`;

tests/unit/extractors.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe("extractors", () => {
306306
expect(prompt).toContain("Context information is below:");
307307
expect(prompt).toContain("Format: markdown");
308308
expect(prompt).toContain("Some markdown content");
309-
expect(prompt).toContain("Format: JSON");
309+
expect(prompt).toContain("Original JSON object");
310310
expect(prompt).toContain(JSON.stringify(dataToEnrich, null, 2));
311311
expect(prompt).toContain(
312312
"You are a data extraction assistant that extracts structured information from the above context in markdown and JSON"
@@ -315,7 +315,7 @@ describe("extractors", () => {
315315
"Enrich the original JSON object with information from the context"
316316
);
317317
expect(prompt).toContain(
318-
"Fill additional fields based on relevant information in the context"
318+
"Only update existing fields and fill in additional fields if new and relevant information is available in the context"
319319
);
320320
expect(prompt).toContain(
321321
"Return only the structured data in valid JSON format"

0 commit comments

Comments
 (0)