diff --git a/src/extractors.ts b/src/extractors.ts index df04083..4160fde 100644 --- a/src/extractors.ts +++ b/src/extractors.ts @@ -104,7 +104,7 @@ ${content} `; if (dataToEnrich) { - promptTemplate += `Format: JSON + promptTemplate += `Original JSON object: --- ${JSON.stringify(dataToEnrich, null, 2)} ------ @@ -116,9 +116,9 @@ Your task is: ${extractionTask} ## Guidelines: 1. Extract ONLY information explicitly stated in the context 2. Enrich the original JSON object with information from the context -3. Fill additional fields based on relevant information in the context -4. Do not make assumptions or infer missing data -5. Leave fields empty when information is not present or you are uncertain +3. Do not remove any fields from the original JSON object +4. Only update existing fields and fill in additional fields if new and relevant information is available in the context +5. Do not make assumptions or infer missing data 6. Do not include information that appears incomplete or truncated `; diff --git a/tests/unit/extractors.test.ts b/tests/unit/extractors.test.ts index b0f6da3..a27d4db 100644 --- a/tests/unit/extractors.test.ts +++ b/tests/unit/extractors.test.ts @@ -306,7 +306,7 @@ describe("extractors", () => { expect(prompt).toContain("Context information is below:"); expect(prompt).toContain("Format: markdown"); expect(prompt).toContain("Some markdown content"); - expect(prompt).toContain("Format: JSON"); + expect(prompt).toContain("Original JSON object"); expect(prompt).toContain(JSON.stringify(dataToEnrich, null, 2)); expect(prompt).toContain( "You are a data extraction assistant that extracts structured information from the above context in markdown and JSON" @@ -315,7 +315,7 @@ describe("extractors", () => { "Enrich the original JSON object with information from the context" ); expect(prompt).toContain( - "Fill additional fields based on relevant information in the context" + "Only update existing fields and fill in additional fields if new and relevant information is available in the context" ); expect(prompt).toContain( "Return only the structured data in valid JSON format"