import openai import gradio as gr # Import all data modules from company_profile import company_profile from financials import financials from workforce import workforce # Import other modules as needed # Set up the OpenAI (GROQ) API openai.api_key = "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" openai.api_base = "https://api.groq.com/openai/v1" # Function to query the AI agent def query_ai(user_input): # Contextual data from the application context_data = f""" Company Name: {company_profile['brand_name']} Headquarters: {company_profile['headquarters']} Founders: {', '.join(company_profile['founders'])} Latest Valuation: {financials['latest_valuation']} Total Funding: {financials['total_funding']} Employees: {workforce['total_employees']} """ # Call the OpenAI API try: response = openai.ChatCompletion.create( model="llama-3.1-70b-versatile", messages=[ {"role": "system", "content": "You are a Private Market Analysis AI Agent."}, {"role": "user", "content": f"{context_data}\n\n{user_input}"} ] ) return response.choices[0].message["content"] except Exception as e: return f"Error: {str(e)}" # Gradio interface def chatbot_interface(user_input): return query_ai(user_input) # Launch the Gradio app gr.Interface( fn=chatbot_interface, inputs="text", outputs="text", title="Satyam Market Analysis", description="Ask me about private companies like Razorpay, including financials, products, and more!" ).launch()