Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/extractors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ${content}
`;

if (dataToEnrich) {
promptTemplate += `Format: JSON
promptTemplate += `Original JSON object:
---
${JSON.stringify(dataToEnrich, null, 2)}
------
Expand All @@ -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

`;
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/extractors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down