|
import openai |
|
import gradio as gr |
|
|
|
|
|
from company_profile import company_profile |
|
from financials import financials |
|
from workforce import workforce |
|
|
|
|
|
|
|
openai.api_key = "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" |
|
openai.api_base = "https://api.groq.com/openai/v1" |
|
|
|
|
|
def query_ai(user_input): |
|
|
|
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']} |
|
""" |
|
|
|
|
|
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)}" |
|
|
|
|
|
def chatbot_interface(user_input): |
|
return query_ai(user_input) |
|
|
|
|
|
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() |