Skip to content

Commit

Permalink
Added instructions for empty string to extract prompts (#1114)
Browse files Browse the repository at this point in the history
* added instructions to extract prompts

* getting back the null for not strings
  • Loading branch information
rafaelsideguide authored Jan 30, 2025
1 parent 68d3baa commit 948f786
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/api/src/lib/extract/build-prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function buildBatchExtractSystemPrompt(
): string {
return (
(systemPrompt ? `${systemPrompt}\n` : "") +
`Always prioritize using the provided content to answer the question. Do not make up an answer. Do not hallucinate. Be concise and follow the schema always if provided. If the document provided is not relevant to the prompt nor to the final user schema ${JSON.stringify(multiEntitySchema)}, return null. Here are the urls the user provided of which he wants to extract information from: ` +
`Always prioritize using the provided content to answer the question. Do not make up an answer. Do not hallucinate. In case you can't find the information and the string is required, instead of 'N/A' or 'Not speficied', return an empty string: '', if it's not a string and you can't find the information, return null. Be concise and follow the schema always if provided. If the document provided is not relevant to the prompt nor to the final user schema ${JSON.stringify(multiEntitySchema)}, return null. Here are the urls the user provided of which he wants to extract information from: ` +
links.join(", ")
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/lib/extract/completions/singleAnswer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function singleAnswerCompletion({
mode: "llm",
systemPrompt:
(systemPrompt ? `${systemPrompt}\n` : "") +
"Always prioritize using the provided content to answer the question. Do not make up an answer. Do not hallucinate. Return 'null' the property that you don't find the information. Be concise and follow the schema always if provided. Here are the urls the user provided of which he wants to extract information from: " +
"Always prioritize using the provided content to answer the question. Do not make up an answer. Do not hallucinate. In case you can't find the information and the string is required, instead of 'N/A' or 'Not speficied', return an empty string: '', if it's not a string and you can't find the information, return null. Be concise and follow the schema always if provided. Here are the urls the user provided of which he wants to extract information from: " +
links.join(", "),
prompt: "Today is: " + new Date().toISOString() + "\n" + prompt,
schema: rSchema,
Expand Down

0 comments on commit 948f786

Please sign in to comment.