Spaces:
Sleeping
Sleeping
Update services/utils.py
Browse files- services/utils.py +3 -2
services/utils.py
CHANGED
@@ -65,14 +65,15 @@ def strcuture_document_data(raw_text:str)->dict:
|
|
65 |
# )
|
66 |
|
67 |
doc_query= (
|
68 |
-
"
|
|
|
69 |
)
|
70 |
|
71 |
parser = PydanticOutputParser(pydantic_object=Candidate)
|
72 |
|
73 |
prompt = PromptTemplate(
|
74 |
template="""Your primary goal is to take my receipt OCR text and then return back a parsable json.
|
75 |
-
Below is the receipt OCR:.\n {raw_text} \n These are the format instructions telling you to convert the data into json :\n {format_instructions}\n Follow the below instrcution very strictly:\n {query} \n""",
|
76 |
input_variables=["query"],
|
77 |
partial_variables={"format_instructions": parser.get_format_instructions(),"raw_text":raw_text},
|
78 |
)
|
|
|
65 |
# )
|
66 |
|
67 |
doc_query= (
|
68 |
+
"Extract and return strictly a JSON object containing only the following keys: brand, total_cost, location, purchase_category, brand_category, Date.
|
69 |
+
Ensure that if a value is not present in the OCR text, it is returned as null."
|
70 |
)
|
71 |
|
72 |
parser = PydanticOutputParser(pydantic_object=Candidate)
|
73 |
|
74 |
prompt = PromptTemplate(
|
75 |
template="""Your primary goal is to take my receipt OCR text and then return back a parsable json.
|
76 |
+
Below is the receipt OCR:.\n {raw_text} \n These are the format instructions telling you to convert the data into json :\n {format_instructions}\nDo not include descriptions or explanations from the Candidate class in the JSON output. The response must be a valid JSON object.\n Follow the below instrcution very strictly:\n {query} \n""",
|
77 |
input_variables=["query"],
|
78 |
partial_variables={"format_instructions": parser.get_format_instructions(),"raw_text":raw_text},
|
79 |
)
|