Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -98,9 +98,14 @@ class ShoppingAssistant:
|
|
| 98 |
def _process_text(self, text: str, mobile: str) -> dict:
|
| 99 |
"""Process text input using Gemini"""
|
| 100 |
response = text_model.generate_content(
|
| 101 |
-
f"""
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
)
|
| 105 |
analysis = json.loads(response.text)
|
| 106 |
return self._match_products(analysis.get('products', []), mobile)
|
|
|
|
| 98 |
def _process_text(self, text: str, mobile: str) -> dict:
|
| 99 |
"""Process text input using Gemini"""
|
| 100 |
response = text_model.generate_content(
|
| 101 |
+
f"""As a retail shopping assistant, analyze this request and extract shopping context,
|
| 102 |
+
specific products needed, pick only one item per product extracted
|
| 103 |
+
unless the user specifies the amount or number of items for a particular product.
|
| 104 |
+
If the user specifies budget make sure your suggest is within that budget.
|
| 105 |
+
|
| 106 |
+
If a user suggest a scenario planning a dinner, planning a party, I want to clean my car etc, be analytic and creative
|
| 107 |
+
and suggest appropriate product
|
| 108 |
+
Request: {text}"""
|
| 109 |
)
|
| 110 |
analysis = json.loads(response.text)
|
| 111 |
return self._match_products(analysis.get('products', []), mobile)
|