Spaces:
Sleeping
Sleeping
williamagyapong
commited on
Update utility.py
Browse files- utility.py +13 -13
utility.py
CHANGED
@@ -82,13 +82,13 @@ def generateResponse(prompt,model='Meta-Llama-3.1-70B-Instruct'):
|
|
82 |
Details: as a sublist of the key details like name of item, quantity, cost price, currency, unit for the quantity, description, among other details you are able to extract.
|
83 |
"""
|
84 |
sample_single_transaction_template = """
|
85 |
-
The information provided indicates that you want to
|
86 |
-
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
-
|
92 |
- Item: Car
|
93 |
- Purpose: Business
|
94 |
- Quantity: 1
|
@@ -102,14 +102,14 @@ def generateResponse(prompt,model='Meta-Llama-3.1-70B-Instruct'):
|
|
102 |
sample_multi_transaction_template = """
|
103 |
The information provided indicates that you want to **create/record** a new transaction.
|
104 |
|
105 |
-
|
106 |
|
107 |
-
|
108 |
|
109 |
Transaction 1:
|
110 |
|
111 |
-
|
112 |
-
|
113 |
- Item: Car
|
114 |
- Purpose: Business
|
115 |
- Quantity: 1
|
@@ -121,8 +121,8 @@ def generateResponse(prompt,model='Meta-Llama-3.1-70B-Instruct'):
|
|
121 |
|
122 |
Transaction 2:
|
123 |
|
124 |
-
|
125 |
-
|
126 |
- Item: Office Chair
|
127 |
- Quantity: 2
|
128 |
- Unit: None
|
@@ -277,10 +277,10 @@ def read_datalake(user_phone, user_question):
|
|
277 |
|
278 |
inventory_list = [doc.to_dict() for doc in inventory_ref.stream()]
|
279 |
sales_list = [doc.to_dict() for doc in sales_ref.stream()]
|
280 |
-
|
281 |
inventory_df = pd.DataFrame(inventory_list)
|
282 |
sales_df = pd.DataFrame(sales_list)
|
283 |
-
|
284 |
|
285 |
lake = SmartDatalake([inventory_df, sales_df], config={"llm": llm, "response_parser": FlaskResponse, "enable_cache": False, "save_logs": False})
|
286 |
response = lake.chat(user_question)
|
|
|
82 |
Details: as a sublist of the key details like name of item, quantity, cost price, currency, unit for the quantity, description, among other details you are able to extract.
|
83 |
"""
|
84 |
sample_single_transaction_template = """
|
85 |
+
The information provided indicates that you want to *create/record* a new transaction.
|
86 |
+
*Extracted Information*:
|
87 |
|
88 |
+
*Intent*: Create
|
89 |
|
90 |
+
*Transaction Type*: Purchase
|
91 |
+
*Details*:
|
92 |
- Item: Car
|
93 |
- Purpose: Business
|
94 |
- Quantity: 1
|
|
|
102 |
sample_multi_transaction_template = """
|
103 |
The information provided indicates that you want to **create/record** a new transaction.
|
104 |
|
105 |
+
*Extracted Information*:
|
106 |
|
107 |
+
*Intent*: Create
|
108 |
|
109 |
Transaction 1:
|
110 |
|
111 |
+
*Transaction Type*: Purchase
|
112 |
+
*Details*:
|
113 |
- Item: Car
|
114 |
- Purpose: Business
|
115 |
- Quantity: 1
|
|
|
121 |
|
122 |
Transaction 2:
|
123 |
|
124 |
+
*Transaction Type*: Expense
|
125 |
+
*Details*:
|
126 |
- Item: Office Chair
|
127 |
- Quantity: 2
|
128 |
- Unit: None
|
|
|
277 |
|
278 |
inventory_list = [doc.to_dict() for doc in inventory_ref.stream()]
|
279 |
sales_list = [doc.to_dict() for doc in sales_ref.stream()]
|
280 |
+
|
281 |
inventory_df = pd.DataFrame(inventory_list)
|
282 |
sales_df = pd.DataFrame(sales_list)
|
283 |
+
return f"{inventory_df} \n\n {sales_df}"
|
284 |
|
285 |
lake = SmartDatalake([inventory_df, sales_df], config={"llm": llm, "response_parser": FlaskResponse, "enable_cache": False, "save_logs": False})
|
286 |
response = lake.chat(user_question)
|