From 399455ac1bf7c2bde60e45f3b060b1f2169c4564 Mon Sep 17 00:00:00 2001 From: Andrew Zhong Date: Tue, 13 May 2025 14:01:40 -0700 Subject: [PATCH 1/3] init --- src/extractors.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 `; From 6da3b4f1beeefc7a9f7f6a327b75cf04c426042a Mon Sep 17 00:00:00 2001 From: Andrew Zhong Date: Tue, 13 May 2025 14:48:14 -0700 Subject: [PATCH 2/3] fix unit test --- tests/unit/extractors.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/extractors.test.ts b/tests/unit/extractors.test.ts index b0f6da3..dbc50c7 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" From 26461f9064c0aa297ad8b537a17deb1fb38f229d Mon Sep 17 00:00:00 2001 From: Andrew Zhong Date: Tue, 13 May 2025 14:50:06 -0700 Subject: [PATCH 3/3] fixed unit test --- tests/unit/extractors.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/extractors.test.ts b/tests/unit/extractors.test.ts index dbc50c7..a27d4db 100644 --- a/tests/unit/extractors.test.ts +++ b/tests/unit/extractors.test.ts @@ -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"