vip11017 commited on
Commit
b7d42bc
Β·
1 Parent(s): 78c4063

Added the support and product functionality

Browse files
Files changed (2) hide show
  1. app/notebooks/rag_updated.ipynb +1 -1
  2. app/rag.py +41 -1
app/notebooks/rag_updated.ipynb CHANGED
@@ -343,7 +343,7 @@
343
  "name": "python",
344
  "nbconvert_exporter": "python",
345
  "pygments_lexer": "ipython3",
346
- "version": "3.13.5"
347
  }
348
  },
349
  "nbformat": 4,
 
343
  "name": "python",
344
  "nbconvert_exporter": "python",
345
  "pygments_lexer": "ipython3",
346
+ "version": "3.11.9"
347
  }
348
  },
349
  "nbformat": 4,
app/rag.py CHANGED
@@ -38,6 +38,7 @@ BLOGS_COLLECTION = "blogs"
38
  TECHNOLOGY_COLLECTION = "technology"
39
  REVOLUTION_COLLECTION = "revolution"
40
  SUPPORT_COLLECTION = "support"
 
41
 
42
 
43
  # %%
@@ -97,6 +98,45 @@ User Question:
97
  Response:
98
  """
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  @tool("Retrieve_Support")
101
  def retrieve_support(query: str) -> List[dict[str,str | float]]:
102
  """
@@ -284,7 +324,7 @@ def retrieve_revolution(query: str) -> List[dict[str,str | float]]:
284
  for doc, score in docs if score > 0.8]
285
 
286
  # %%
287
- all_tools = [retrieve_support, retrieve_faqs, retrieve_blogs, retrieve_technology, retrieve_revolution]
288
 
289
  tool_descriptions = "\n".join(f"{tool.name}: {tool.description}" for tool in all_tools)
290
  tool_names = ", ".join(tool.name for tool in all_tools)
 
38
  TECHNOLOGY_COLLECTION = "technology"
39
  REVOLUTION_COLLECTION = "revolution"
40
  SUPPORT_COLLECTION = "support"
41
+ PRODUCT_COLLECTION = "product"
42
 
43
 
44
  # %%
 
98
  Response:
99
  """
100
 
101
+ @tool("Retrieve_Products")
102
+ def retrieve_products(query: str) -> list[dict[str, str | float]]:
103
+ """
104
+ Retrieves detailed product information from Auro Wellness's product documentation.
105
+
106
+ Includes:
107
+ β€’ Product descriptions, benefits, and usage instructions
108
+ β€’ Ingredient details, formulation notes, and safety information
109
+ β€’ Bundles, sizes, and availability
110
+ β€’ High-level summaries of product features
111
+
112
+ Use this tool when the user asks about:
113
+ β€’ Specific product information ("What is Glutaryl Plus?", "How do I use Rise & Revive?")
114
+ β€’ Ingredients, benefits, or usage instructions
115
+ β€’ Product bundles, availability, or ordering details
116
+
117
+ Do NOT use this tool for:
118
+ β€’ Customer support, shipping, or policy questions β†’ use Retrieve_Support
119
+ β€’ General wellness education β†’ use Retrieve_Blogs
120
+ β€’ Technology/mechanism details β†’ use Retrieve_Technology
121
+ β€’ High-level company philosophy β†’ use Retrieve_Revolution
122
+ β€’ Short FAQs β†’ use Retrieve_FAQs
123
+
124
+ Prioritize this tool for questions explicitly about **products themselves**.
125
+ """
126
+
127
+ product_store = QdrantVectorStore(
128
+ client=client,
129
+ collection_name=PRODUCT_COLLECTION,
130
+ embedding=embeddings,
131
+ )
132
+
133
+ docs = product_store.similarity_search_with_score(query, k=5)
134
+ return [
135
+ {"content": doc.page_content, "score": score}
136
+ for doc, score in docs if score > 0.85
137
+ ]
138
+
139
+
140
  @tool("Retrieve_Support")
141
  def retrieve_support(query: str) -> List[dict[str,str | float]]:
142
  """
 
324
  for doc, score in docs if score > 0.8]
325
 
326
  # %%
327
+ all_tools = [retrieve_products, retrieve_support, retrieve_faqs, retrieve_blogs, retrieve_technology, retrieve_revolution]
328
 
329
  tool_descriptions = "\n".join(f"{tool.name}: {tool.description}" for tool in all_tools)
330
  tool_names = ", ".join(tool.name for tool in all_tools)