Spaces:
Runtime error
Runtime error
File size: 22,895 Bytes
b776a4d bc765dc b776a4d bc765dc b776a4d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | from exa_py import Exa
from groq import Groq
import os
import httpx
# Declare the exa search API
exa = Exa(api_key=os.getenv("EXA_API_KEY"))
# Define your API Model and key
utilized_model = "llama3-70b-8192"
highlights_options = {
"num_sentences": 7, # Length of highlights
"highlights_per_url": 1, # Get the best highlight for each URL
}
try:
# Use a custom HTTP client
http_client = httpx.Client()
client = Groq(api_key=os.getenv("GROQ_API_KEY"), http_client=http_client)
print("Groq client initialized successfully!")
except TypeError as e:
print("Error initializing Groq client:", str(e))
except Exception as ex:
print("Unexpected error:", str(ex))
highlights_options = {
"num_sentences": 7,
"highlights_per_url": 1,
}
def call_llm(prompt):
search_response = exa.search_and_contents(query=prompt, highlights=highlights_options, num_results=3, use_autoprompt=True)
info = [sr.highlights[0] for sr in search_response.results]
system_prompt = "You are a Business proposal generator. Read the provided contexts and, if relevant, use them to answer the user's question."
user_prompt = f"Sources: {info}\nQuestion: {prompt}"
completion = client.chat.completions.create(
model=utilized_model,
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt},
]
)
return completion.choices[0].message.content
def generate_executive_summary(data):
prompt = f"""
Generate a concise executive summary for a business proposal based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
Location: {data["location"]}
Mission Statement: {data["mission"]}
Vision Statement: {data["vision"]}
Products/Services: {data["products_services"]}
Target Market: {data["target_market"]}
Value Proposition: {data["value_proposition"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
Funding Requirements: {data["funding_requirements"]}
Management Team: {data["management_team"]}
Company Structure: {data["company_structure"]}
Goals and Objectives: {data["goals_objectives"]}
Operational Strategy: {data["operational_strategy"]}
Market Overview: {data["market_overview"]}
Promotional Strategy: {data["promotional_strategy"]}
The executive summary should highlight the key points of the business proposal, including the company's mission, products/services, target market, competitive advantage, financial information, and funding requirements.
"""
return call_llm(prompt)
def generate_mission(data):
prompt = f"""
Generate a detailed description of the company's mission based on the following information:
Company Name: {data["company_name"]}
Mission Statement: {data["mission"]}
The mission statement should clearly explain the company's purpose, values, and goals.
"""
return call_llm(prompt)
def generate_vision(data):
prompt = f"""
Generate a detailed description of the company's vision based on the following information:
Company Name: {data["company_name"]}
Vision Statement: {data["vision"]}
The vision statement should describe the company's long-term aspirations and the desired future state of the business.
"""
return call_llm(prompt)
def generate_objectives(data):
prompt = f"""
Generate a detailed description of the company's short-term and long-term goals and objectives based on the following information:
Company Name: {data["company_name"]}
Goals and Objectives: {data["goals_objectives"]}
The objectives should be specific, measurable, achievable, relevant, and time-bound (SMART).
"""
return call_llm(prompt)
def generate_core_values(data):
prompt = f"""
Generate a detailed description of the company's core values based on the following information:
Company Name: {data["company_name"]}
Mission Statement: {data["mission"]}
The core values should reflect the principles and beliefs that guide the company's decision-making and behavior.
"""
return call_llm(prompt)
def generate_business_description(data):
prompt = f"""
Generate a detailed description of the company's business based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
Products/Services: {data["products_services"]}
The business description should provide an overview of the company's operations, including its products or services, target market, and competitive advantages.
"""
return call_llm(prompt)
def generate_company_location(data):
prompt = f"""
Generate a detailed description of the company's location based on the following information:
Company Name: {data["company_name"]}
Location: {data["location"]}
The company location description should highlight the advantages and benefits of the chosen location for the business.
"""
return call_llm(prompt)
def generate_products(data):
prompt = f"""
Generate a detailed description of the company's products or services based on the following information:
Company Name: {data["company_name"]}
Products/Services: {data["products_services"]}
The product description should provide a comprehensive overview of the company's offerings, including their features, benefits, and unique selling points.
"""
return call_llm(prompt)
def generate_ownership(data):
prompt = f"""
Generate a detailed description of the company's ownership structure based on the following information:
Company Name: {data["company_name"]}
Management Team: {data["management_team"]}
Company Structure: {data["company_structure"]}
The ownership description should explain the legal structure of the company and the roles and responsibilities of the management team.
"""
return call_llm(prompt)
def generate_company_structure(data):
prompt = f"""
Generate a detailed description of the company's organizational structure based on the following information:
Company Name: {data["company_name"]}
Company Structure: {data["company_structure"]}
The company structure description should outline the various departments, teams, and reporting relationships within the organization.
"""
return call_llm(prompt)
def generate_management_profiles(data):
prompt = f"""
Generate detailed profiles of the key members of the management team based on the following information:
Company Name: {data["company_name"]}
Management Team: {data["management_team"]}
The management profiles should highlight the relevant experience, skills, and achievements of each team member.
"""
return call_llm(prompt)
def generate_operational_strategy(data):
prompt = f"""
Generate a detailed description of the company's operational strategy based on the following information:
Company Name: {data["company_name"]}
Operational Strategy: {data["operational_strategy"]}
The operational strategy description should explain how the company will efficiently manage its day-to-day operations to achieve its goals and objectives.
"""
return call_llm(prompt)
def generate_marketing_mix(data):
prompt = f"""
Generate a detailed description of the company's marketing mix strategy based on the following information:
Company Name: {data["company_name"]}
Products/Services: {data["products_services"]}
Target Market: {data["target_market"]}
Value Proposition: {data["value_proposition"]}
Promotional Strategy: {data["promotional_strategy"]}
The marketing mix strategy should cover the 4Ps: product, price, place, and promotion.
"""
return call_llm(prompt)
def generate_promotional_strategy(data):
prompt = f"""
Generate a detailed description of the company's promotional strategy based on the following information:
Company Name: {data["company_name"]}
Promotional Strategy: {data["promotional_strategy"]}
The promotional strategy should outline the various marketing channels and tactics the company will use to reach its target market and promote its products or services.
"""
return call_llm(prompt)
def analyze_demand(data):
prompt = f"""
Generate a detailed analysis of the market demand for the company's products or services based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
Target Market: {data["target_market"]}
Market Overview: {data["market_overview"]}
The market demand analysis should include information on market size, growth trends, and potential for the company's offerings.
"""
return call_llm(prompt)
def segment_market(data):
prompt = f"""
Generate a detailed analysis of the target market segmentation based on the following information:
Company Name: {data["company_name"]}
Target Market: {data["target_market"]}
The market segmentation analysis should identify and describe the key customer segments the company will target, including their demographics, psychographics, and buying behaviors.
"""
return call_llm(prompt)
def analyze_competitors(data):
prompt = f"""
Generate a detailed analysis of the company's competitors based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
Products/Services: {data["products_services"]}
The competitor analysis should identify the key players in the market, their market share, strengths, weaknesses, and strategies.
"""
return call_llm(prompt)
def perform_porters_five_forces(data):
prompt = f"""
Generate a detailed analysis of the company's industry using Porter's Five Forces framework based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
The Porter's Five Forces analysis should assess the level of competition and profitability in the industry based on the bargaining power of suppliers and buyers, the threat of new entrants and substitutes, and the intensity of rivalry among existing competitors.
"""
return call_llm(prompt)
def analyze_industry_accommodation(data):
prompt = f"""
Generate a detailed analysis of the company's industry based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
The industry analysis should provide an overview of the key trends, challenges, and opportunities in the industry, as well as the company's position within the industry.
"""
return call_llm(prompt)
def list_major_players(data):
prompt = f"""
Generate a list of the major players in the company's industry based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
The list of major players should include the company's key competitors and their market share, products or services, and competitive advantages.
"""
return call_llm(prompt)
def analyze_business_sub_sector(data):
prompt = f"""
Generate a detailed analysis of the company's business sub-sector based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
Products/Services: {data["products_services"]}
The business sub-sector analysis should provide an in-depth look at the specific segment of the industry in which the company operates, including market trends, growth potential, and competitive landscape.
"""
return call_llm(prompt)
def generate_swot_analysis(data):
prompt = f"""
Generate a detailed SWOT analysis for the company based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
Products/Services: {data["products_services"]}
Target Market: {data["target_market"]}
Value Proposition: {data["value_proposition"]}
The SWOT analysis should identify the company's strengths, weaknesses, opportunities, and threats, taking into account both internal and external factors.
"""
return call_llm(prompt)
def generate_funding_request(data):
prompt = f"""
Generate a detailed funding request section based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
Funding Requirements: {data["funding_requirements"]}
The funding request should clearly state the amount of funding needed, how the funds will be used, and the expected return on investment for investors.
"""
return call_llm(prompt)
def create_financing_plan(data):
prompt = f"""
Generate a detailed financing plan and bank loan amortization schedule based on the following information:
Company Name: {data["company_name"]}
Funding Requirements: {data["funding_requirements"]}
The financing plan should outline the sources of funding, repayment terms, and projected cash flows to demonstrate the company's ability to service the debt.
"""
return call_llm(prompt)
def generate_pro_forma_income_statement(data):
prompt = f"""
Generate a pro forma income statement analysis based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The pro forma income statement should project the company's future revenues, expenses, and net income based on assumptions about growth, pricing, and cost structure.
"""
return call_llm(prompt)
def predict_revenue_expenses(data):
prompt = f"""
Generate a detailed analysis of the company's projected revenue and expenses based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The revenue and expense analysis should provide a breakdown of the key drivers of revenue and cost, and explain the assumptions used in the projections.
"""
return call_llm(prompt)
def generate_monthly_cash_flow(data):
prompt = f"""
Generate a monthly cash flow analysis for the company based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The monthly cash flow analysis should project the company's cash inflows and outflows on a monthly basis, taking into account factors such as sales, collections, payments, and financing activities.
"""
return call_llm(prompt)
def generate_pro_forma_annual_cash_flow(data):
prompt = f"""
Generate a pro forma annual cash flow analysis for the company based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The pro forma annual cash flow analysis should provide a summary of the expected cash inflows and outflows for the upcoming year, including assumptions about growth and expenses.
"""
return call_llm(prompt)
def generate_pro_forma_balance_sheet(data):
prompt = f"""
Generate a pro forma balance sheet analysis for the company based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The pro forma balance sheet should project the company's assets, liabilities, and equity based on expected growth and funding requirements.
"""
return call_llm(prompt)
def perform_break_even_analysis(data):
prompt = f"""
Generate a break-even analysis for the company based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The break-even analysis should determine the sales volume at which the company will cover its costs and begin to make a profit.
"""
return call_llm(prompt)
def calculate_payback_period(data):
prompt = f"""
Generate a payback period analysis for the company based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Funding Requirements: {data["funding_requirements"]}
The payback period analysis should calculate the time it will take for the company to recover its initial investment from cash inflows.
"""
return call_llm(prompt)
def generate_financial_graphs(data):
prompt = f"""
Generate a summary of the key financial graphs that should be included in the business proposal based on the following information:
Company Name: {data["company_name"]}
Current Revenue: {data["current_revenue"]}
Current Expenses: {data["current_expenses"]}
The financial graphs should visually represent the company's projected income statement, cash flow statement, and balance sheet.
"""
return call_llm(prompt)
def identify_risks_mitigations(data):
prompt = f"""
Generate a detailed analysis of the risks and mitigations for the company based on the following information:
Company Name: {data["company_name"]}
Industry: {data["industry"]}
The risk mitigations analysis should identify potential risks to the business and outline strategies to mitigate those risks.
"""
return call_llm(prompt)
#and for 17 question answer
def analyze_market_trends(data):
prompt = f"""
Analyze current market trends that could impact {data["company_name"]} based on the following information:
Industry: {data["industry"]}
Location: {data["location"]}
Target Market: {data["target_market"]}
The analysis should cover technological advancements, consumer behavior shifts, and regulatory changes relevant to the industry.
"""
return call_llm(prompt)
def generate_customer_personas(data):
prompt = f"""
Create detailed customer personas for {data["company_name"]} based on the following information:
Target Market: {data["target_market"]}
Products/Services: {data["products_services"]}
Each persona should include demographics, behaviors, motivations, and challenges that relate to how they would interact with your products or services.
"""
return call_llm(prompt)
def develop_sales_strategy(data):
prompt = f"""
Develop a sales strategy for {data["company_name"]} based on the following information:
Products/Services: {data["products_services"]}
Target Market: {data["target_market"]}
Promotional Strategy: {data["promotional_strategy"]}
The strategy should outline sales channels, sales team structure, and key performance indicators for sales.
"""
return call_llm(prompt)
def assess_technology_infrastructure(data):
prompt = f"""
Assess the technology infrastructure required for {data["company_name"]} based on the following:
Industry: {data["industry"]}
Products/Services: {data["products_services"]}
Operational Strategy: {data["operational_strategy"]}
The assessment should cover hardware, software, network requirements, and any specific technology needs for product development or service delivery.
"""
return call_llm(prompt)
def plan_human_resources(data):
prompt = f"""
Plan the human resources strategy for {data["company_name"]} based on the following:
Management Team: {data["management_team"]}
Goals and Objectives: {data["goals_objectives"]}
The plan should include recruitment strategies, training programs, and organizational culture development.
"""
return call_llm(prompt)
def outline_legal_compliance(data):
prompt = f"""
Outline the legal compliance requirements for {data["company_name"]} based on:
Location: {data["location"]}
Industry: {data["industry"]}
This should include any necessary licenses, permits, and compliance with local, national, or international laws relevant to the business operations.
"""
return call_llm(prompt)
def evaluate_supply_chain(data):
prompt = f"""
Evaluate the supply chain logistics for {data["company_name"]} based on:
Products/Services: {data["products_services"]}
Location: {data["location"]}
The evaluation should consider sourcing, manufacturing, distribution, and any potential disruptions or optimizations.
"""
return call_llm(prompt)
def plan_for_international_expansion(data):
prompt = f"""
Plan for international expansion for {data["company_name"]} based on:
Industry: {data["industry"]}
Target Market: {data["target_market"]}
The plan should address market entry strategies, cultural considerations, and adaptation of products or services for new markets.
"""
return call_llm(prompt)
def develop_crisis_management_plan(data):
prompt = f"""
Develop a crisis management plan for {data["company_name"]} based on:
Industry: {data["industry"]}
Location: {data["location"]}
This plan should outline responses to various crises like natural disasters, cyber-attacks, or public relations issues.
"""
return call_llm(prompt)
def analyze_intellectual_property(data):
prompt = f"""
Analyze the intellectual property strategy for {data["company_name"]} based on:
Products/Services: {data["products_services"]}
This should include patents, trademarks, copyrights, and strategies for protecting and leveraging IP.
"""
return call_llm(prompt)
def create_exit_strategy(data):
prompt = f"""
Create an exit strategy for investors in {data["company_name"]} based on:
Funding Requirements: {data["funding_requirements"]}
Goals and Objectives: {data["goals_objectives"]}
The strategy should discuss potential exit routes like acquisition, IPO, or buyback, and the timeline for these events.
"""
return call_llm(prompt)
def assess_sustainability_practices(data):
prompt = f"""
Assess sustainability practices for {data["company_name"]} based on:
Industry: {data["industry"]}
Operational Strategy: {data["operational_strategy"]}
This should cover environmental impact, sustainable sourcing, and corporate social responsibility initiatives.
"""
return call_llm(prompt) |