Omkar008 commited on
Commit
99b959a
1 Parent(s): c85ed09

Update services/utils.py

Browse files
Files changed (1) hide show
  1. services/utils.py +6 -0
services/utils.py CHANGED
@@ -45,6 +45,7 @@ def strcuture_document_data(raw_text:str)->dict:
45
  "Extract and return a JSON object containing only the key entities from the provided receipt. "
46
  "\nReceipt Data:\n" + raw_text
47
  )
 
48
  parser = PydanticOutputParser(pydantic_object=Candidate)
49
 
50
  prompt = PromptTemplate(
@@ -55,7 +56,12 @@ def strcuture_document_data(raw_text:str)->dict:
55
  input = prompt.format_prompt(query=doc_query)
56
  with get_openai_callback() as cb:
57
  result = model(input.to_string())
 
 
 
58
  result = extract_json_from_string(result)
 
 
59
  class_object= parser.parse(result)
60
  dict_object=class_object.__dict__
61
  print("printing structured json")
 
45
  "Extract and return a JSON object containing only the key entities from the provided receipt. "
46
  "\nReceipt Data:\n" + raw_text
47
  )
48
+ print(raw_text)
49
  parser = PydanticOutputParser(pydantic_object=Candidate)
50
 
51
  prompt = PromptTemplate(
 
56
  input = prompt.format_prompt(query=doc_query)
57
  with get_openai_callback() as cb:
58
  result = model(input.to_string())
59
+
60
+
61
+ logging.info(f"GPT Response {result}")
62
  result = extract_json_from_string(result)
63
+ logging.info(f"Formatted Response : {result}")
64
+
65
  class_object= parser.parse(result)
66
  dict_object=class_object.__dict__
67
  print("printing structured json")