ZennyKenny commited on
Commit
4eb802c
·
verified ·
1 Parent(s): bc2d97b

Create meta_prompt.py

Browse files
Files changed (1) hide show
  1. meta_prompt.py +26 -0
meta_prompt.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable
2
+
3
+ PROMPTS_SYS = {
4
+ "default": lambda base_text: (f"Below is an image of a document page along with its dimensions. "
5
+ f"Simply return the markdown representation of this document, presenting tables in markdown format as they naturally appear.\n"
6
+ f"If the document contains images, use a placeholder like dummy.png for each image.\n"
7
+ f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
8
+ f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"),
9
+ "structure": lambda base_text: (
10
+ f"Below is an image of a document page, along with its dimensions and possibly some raw textual content previously extracted from it. "
11
+ f"Note that the text extraction may be incomplete or partially missing. Carefully consider both the layout and any available text to reconstruct the document accurately.\n"
12
+ f"Your task is to return the markdown representation of this document, presenting tables in HTML format as they naturally appear.\n"
13
+ f"If the document contains images or figures, analyze them and include the tag <figure>IMAGE_ANALYSIS</figure> in the appropriate location.\n"
14
+ f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
15
+ f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"
16
+ ),
17
+ }
18
+
19
+ def get_prompt(prompt_name: str) -> Callable[[str], str]:
20
+ """
21
+ Fetches the system prompt based on the provided PROMPT_NAME.
22
+
23
+ :param prompt_name: The identifier for the desired prompt.
24
+ :return: The system prompt as a string.
25
+ """
26
+ return PROMPTS_SYS.get(prompt_name, lambda x: "Invalid PROMPT_NAME provided.")