import gradio as gr import google.generativeai as genai import os import time from typing import List, Dict, Any, Tuple # Configure Google AI genai.configure(api_key=os.environ.get("GOOGLE_API_KEY")) class Professional4ATChatbot: def __init__(self): """Initialize the complete professional 4AT chatbot""" self.model = genai.GenerativeModel('gemini-1.5-flash') self.knowledge_base = self.load_complete_4at_knowledge() def load_complete_4at_knowledge(self) -> Dict[str, str]: """Complete 4AT knowledge base with all company information""" return { # COMPANY OVERVIEW & IDENTITY "company_overview": """4AT is a congregation of industry experts specializing in Accounting, Audit, Assurance, Advisory, and Technology. We serve enterprises across Education, Pharma, IT, Infrastructure, Manufacturing, and more industries with our 'Big 4' expertise and innovative operating approach. Our service delivery operating framework emphasizes critical elements of engagement with agility, diligence, and innovative solutions. We reject a 'one size fits all' philosophy and provide customized solutions for each client.""", # COMPLETE LEADERSHIP TEAM "leadership": """**4AT LEADERSHIP TEAM & FOUNDERS:** **Managing Partners (Founders):** • **Ravi Krovvidi** - Over two decades in Finance & Accounting. Qualified Accountant with experience in global Pharma, IT, and Service companies. SME on Financial Planning & Analysis. Has worked in the USA and Australia. • **Aruna Sharma** - Over 15 years in public accounting and financial services. Qualified Chartered Accountant and MBA. Key domain experience in providing assurance services for SEC registered companies. Was part of the pioneer group to set up offshore services for a Big 4 firm in India. **Key Team Members:** • **Chetana RG Kaasam** (Of Counsel) - Over a decade of experience in Corporate Governance, M&A, Contract Management, Trademarks & IP, Labour Laws, ESOPs, and Arbitration. Holds Masters from Georgetown University and LSE. • **Ron Ramakrishnan** (Operations & HR) - Niche experience in client services, transition, and client management with a focus on SLA-driven service delivery. • **Shashank** (Associate Partner) - Over 7 years of experience in accounting and audit, including internal/external audits, financial reporting, BPR & APR, and audits of government bodies. Also trains professionals in accounting and audit. • **Srigouri Mantrala** (Associate Partner) - Chartered Accountant, Certified Fraud Examiner, and Certified Anti-Money Laundering Specialist with over 24 years of experience, including 14 years in audit with Big Four firms. Expert in Sarbanes-Oxley (SOX), COSO Framework, and forensic investigations. • **D Satish Kumar** (Associate Partner) - 15 years of experience with Fortune 500 companies (automobile, technology, pharma). Proficient with the COSO framework and SOX programs. Has reviewed SAP, Oracle, and MS Dynamics. A Fellow Chartered Accountant, DSCI Certified Privacy Lead Assessor, and Certified Information System Auditor. • **Vinita Anand Shastry** (Associate Partner) • **Vandita Kondapaneni** (Manager Client Services – Audit & Assurance) • **Vivek Varshith Velichala** (Manager Client Services – Accounting & SOX)""", # COMPREHENSIVE SERVICES "services": """**4AT COMPREHENSIVE SERVICES:** **🏢 CORE ACCOUNTING & AUDIT SERVICES:** **1. Accounting Process Outsourcing (APO)** • End-to-end management of accounting functions • Order to Cash (O2C), Procure to Pay (P2P) • General Ledger/Record to Report (R2R) including month/year end book close • Payroll, Employee expense reimbursement, Fixed Assets, Bank and Cash **2. Internal Controls & SOX Compliance** • SOX Program Management / PMO • Scoping & Risk Assessment • Design and implementation of internal controls • Testing of internal controls • Remediation of control deficiencies • SOX Program rationalization and optimization • IT General Controls (ITGC) **3. Technical Accounting** • Revenue Recognition (ASC 606) • Lease Accounting (ASC 842) • Business Combination and asset acquisitions • Derivatives and Hedging • Stock-based compensation • Carve-out Financials, Financial Instruments, SEC Reporting **4. Audit Outsourcing** • Financial Statement Audit • Internal Audit, SOX Audit • SOC Audit (SOC 1 & SOC 2) • Forensic Audit, Due Diligence • Employee Benefit Plan Audits **5. Financial Audit Readiness** • Assistance in audit planning and preparation • Preparation of supporting schedules and reconciliations • Drafting of financial statements and footnote disclosures • Preparation of technical accounting memos • Project management of the audit **6. Tax Advisory & MACTAX** • Individual tax planning, compliance and filing • Corporate tax filings • Transfer pricing study and documentation • Tax litigation and representation • MACTAX - Single platform for tax filing with 100% accuracy **7. IPO Readiness** • Project Management of the IPO journey • Financial clean-up and audit readiness • Implementation of new accounting standards • Preparation of S-1 and other registration statements • Design and implementation of SOX compliant internal controls **💻 TECHNOLOGY SERVICES:** • **Cloud Services:** AWS, Microsoft Azure, Google Cloud Platform (GCP) • **Cyber Security:** Network security, application security, data security • **Data Analytics:** Data warehousing, data visualization, business intelligence • **Robotic Process Automation (RPA):** Process automation, cognitive automation **🎓 4AT ACADEMY:** • CPA (Certified Public Accountant) - All 4 parts comprehensive training • CMA (Certified Management Accountant) - Both parts training • IFRS, US GAAP, SOX training - All levels • Interactive courses with 100+ years combined faculty experience""", # CONTACT & LOCATIONS "contact": """**CONTACT 4AT CONSULTING:** **🇺🇸 USA OFFICE:** 📍 116 Village Blvd, Suite 200, Princeton, New Jersey 08540 📞 +1 703 665 4255 📧 info@consult-4at.com **🇮🇳 INDIA OFFICE:** 📍 3rd Floor, D-Block, I Labs Center, Madhapur, Hyderabad, TS 500081 📞 +91 9010433456 | +91 9133203456 📧 info@consult-4at.com **🇦🇺 AUSTRALIA OFFICE:** 📍 KG01-86 Courallie Avenue, Homebush West, NSW 2140 📧 info@consult-4at.com **🇬🇧 UK OFFICE:** 📍 To Be Announced (TBA) **🌍 GLOBAL PRESENCE:** • 24/7 service delivery across time zones • Dynamic presence that blurs geographical boundaries • Build-Operate-Transfer service model""", # CLIENTS & TESTIMONIALS "clients": """**4AT CLIENT PORTFOLIO:** **Major Clients:** Deloitte, FINTECHFORCE, SENSIBA SAN FILIPPO, BDO, BPM, AEMETIS, TeamLease, Bharat Group **CLIENT TESTIMONIALS:** *"4AT helped us streamline our Accounting functions... Their in-depth expertise... was quite a game changer... They managed the wing-to-wing Finance and Accounts operations with utmost diligence."* *"4AT was instrumental in not only setting our books in order but they went beyond the call to standardize our key functions which resulted in huge benefits for us."* *"4AT proved to be 'walk the talk' service provider. Their ability to understand, analyze and execute complex areas of Accounting... helped us immensely with our audit process."* *"I contracted 4AT to manage our SOX efforts in India... They were given a newly-hired Internal Audit department... and managed them, achieving every deadline... I would recommend them to any US company who is contemplating offshoring duties to India."* **Track Record:** 45+ successful projects across 3 countries""", # COMPANY BACKGROUND & EXPERIENCE "experience": """**4AT BACKGROUND & EXPERTISE:** • **Big 4 Expertise:** Management team brings extensive 'Big 4' consulting experience • **Combined Experience:** Over 100+ years in finance and accounting across the team • **Service Framework:** 'Build Operate Transfer' model for significant client value • **Global Operations:** Multi-country presence with 24/7 service delivery • **Industry Focus:** Education, Pharma, IT, Infrastructure, Manufacturing, Banking, Real Estate • **Customization Philosophy:** Reject 'one size fits all' - provide tailored solutions • **Mission:** To provide outstanding, holistic services with highest standards of integrity • **Vision:** To be a success partner as 'Best-in-Class' consultants and service providers • **Core Values:** Integrity, Accountability, Innovation, Trust""", # MISSION & VALUES "mission": """**4AT MISSION, VISION & VALUES:** **MISSION:** To provide outstanding, holistic services for Accounting, Audit, Advisory, and Assurance with no compromise on the highest standards of integrity and professionalism. **VISION:** To be a success partner for our clients by being 'Best-in-Class' consultants and service providers with the highest degree of competence and service standards. **CORE VALUES:** • **Integrity** - Unshakable driving principles keeping up the ethos and sanctity • **Accountability** - Going beyond the call of duty and looking beyond responsibilities • **Innovation** - Leveraging our industry experience to provide value driven services • **Trust** - Driving unflinching faith to entrust your financials to be handled by our experts""" } def understand_intent(self, query: str) -> List[str]: """Smart intent recognition - understand what user really wants""" query_lower = query.lower().strip() # Leadership/founder intent if any(word in query_lower for word in ["founder", "founded", "partner", "management", "team", "leadership", "ceo", "director", "owner", "started", "who runs", "heads", "managing"]): return ["leadership"] # Services intent elif any(word in query_lower for word in ["services", "offer", "provide", "do", "capabilities", "solutions", "help", "expertise", "consulting", "what do you do"]): return ["services"] # Contact intent elif any(word in query_lower for word in ["contact", "phone", "email", "address", "location", "office", "reach", "call", "where", "how to reach"]): return ["contact"] # History/establishment intent elif any(word in query_lower for word in ["when", "established", "history", "experience", "years", "background", "track record"]): return ["experience"] # Clients intent elif any(word in query_lower for word in ["clients", "customers", "projects", "work", "companies", "served", "portfolio", "testimonials"]): return ["clients"] # Mission/values intent elif any(word in query_lower for word in ["mission", "vision", "values", "purpose", "goal", "philosophy"]): return ["mission"] # Default to company overview else: return ["company_overview"] def generate_response(self, query: str, history: List = None) -> str: """Generate intelligent, professional response""" start_time = time.time() # Understand user intent relevant_sections = self.understand_intent(query) # Get relevant content context_content = [] for section in relevant_sections: if section in self.knowledge_base: context_content.append(self.knowledge_base[section]) if not context_content: context_content = [self.knowledge_base["company_overview"]] combined_context = "\n\n".join(context_content) # Create intelligent prompt for Gemini prompt = f"""You are a professional AI assistant for 4AT Consulting, a leading accounting and advisory firm. IMPORTANT INSTRUCTIONS: 1. Answer the user's question naturally and professionally using the company information below 2. Be conversational, helpful, and knowledgeable - like talking to a senior company representative 3. Provide comprehensive answers that fully address what the user is asking 4. If the user asks about founders/who started/partners → focus on the leadership team 5. If they ask about services → provide relevant service details 6. If they ask about contact → provide complete contact information 7. If they ask about experience/history → discuss company background and expertise 8. Always maintain a professional, confident tone COMPANY INFORMATION: {combined_context} USER'S QUESTION: {query} Provide a helpful, comprehensive, professional response:""" try: response = self.model.generate_content(prompt) answer = response.text return answer except Exception as e: return "I apologize, but I'm experiencing a technical issue right now. For immediate assistance, please contact us directly at info@consult-4at.com or +1 703 665 4255. Our team will be happy to help you with any questions about 4AT's services." # Initialize the professional chatbot professional_chatbot = Professional4ATChatbot() def professional_chat_function(message, history): """Main chat function for the professional 4AT assistant""" try: response = professional_chatbot.generate_response(message, history) return response except Exception as e: return "I apologize for the technical difficulty. Please contact us at info@consult-4at.com or +1 703 665 4255 for immediate assistance with your inquiry." # Create the professional interface (compatible version) demo = gr.ChatInterface( fn=professional_chat_function, title="🏢 4AT Consulting - Professional AI Assistant", description="Expert AI Assistant for Accounting, Audit, Advisory & Technology Services. Ask me anything about 4AT!", examples=[ "What is 4AT Consulting?", "Who founded 4AT?", "What services do you provide?", "Tell me about your leadership team", "How can I contact 4AT?", "What is your company's experience?", "Do you help with SOX compliance?", "Tell me about 4AT Academy", "Where are your office locations?", "What industries do you serve?" ], theme=gr.themes.Soft() ) # Add custom CSS for professional styling demo.css = """ /* Professional 4AT Styling */ .gradio-container { background: linear-gradient(135deg, #f8faff 0%, #e6f3ff 100%); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; } /* Header styling */ h1 { background: linear-gradient(90deg, #1e40af, #3b82f6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 700; text-align: center; } /* Chat interface styling */ .chat-interface { border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.08); background: white; border: 1px solid #e2e8f0; } """ # Launch the professional application if __name__ == "__main__": demo.launch()