Aryan Jain commited on
Commit
46d624e
Β·
1 Parent(s): f698c44

add main.py for server initialization; update file handling in DatabaseUpdater and improve context retrieval in ToolCall

Browse files
main.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ if __name__ == "__main__":
2
+ import uvicorn
3
+
4
+ uvicorn.run("src.app:app", host="0.0.0.0", port=8000, reload=False)
sifars.md CHANGED
@@ -129,92 +129,92 @@
129
  "They are very competent and reasonable with their pricing. The platform functions well without any bugs. Sifars is a highly deadline-oriented, communicative group."
130
 
131
 
132
- ## Projects
133
  **Our Portfolio Embraces Apex and Extraordinary Projects**
134
 
135
  ### Hoora
136
- *Introducing Hoora, the avant-garde multi-tenant employee management app redefining workplace efficiency. Hoora comes equipped with an advanced AI chatbot that not only provides information but actively assists employees across various organizational aspects. Seamlessly integrating with your database and organizational files, Hoora's AI chatbot streamlines tasks, offers real-time information, and ensures a more productive and engaged workforce.*
137
 
138
  ---
139
 
140
  ### Elevate.AI
141
- *Welcome to Elevate.AI, where cutting-edge technology meets personalized real estate solutions. Elevate.AI is a revolutionary project designed to seamlessly connect with potential real estate clients through the familiar and convenient platform of WhatsApp. Acting as your virtual human assistant, Elevate.AI employs advanced artificial intelligence to engage, generate leads, and schedule appointments with clients, making your real estate business more efficient and customer-centric.*
142
 
143
  ---
144
 
145
  ### Adamo
146
- *Personalized nutrition, wellness tips, travel insights, and more. Upcoming features include prompt and image generators, seamless social media integration, and a media center. Boost business productivity with AI integration. Welcome to Adamo – where possibilities abound.*
147
 
148
  ---
149
 
150
  ### SalesBod
151
- *A Chrome extension empowered with AI capabilities that helps salespeople gain information about companies and individuals. It enables salespeople to compose emails with a single prompt and generate POV. Additionally, it provides access to a user admin panel where users can manage their histories and company information related to executed prompts.*
152
 
153
  ---
154
 
155
  ### Travelidu
156
- *A custom web application that scrapes data from multiple providers and displays suitable vacations for users. It is empowered with an admin panel to manage all its bots and scrapers, along with data management functionalities. It provides various filters for holidays and locations to facilitate search. The admin panel empowers administrators to manage complex data with a user-friendly interface.*
157
 
158
  ---
159
 
160
  ### Online Donation Form Management Web Application
161
- *A custom web application that allows multiple clients to manage online donation forms. A robust and flexible application with technology integrated to seamlessly allow future enhancement and growth to the online donation processing system.*
162
 
163
  ---
164
 
165
  ### Indian Wedding & Event Planning Platform
166
- *A dedicated website for easy event planning and hiring resources for an event. Specially designed and curated for Indian weddings and events.*
167
 
168
  ---
169
 
170
  ### CatsBill
171
- *A Sifars initiative, an elegant and easy-to-use online portal to generate GST invoicing in India with many advanced features like inventory, stock transfer, and invoice management.*
172
 
173
  ---
174
 
175
  ### Instagram Auto Posting Platform
176
- *An interactive Instagram auto-posting platform engaging multiple profiles. A custom automation tool with features like scheduled follow, unfollow, and likes to organically grow Instagram followers.*
177
 
178
  ---
179
 
180
  ### iTunes Traffic Booster
181
- *An automation tool to increase the traffic of your song on iTunes.*
182
 
183
  ---
184
 
185
  ### Domotron
186
- *An interactive design made using PicoCMS and Pattern Labs.*
187
 
188
  ---
189
 
190
  ### Labonics WooCommerce Theme
191
- *A custom theme for a WooCommerce site to shop Labonics products integrated with an ERP system.*
192
 
193
  ---
194
 
195
  ### Get Connect
196
- *A cloud-based ETL software solution specifically designed for the banking sector to automate manual ETL processes into a design-enriched automated software program. The program is highly flexible and integrated with many administrative controls.*
197
 
198
  ---
199
 
200
  ### Advertorials.ai
201
- *Struggling to create ads that actually convert? Meet Advertorials.ai. Our AI-powered platform crafts top-performing advertorials in minutes, based on the best in the business. Plus, we streamline your workflow with project management tools, making collaboration a breeze. Test more, stress less, and watch your ad game soar with Advertorials.ai.*
202
 
203
  ---
204
 
205
  ### Forecasty.ai
206
- *Forecasty.ai is a self-service forecasting platform powered by advanced AI/ML technology, enabling you to generate forecasts easier and faster. It generates high-quality forecasts and provides predictive insights to make smarter business decisions. In-depth forecasts for commodity prices to prepare better in a volatile commodity market.*
207
 
208
 
209
  ## About Sifars
210
 
211
- Sifars, a pioneering web service provider, emerged onto the tech landscape in 2018 with a vision to revolutionize the digital sphere. Founded by visionary entrepreneurs Jatin Sethi, Munish Kumar, and Sukhwinder Singh, Sifars set its sights on empowering businesses worldwide with cutting-edge technology solutions. With its global headquarters nestled in the vibrant city of Patiala, Punjab, India, Sifars quickly garnered recognition as a leading application development company, committed to propelling businesses towards success in the ever-evolving tech landscape.
212
 
213
- **Mission and Vision**
214
 
215
  At Sifars, we pride ourselves on our unwavering commitment to excellence and innovation. Our mission is simple yet profound: to tailor products that serve as the lifeblood of businesses, fueling their growth and success in the digital age. With a steadfast focus on driving growth through digital innovation, we strive to empower businesses of all sizes to establish their identity and thrive in the competitive tech world. Our vision is to be the catalyst for transformation, leveraging technology to unlock new possibilities and propel businesses towards unprecedented success.
216
 
217
- **Core Values**
218
 
219
  At the heart of Sifars lie our core values, which serve as the guiding principles in everything we do:
220
 
@@ -248,10 +248,11 @@ At Sifars, we believe in building strong, long-lasting relationships with our cl
248
 
249
  **At Sifars, we are passionate about building innovative solutions that help our clients achieve their goals.** Our client-centric approach, combined with our expertise, commitment to quality, and dedication to long-term partnerships, allows us to create truly impactful and transformative solutions.
250
 
251
- ## Work-Life Balance
252
 
253
  At Sifars, we understand the importance of maintaining a healthy work-life balance. In addition to our commitment to delivering excellence, we prioritize the well-being of our team members. To foster a positive work environment and promote team cohesion, we organize weekly strengthening bond calls, where team members come together to unwind and engage in recreational activities. These calls serve as a respite from the demands of work, allowing team members to recharge and rejuvenate, thereby enhancing overall productivity and morale.
254
 
255
 
256
  ## COntact Details
 
257
 
 
129
  "They are very competent and reasonable with their pricing. The platform functions well without any bugs. Sifars is a highly deadline-oriented, communicative group."
130
 
131
 
132
+ ## Projects Done By Sifars
133
  **Our Portfolio Embraces Apex and Extraordinary Projects**
134
 
135
  ### Hoora
136
+ This is the project done by sifars. *Introducing Hoora, the avant-garde multi-tenant employee management app redefining workplace efficiency. Hoora comes equipped with an advanced AI chatbot that not only provides information but actively assists employees across various organizational aspects. Seamlessly integrating with your database and organizational files, Hoora's AI chatbot streamlines tasks, offers real-time information, and ensures a more productive and engaged workforce.*
137
 
138
  ---
139
 
140
  ### Elevate.AI
141
+ This is the project done by sifars.*Welcome to Elevate.AI, where cutting-edge technology meets personalized real estate solutions. Elevate.AI is a revolutionary project designed to seamlessly connect with potential real estate clients through the familiar and convenient platform of WhatsApp. Acting as your virtual human assistant, Elevate.AI employs advanced artificial intelligence to engage, generate leads, and schedule appointments with clients, making your real estate business more efficient and customer-centric.*
142
 
143
  ---
144
 
145
  ### Adamo
146
+ This is the project done by sifars.*Personalized nutrition, wellness tips, travel insights, and more. Upcoming features include prompt and image generators, seamless social media integration, and a media center. Boost business productivity with AI integration. Welcome to Adamo – where possibilities abound.*
147
 
148
  ---
149
 
150
  ### SalesBod
151
+ This is the project done by sifars.*A Chrome extension empowered with AI capabilities that helps salespeople gain information about companies and individuals. It enables salespeople to compose emails with a single prompt and generate POV. Additionally, it provides access to a user admin panel where users can manage their histories and company information related to executed prompts.*
152
 
153
  ---
154
 
155
  ### Travelidu
156
+ This is the project done by sifars.*A custom web application that scrapes data from multiple providers and displays suitable vacations for users. It is empowered with an admin panel to manage all its bots and scrapers, along with data management functionalities. It provides various filters for holidays and locations to facilitate search. The admin panel empowers administrators to manage complex data with a user-friendly interface.*
157
 
158
  ---
159
 
160
  ### Online Donation Form Management Web Application
161
+ This is the project done by sifars.*A custom web application that allows multiple clients to manage online donation forms. A robust and flexible application with technology integrated to seamlessly allow future enhancement and growth to the online donation processing system.*
162
 
163
  ---
164
 
165
  ### Indian Wedding & Event Planning Platform
166
+ *This is the project done by sifars.A dedicated website for easy event planning and hiring resources for an event. Specially designed and curated for Indian weddings and events.*
167
 
168
  ---
169
 
170
  ### CatsBill
171
+ This is the project done by sifars.*A Sifars initiative, an elegant and easy-to-use online portal to generate GST invoicing in India with many advanced features like inventory, stock transfer, and invoice management.*
172
 
173
  ---
174
 
175
  ### Instagram Auto Posting Platform
176
+ This is the project done by sifars.*An interactive Instagram auto-posting platform engaging multiple profiles. A custom automation tool with features like scheduled follow, unfollow, and likes to organically grow Instagram followers.*
177
 
178
  ---
179
 
180
  ### iTunes Traffic Booster
181
+ This is the project done by sifars.*An automation tool to increase the traffic of your song on iTunes.*
182
 
183
  ---
184
 
185
  ### Domotron
186
+ This is the project done by sifars.*An interactive design made using PicoCMS and Pattern Labs.*
187
 
188
  ---
189
 
190
  ### Labonics WooCommerce Theme
191
+ This is the project done by sifars.*A custom theme for a WooCommerce site to shop Labonics products integrated with an ERP system.*
192
 
193
  ---
194
 
195
  ### Get Connect
196
+ This is the project done by sifars.*A cloud-based ETL software solution specifically designed for the banking sector to automate manual ETL processes into a design-enriched automated software program. The program is highly flexible and integrated with many administrative controls.*
197
 
198
  ---
199
 
200
  ### Advertorials.ai
201
+ This is the project done by sifars.*Struggling to create ads that actually convert? Meet Advertorials.ai. Our AI-powered platform crafts top-performing advertorials in minutes, based on the best in the business. Plus, we streamline your workflow with project management tools, making collaboration a breeze. Test more, stress less, and watch your ad game soar with Advertorials.ai.*
202
 
203
  ---
204
 
205
  ### Forecasty.ai
206
+ This is the project done by sifars.*Forecasty.ai is a self-service forecasting platform powered by advanced AI/ML technology, enabling you to generate forecasts easier and faster. It generates high-quality forecasts and provides predictive insights to make smarter business decisions. In-depth forecasts for commodity prices to prepare better in a volatile commodity market.*
207
 
208
 
209
  ## About Sifars
210
 
211
+ Sifars, a pioneering web service provider, emerged onto the tech landscape in 2018 with a vision to revolutionize the digital sphere. Founded by visionary entrepreneurs Jatin Sethi, Munish Kumar, and Sukhwinder Singh, Sifars set its sights on empowering businesses worldwide with cutting-edge technology solutions. With its global headquarters nestled in the vibrant city of Mohali, Punjab, India, Sifars quickly garnered recognition as a leading application development company, committed to propelling businesses towards success in the ever-evolving tech landscape.
212
 
213
+ **Mission and Vision of sifars**
214
 
215
  At Sifars, we pride ourselves on our unwavering commitment to excellence and innovation. Our mission is simple yet profound: to tailor products that serve as the lifeblood of businesses, fueling their growth and success in the digital age. With a steadfast focus on driving growth through digital innovation, we strive to empower businesses of all sizes to establish their identity and thrive in the competitive tech world. Our vision is to be the catalyst for transformation, leveraging technology to unlock new possibilities and propel businesses towards unprecedented success.
216
 
217
+ **Core Values of sifars**
218
 
219
  At the heart of Sifars lie our core values, which serve as the guiding principles in everything we do:
220
 
 
248
 
249
  **At Sifars, we are passionate about building innovative solutions that help our clients achieve their goals.** Our client-centric approach, combined with our expertise, commitment to quality, and dedication to long-term partnerships, allows us to create truly impactful and transformative solutions.
250
 
251
+ ## Work-Life Balance in sifars
252
 
253
  At Sifars, we understand the importance of maintaining a healthy work-life balance. In addition to our commitment to delivering excellence, we prioritize the well-being of our team members. To foster a positive work environment and promote team cohesion, we organize weekly strengthening bond calls, where team members come together to unwind and engage in recreational activities. These calls serve as a respite from the demands of work, allowing team members to recharge and rejuvenate, thereby enhancing overall productivity and morale.
254
 
255
 
256
  ## COntact Details
257
+ Address:- Ground Floor, Blue Sapphire, D-234, Phase 8B, Industrial Area, Sector 74, Sahibzada Ajit Singh Nagar, Punjab 140307
258
 
src/crawler/_database_updater.py CHANGED
@@ -54,7 +54,7 @@ class DatabaseUpdater:
54
 
55
  async def process_pdf_file(self, file_path):
56
  docs = pymupdf4llm.to_markdown(file_path, page_chunks=True)
57
- async with aiofiles.open("knowledge_base.txt", 'a+', encoding='utf-8') as f:
58
  for doc in docs:
59
  await f.write(doc.get("text"))
60
  await f.write("\n")
@@ -62,7 +62,7 @@ class DatabaseUpdater:
62
 
63
  async def process_docx_file(self, file_path):
64
  doc = Document(file_path)
65
- async with aiofiles.open("knowledge_base.txt", 'a+', encoding='utf-8') as f:
66
  for paragraph in doc.paragraphs:
67
  await f.write(paragraph.text)
68
  await f.write("\n")
 
54
 
55
  async def process_pdf_file(self, file_path):
56
  docs = pymupdf4llm.to_markdown(file_path, page_chunks=True)
57
+ async with aiofiles.open("knowledge_base.pdf", 'a+', encoding='utf-8') as f:
58
  for doc in docs:
59
  await f.write(doc.get("text"))
60
  await f.write("\n")
 
62
 
63
  async def process_docx_file(self, file_path):
64
  doc = Document(file_path)
65
+ async with aiofiles.open("knowledge_base.docx", 'a+', encoding='utf-8') as f:
66
  for paragraph in doc.paragraphs:
67
  await f.write(paragraph.text)
68
  await f.write("\n")
src/services/_chat_service.py CHANGED
@@ -17,13 +17,8 @@ class ChatService:
17
  pass
18
 
19
  async def create_response_message(self, messages: list):
20
- logger.info("Extracting context for user query...")
21
- # async with self.pinecone_client() as pinecone_client:
22
- # context = await pinecone_client.get_context_for_user_query(messages[-1]["content"], top_k=2)
23
- logger.info(f"Context extracted successfully.")
24
- # message = f"Context is: {context} and User Query is: {messages[-1]['content']}"
25
  message = f"User Query is: {messages[-1]['content']}"
26
  messages[-1]["content"] = message
27
  async with self.chat_client() as chat_client:
28
- async for response in chat_client.create_chat_completions(messages[1:][-5:]):
29
  yield response
 
17
  pass
18
 
19
  async def create_response_message(self, messages: list):
 
 
 
 
 
20
  message = f"User Query is: {messages[-1]['content']}"
21
  messages[-1]["content"] = message
22
  async with self.chat_client() as chat_client:
23
+ async for response in chat_client.create_chat_completions(messages[1:]):
24
  yield response
src/services/_database_service.py CHANGED
@@ -5,7 +5,7 @@ from src.utils import logger
5
  class DatabaseService:
6
  def __init__(self):
7
  self.database_updater = DatabaseUpdater
8
- self.file_paths = ["knowledge_base.txt", "scrapped.txt", "sifars.md"]
9
 
10
  async def __aenter__(self):
11
  return self
 
5
  class DatabaseService:
6
  def __init__(self):
7
  self.database_updater = DatabaseUpdater
8
+ self.file_paths = ["sifars.md", "knowledge_base.txt", "scrapped.txt"]
9
 
10
  async def __aenter__(self):
11
  return self
src/utils/_chat_client.py CHANGED
@@ -16,12 +16,13 @@ AVAILABLE_FUNCTIONS = {
16
  "get_context_for_user_query": ToolCall.get_context_for_user_query.__name__,
17
  }
18
 
19
- INSTRUCTIONS="""
20
  # Objective
21
  You are a Conversational AI assistant developed by **Sifars**, a web development company. Your responses **must** be **short (not more than 50 words), precise, and engaging**. You provide **clear, conversational answers** to queries about **Sifars and its services**.
22
 
23
  # About Sifars
24
- Sifars is a pioneering web service provider founded in 2018 by **Jatin Sethi, Munish Kumar, and Sukhwinder Singh**. Headquartered in **Patiala, Punjab, India**, we specialize in **application development using Python, JavaScript, React, Node.js, and more**. We focus on **scalability, innovation, and work-life balance**.
 
25
 
26
  - **Email:** [contact@sifars.com](mailto:contact@sifars.com)
27
  - **Address:** D-234, Ground Floor, Phase 8B, Industrial Area, Sector 74, Sahibzada Ajit Singh Nagar, Punjab 160055, India
@@ -46,7 +47,8 @@ If a user wants to contact us, ask for their **name, email, phone number, and re
46
  - If yes, **answer directly** without calling any tool.
47
  - If not, proceed to Step 2.
48
  2. **If the context is not enough, and the query is about Sifars:**
49
- - Call **"get_context_for_user_query"** to fetch relevant details.
 
50
  - If the retrieved context is enough, **answer the question without calling another tool**.
51
  - If still insufficient, proceed to Step 3.
52
  3. **If no sufficient information is available even after calling "get_context_for_user_query":**
@@ -69,7 +71,7 @@ If a user wants to contact us, ask for their **name, email, phone number, and re
69
  βœ… **Response:** "We offer web and application development using Python, JavaScript, React, and more."
70
 
71
  βœ… **User:** "Where is Sifars located?"
72
- βœ… **Response:** "Sifars is headquartered in Patiala, Punjab, India."
73
 
74
  βœ… **User:** "How can I apply for a job at Sifars?"
75
  βœ… **Response:** "You can check our openings at [Careers Page](https://www.sifars.com/en/careers/) or email your resume to [hr@sifars.com](mailto:hr@sifars.com)."
@@ -277,4 +279,3 @@ class ChatClient:
277
  }
278
  )
279
  return tool_calls_output
280
-
 
16
  "get_context_for_user_query": ToolCall.get_context_for_user_query.__name__,
17
  }
18
 
19
+ INSTRUCTIONS = """
20
  # Objective
21
  You are a Conversational AI assistant developed by **Sifars**, a web development company. Your responses **must** be **short (not more than 50 words), precise, and engaging**. You provide **clear, conversational answers** to queries about **Sifars and its services**.
22
 
23
  # About Sifars
24
+ Sifars is a pioneering web service provider founded in 2018 by **Jatin Sethi, Munish Kumar, and Sukhwinder Singh**. Headquartered in **Mohali, Punjab, India**, we specialize in **application development using Python, JavaScript, React, Node.js, and more**. We focus on **scalability, innovation, and work-life balance**.
25
+ Sifars is specialized in building AI powered web and mobile applications.
26
 
27
  - **Email:** [contact@sifars.com](mailto:contact@sifars.com)
28
  - **Address:** D-234, Ground Floor, Phase 8B, Industrial Area, Sector 74, Sahibzada Ajit Singh Nagar, Punjab 160055, India
 
47
  - If yes, **answer directly** without calling any tool.
48
  - If not, proceed to Step 2.
49
  2. **If the context is not enough, and the query is about Sifars:**
50
+ - Call **"get_context_for_user_query"** to fetch relevant details by passing correct query.
51
+ - Normalize the **query**. Query might be refrence to the chat history so paraphrase the query as it standalso understandable without the history
52
  - If the retrieved context is enough, **answer the question without calling another tool**.
53
  - If still insufficient, proceed to Step 3.
54
  3. **If no sufficient information is available even after calling "get_context_for_user_query":**
 
71
  βœ… **Response:** "We offer web and application development using Python, JavaScript, React, and more."
72
 
73
  βœ… **User:** "Where is Sifars located?"
74
+ βœ… **Response:** "Sifars is headquartered in Mohali, Punjab, India."
75
 
76
  βœ… **User:** "How can I apply for a job at Sifars?"
77
  βœ… **Response:** "You can check our openings at [Careers Page](https://www.sifars.com/en/careers/) or email your resume to [hr@sifars.com](mailto:hr@sifars.com)."
 
279
  }
280
  )
281
  return tool_calls_output
 
src/utils/_pinecone_client.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
  import uuid
3
 
@@ -17,10 +18,14 @@ class PineconeClient:
17
  api_key=os.getenv("PINECONE_API_KEY"),
18
  )
19
  self.index_name = os.getenv("PINECONE_INDEX_NAME")
20
- self.index = self.pc.Index(self.index_name)
21
- self.vector_store = PineconeVectorStore(index=self.index, embedding=embeddings)
22
 
23
  async def __aenter__(self):
 
 
 
 
24
  return self
25
 
26
  async def __aexit__(self, exc_type, exc_val, exc_tb):
@@ -28,7 +33,7 @@ class PineconeClient:
28
 
29
  async def _list_indexs(self):
30
  return self.pc.list_indexes()
31
-
32
  async def _is_index_exist(self, index_name=None):
33
  if not index_name:
34
  index_name = self.index_name
@@ -36,7 +41,7 @@ class PineconeClient:
36
  if index['name'] == index_name:
37
  return True
38
  return False
39
-
40
  async def _create_index(self, index_name=None):
41
  if not index_name:
42
  index_name = self.index_name
@@ -58,11 +63,11 @@ class PineconeClient:
58
  if not await self._is_index_exist(index_name):
59
  await self._create_index(index_name)
60
  return self.pc.Index(index_name)
61
-
62
  async def _upsert(self, texts, index_name=None):
63
  await self.vector_store.aadd_texts(texts)
64
  return
65
-
66
  async def get_context_for_user_query(self, query: str, top_k=1, index_name=None):
67
  logger.info("Query is: " + query)
68
  results = await self.vector_store.asimilarity_search(query, k=top_k)
@@ -74,4 +79,4 @@ class PineconeClient:
74
  index_name = self.index_name
75
  if await self._is_index_exist(index_name):
76
  self.pc.delete_index(index_name)
77
- return
 
1
+ import asyncio
2
  import os
3
  import uuid
4
 
 
18
  api_key=os.getenv("PINECONE_API_KEY"),
19
  )
20
  self.index_name = os.getenv("PINECONE_INDEX_NAME")
21
+ self.index = None
22
+ self.vector_store = None
23
 
24
  async def __aenter__(self):
25
+ if not await self._is_index_exist():
26
+ await self._create_index()
27
+ self.index = await self._fetch_index()
28
+ self.vector_store = PineconeVectorStore(index=self.index, embedding=embeddings)
29
  return self
30
 
31
  async def __aexit__(self, exc_type, exc_val, exc_tb):
 
33
 
34
  async def _list_indexs(self):
35
  return self.pc.list_indexes()
36
+
37
  async def _is_index_exist(self, index_name=None):
38
  if not index_name:
39
  index_name = self.index_name
 
41
  if index['name'] == index_name:
42
  return True
43
  return False
44
+
45
  async def _create_index(self, index_name=None):
46
  if not index_name:
47
  index_name = self.index_name
 
63
  if not await self._is_index_exist(index_name):
64
  await self._create_index(index_name)
65
  return self.pc.Index(index_name)
66
+
67
  async def _upsert(self, texts, index_name=None):
68
  await self.vector_store.aadd_texts(texts)
69
  return
70
+
71
  async def get_context_for_user_query(self, query: str, top_k=1, index_name=None):
72
  logger.info("Query is: " + query)
73
  results = await self.vector_store.asimilarity_search(query, k=top_k)
 
79
  index_name = self.index_name
80
  if await self._is_index_exist(index_name):
81
  self.pc.delete_index(index_name)
82
+ return
src/utils/_tool_call.py CHANGED
@@ -9,7 +9,7 @@ class ToolCall:
9
 
10
  async def __aenter__(self):
11
  return self
12
-
13
  async def __aexit__(self, exc_type, exc_val, exc_tb):
14
  pass
15
 
@@ -19,7 +19,7 @@ class ToolCall:
19
  await asyncio.sleep(0)
20
  async with EmailClient() as email_client:
21
  response = await email_client.send_email(details)
22
-
23
  asyncio.create_task(background_task(details))
24
  logger.info("Added in background")
25
  return "Email sent successfully."
@@ -31,12 +31,14 @@ class ToolCall:
31
  await asyncio.sleep(0)
32
  async with EmailClient() as email_client:
33
  response = await email_client.report_missing_context(details)
34
-
35
  asyncio.create_task(background_task(details))
36
  logger.info("Added in background")
37
  return "Missing Context Report sent successfully."
38
-
39
  async def get_context_for_user_query(self, details: dict):
40
  logger.info("Calling the tool get_context_for_user_query...")
41
  async with PineconeClient() as pinecone_client:
42
- return await pinecone_client.get_context_for_user_query(details.get("query"))
 
 
 
9
 
10
  async def __aenter__(self):
11
  return self
12
+
13
  async def __aexit__(self, exc_type, exc_val, exc_tb):
14
  pass
15
 
 
19
  await asyncio.sleep(0)
20
  async with EmailClient() as email_client:
21
  response = await email_client.send_email(details)
22
+
23
  asyncio.create_task(background_task(details))
24
  logger.info("Added in background")
25
  return "Email sent successfully."
 
31
  await asyncio.sleep(0)
32
  async with EmailClient() as email_client:
33
  response = await email_client.report_missing_context(details)
34
+
35
  asyncio.create_task(background_task(details))
36
  logger.info("Added in background")
37
  return "Missing Context Report sent successfully."
38
+
39
  async def get_context_for_user_query(self, details: dict):
40
  logger.info("Calling the tool get_context_for_user_query...")
41
  async with PineconeClient() as pinecone_client:
42
+ return await pinecone_client.get_context_for_user_query(
43
+ details.get("query"), top_k=10
44
+ )