Aryan Jain
add main.py for server initialization; update file handling in DatabaseUpdater and improve context retrieval in ToolCall
46d624e
import asyncio
from ._config import logger
from ._email_client import EmailClient
from ._pinecone_client import PineconeClient
class ToolCall:
def __init__(self):
pass
async def __aenter__(self):
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
pass
async def send_email(self, details: dict):
logger.info(details)
async def background_task(details: dict):
await asyncio.sleep(0)
async with EmailClient() as email_client:
response = await email_client.send_email(details)
asyncio.create_task(background_task(details))
logger.info("Added in background")
return "Email sent successfully."
async def report_missing_context(self, details: dict):
logger.info(details)
async def background_task(details: dict):
await asyncio.sleep(0)
async with EmailClient() as email_client:
response = await email_client.report_missing_context(details)
asyncio.create_task(background_task(details))
logger.info("Added in background")
return "Missing Context Report sent successfully."
async def get_context_for_user_query(self, details: dict):
logger.info("Calling the tool get_context_for_user_query...")
async with PineconeClient() as pinecone_client:
return await pinecone_client.get_context_for_user_query(
details.get("query"), top_k=10
)