diff --git a/app.py b/app.py new file mode 100644 index 0000000..89e6383 --- /dev/null +++ b/app.py @@ -0,0 +1,41 @@ +import faiss +from langchain_community.docstore.in_memory import InMemoryDocstore +from langchain_community.vectorstores import FAISS +from langchain_core.prompts import ChatPromptTemplate +from langchain.chains import create_retrieval_chain +from langchain.chains.combine_documents import create_stuff_documents_chain +from langchain_openai import OpenAIEmbeddings, ChatOpenAI +import openai +from openai import OpenAI +from langchain_community.document_loaders.csv_loader import CSVLoader +from pathlib import Path +from langchain_openai import ChatOpenAI,OpenAIEmbeddings +import os +from dotenv import load_dotenv +from fastapi import FastAPI, HTTPException +from pydantic import BaseModel +from scripts.rag import get_answer, response_agent +# Load environment variables from a .env file + + +# Initialize FastAPI app +app = FastAPI() + +# Define a request model +class QuestionRequest(BaseModel): + question: str + +@app.post("/ask") +def ask_question(request: QuestionRequest): + try: + # Use the RAG system to get the answer + calculation_data = get_answer(rag_chain, request.question) + final_response = response_agent(request.question, calculation_data) + return {"answer": final_response} + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + + +if __name__ == "__main__": + import uvicorn + uvicorn.run(app, host="0.0.0.0", port=5079) \ No newline at end of file diff --git a/docs/UpdateAI_training-company-data.md b/docs/UpdateAI_training-company-data.md new file mode 100644 index 0000000..e874f8c --- /dev/null +++ b/docs/UpdateAI_training-company-data.md @@ -0,0 +1,102 @@ +| Company Name | Investment Date | Investment Amount | Ownership % | Valuation | Current Revenue | ARR | MRR | Burn Rate | Runway (Months) | Next Funding | +|-------------|----------------|------------------|------------|-----------|----------------|-----|-----|-----------|-----------------|-------------| +| NexTech Solutions | 2023-08-15 | $2,500,000 | 18% | $15,000,000 | $1,800,000 | $2,100,000 | $175,000 | $280,000 | 9 | 2025-06 | +| Quantum Dynamics | 2024-01-23 | $5,000,000 | 22% | $28,000,000 | $3,200,000 | $3,600,000 | $300,000 | $450,000 | 11 | 2025-11 | +| BlueWave Analytics | 2023-11-10 | $1,750,000 | 15% | $12,500,000 | $1,450,000 | $1,800,000 | $150,000 | $210,000 | 8 | 2025-04 | +| Helios Energy Systems | 2024-02-05 | $8,500,000 | 25% | $38,000,000 | $4,200,000 | $4,800,000 | $400,000 | $650,000 | 13 | 2026-01 | +| OptiMind Technologies | 2023-06-30 | $3,200,000 | 20% | $17,500,000 | $2,100,000 | $2,400,000 | $200,000 | $320,000 | 10 | 2025-03 | +| Verdant Robotics | 2024-04-12 | $12,000,000 | 30% | $45,000,000 | $5,400,000 | $6,000,000 | $500,000 | $750,000 | 16 | 2026-06 | +| Pulse Medical Devices | 2023-09-18 | $4,800,000 | 24% | $22,000,000 | $2,600,000 | $3,000,000 | $250,000 | $380,000 | 13 | 2025-08 | +| Solstice AI | 2024-03-21 | $7,500,000 | 28% | $32,000,000 | $3,800,000 | $4,200,000 | $350,000 | $520,000 | 14 | 2025-12 | +| FusionWorks | 2023-07-25 | $2,100,000 | 16% | $14,000,000 | $1,650,000 | $1,920,000 | $160,000 | $240,000 | 9 | 2025-05 | +| Nimbus Security | 2024-02-18 | $6,300,000 | 26% | $27,000,000 | $3,100,000 | $3,480,000 | $290,000 | $420,000 | 15 | 2026-02 | +| Apex Logistics | 2023-10-05 | $3,800,000 | 21% | $19,500,000 | $2,300,000 | $2,640,000 | $220,000 | $350,000 | 11 | 2025-07 | +| Lunar Pharmaceuticals | 2024-01-07 | $9,500,000 | 32% | $35,000,000 | $4,000,000 | $4,560,000 | $380,000 | $580,000 | 16 | 2025-10 | +| Zenith Aerospace | 2023-05-15 | $4,200,000 | 23% | $20,000,000 | $2,400,000 | $2,760,000 | $230,000 | $360,000 | 12 | 2025-01 | +| Cobalt Cybersecurity | 2024-03-03 | $5,600,000 | 25% | $24,500,000 | $2,900,000 | $3,240,000 | $270,000 | $400,000 | 14 | 2025-11 | +| EchoStream Media | 2023-08-28 | $1,900,000 | 17% | $12,000,000 | $1,400,000 | $1,680,000 | $140,000 | $220,000 | 9 | 2025-06 | +| Prism Biotechnology | 2024-02-22 | $10,800,000 | 29% | $42,000,000 | $4,800,000 | $5,400,000 | $450,000 | $680,000 | 16 | 2026-03 | +| Vector Financial | 2023-11-30 | $3,500,000 | 19% | $19,000,000 | $2,200,000 | $2,520,000 | $210,000 | $330,000 | 11 | 2025-08 | +| Aurora Renewables | 2024-04-15 | $7,200,000 | 27% | $30,000,000 | $3,500,000 | $3,960,000 | $330,000 | $490,000 | 15 | 2026-05 | +| Titan Manufacturing | 2023-07-03 | $2,800,000 | 18% | $16,500,000 | $1,950,000 | $2,280,000 | $190,000 | $290,000 | 10 | 2025-04 | +| Orchid Health Systems | 2024-01-18 | $6,500,000 | 26% | $28,500,000 | $3,300,000 | $3,720,000 | $310,000 | $460,000 | 14 | 2025-12 | +| Nebula Computing | 2023-09-10 | $4,000,000 | 22% | $20,000,000 | $2,400,000 | $2,760,000 | $230,000 | $350,000 | 11 | 2025-07 | +| Ember Food Tech | 2024-03-05 | $5,400,000 | 24% | $24,000,000 | $2,800,000 | $3,120,000 | $260,000 | $390,000 | 14 | 2026-01 | +| Crest Telecom | 2023-06-20 | $3,000,000 | 19% | $17,000,000 | $2,000,000 | $2,280,000 | $190,000 | $300,000 | 10 | 2025-03 | +| Phoenix Nanotechnology | 2024-02-12 | $11,500,000 | 31% | $43,000,000 | $5,000,000 | $5,640,000 | $470,000 | $700,000 | 16 | 2026-04 | +| Meridian AgriTech | 2023-10-25 | $2,400,000 | 17% | $15,000,000 | $1,800,000 | $2,040,000 | $170,000 | $260,000 | 9 | 2025-06 | +| Polaris Virtual Reality | 2024-04-03 | $8,800,000 | 28% | $36,000,000 | $4,200,000 | $4,800,000 | $400,000 | $600,000 | 15 | 2026-05 | +| Zephyr Mobility | 2023-08-05 | $3,200,000 | 20% | $17,500,000 | $2,100,000 | $2,400,000 | $200,000 | $320,000 | 10 | 2025-05 | +| Elysium Genomics | 2024-01-30 | $6,800,000 | 26% | $29,000,000 | $3,400,000 | $3,840,000 | $320,000 | $480,000 | 14 | 2026-02 | +| Cascade Water Solutions | 2023-11-12 | $2,300,000 | 16% | $15,500,000 | $1,850,000 | $2,160,000 | $180,000 | $270,000 | 9 | 2025-07 | +| Atlas Construction Tech | 2024-03-18 | $5,900,000 | 25% | $26,000,000 | $3,000,000 | $3,360,000 | $280,000 | $420,000 | 14 | 2026-01 | +| Horizon EdTech | 2023-05-28 | $1,800,000 | 15% | $13,000,000 | $1,500,000 | $1,740,000 | $145,000 | $230,000 | 8 | 2025-02 | +| Orion Space Systems | 2024-02-25 | $9,200,000 | 30% | $37,000,000 | $4,300,000 | $4,920,000 | $410,000 | $620,000 | 15 | 2026-03 | +| GreenLeaf Sustainable | 2023-09-08 | $2,700,000 | 18% | $16,000,000 | $1,900,000 | $2,160,000 | $180,000 | $280,000 | 10 | 2025-06 | +| Nova Quantum Computing | 2024-04-20 | $11,000,000 | 32% | $40,000,000 | $4,600,000 | $5,280,000 | $440,000 | $660,000 | 17 | 2026-07 | +| Vortex AI | 2023-07-15 | $4,500,000 | 23% | $21,000,000 | $2,500,000 | $2,880,000 | $240,000 | $360,000 | 13 | 2025-05 | +| Radiant MedTech | 2024-01-04 | $7,000,000 | 27% | $30,000,000 | $3,500,000 | $3,960,000 | $330,000 | $500,000 | 14 | 2025-12 | +| Sapphire Analytics | 2023-10-10 | $3,600,000 | 21% | $18,500,000 | $2,200,000 | $2,520,000 | $210,000 | $330,000 | 11 | 2025-08 | +| Fusion Electric Vehicles | 2024-03-08 | $9,800,000 | 29% | $38,000,000 | $4,400,000 | $5,040,000 | $420,000 | $630,000 | 16 | 2026-04 | +| Sigma Automation | 2023-06-05 | $2,900,000 | 19% | $16,500,000 | $1,950,000 | $2,280,000 | $190,000 | $290,000 | 10 | 2025-03 | +| Eclipse Software | 2024-02-15 | $6,200,000 | 25% | $27,500,000 | $3,200,000 | $3,600,000 | $300,000 | $450,000 | 14 | 2026-01 | +| Tidal Wave Entertainment | 2023-08-22 | $2,000,000 | 16% | $13,500,000 | $1,600,000 | $1,860,000 | $155,000 | $250,000 | 8 | 2025-05 | +| Helix Biotech | 2024-04-05 | $8,000,000 | 28% | $33,000,000 | $3,800,000 | $4,320,000 | $360,000 | $540,000 | 15 | 2026-05 | +| Magna Hospitality Tech | 2023-11-05 | $3,300,000 | 20% | $18,000,000 | $2,100,000 | $2,400,000 | $200,000 | $310,000 | 11 | 2025-08 | +| Pinnacle Aerospace | 2024-01-25 | $10,500,000 | 31% | $39,000,000 | $4,500,000 | $5,160,000 | $430,000 | $640,000 | 16 | 2026-02 | +| Equinox Renewable Energy | 2023-05-10 | $4,100,000 | 22% | $20,500,000 | $2,400,000 | $2,760,000 | $230,000 | $350,000 | 12 | 2025-02 | +| Sentinel Cybersecurity | 2024-03-12 | $6,600,000 | 26% | $28,000,000 | $3,300,000 | $3,720,000 | $310,000 | $460,000 | 14 | 2026-01 | +| Cedar Healthcare Systems | 2023-09-28 | $2,600,000 | 18% | $15,500,000 | $1,850,000 | $2,160,000 | $180,000 | $270,000 | 10 | 2025-07 | +| Infinity Blockchain | 2024-02-28 | $7,800,000 | 27% | $32,000,000 | $3,700,000 | $4,200,000 | $350,000 | $520,000 | 15 | 2026-03 | +| Lumina Digital Media | 2023-07-20 | $3,400,000 | 20% | $18,500,000 | $2,200,000 | $2,520,000 | $210,000 | $320,000 | 11 | 2025-05 | +| Hyperion Logistics | 2024-04-18 | $5,500,000 | 24% | $25,000,000 | $2,900,000 | $3,360,000 | $280,000 | $420,000 | 13 | 2026-04 | +| Vertex Pharmaceuticals | 2023-10-15 | $9,000,000 | 29% | $35,000,000 | $4,100,000 | $4,680,000 | $390,000 | $580,000 | 16 | 2025-09 | +| Quasar Communications | 2024-01-15 | $4,700,000 | 23% | $22,500,000 | $2,600,000 | $3,000,000 | $250,000 | $380,000 | 12 | 2025-11 | +| Olympus Manufacturing | 2023-12-05 | $2,200,000 | 17% | $14,000,000 | $1,650,000 | $1,920,000 | $160,000 | $250,000 | 9 | 2025-09 | +| Starlight IoT Solutions | 2024-03-25 | $6,700,000 | 26% | $29,000,000 | $3,400,000 | $3,840,000 | $320,000 | $480,000 | 14 | 2026-03 | +| Terraforma AgriTech | 2023-06-12 | $3,700,000 | 21% | $19,000,000 | $2,250,000 | $2,580,000 | $215,000 | $330,000 | 11 | 2025-04 | +| Chronos AI | 2024-02-08 | $11,200,000 | 32% | $41,000,000 | $4,700,000 | $5,400,000 | $450,000 | $670,000 | 17 | 2026-04 | +| Oceanic Research | 2023-08-18 | $4,400,000 | 23% | $21,000,000 | $2,500,000 | $2,880,000 | $240,000 | $360,000 | 12 | 2025-06 | +| Nexus Robotics | 2024-04-22 | $8,300,000 | 28% | $34,000,000 | $3,900,000 | $4,440,000 | $370,000 | $550,000 | 15 | 2026-06 | +| Crystal Clear Water | 2023-11-18 | $2,500,000 | 18% | $15,000,000 | $1,800,000 | $2,040,000 | $170,000 | $260,000 | 10 | 2025-08 | +| Fusion Network Security | 2024-01-11 | $5,700,000 | 25% | $25,500,000 | $3,000,000 | $3,360,000 | $280,000 | $420,000 | 14 | 2025-12 | +| Borealis AR/VR | 2023-05-20 | $3,900,000 | 22% | $19,500,000 | $2,300,000 | $2,640,000 | $220,000 | $340,000 | 11 | 2025-02 | +| Eclipse Energy Storage | 2024-03-15 | $9,500,000 | 30% | $37,000,000 | $4,300,000 | $4,920,000 | $410,000 | $610,000 | 16 | 2026-03 | +| Catalyst BioSystems | 2023-09-20 | $4,900,000 | 24% | $22,500,000 | $2,650,000 | $3,000,000 | $250,000 | $380,000 | 13 | 2025-07 | +| Paradigm Software | 2024-02-20 | $6,900,000 | 26% | $29,500,000 | $3,450,000 | $3,900,000 | $325,000 | $490,000 | 14 | 2026-02 | +| Aether Cloud Services | 2023-07-28 | $3,500,000 | 20% | $18,500,000 | $2,200,000 | $2,520,000 | $210,000 | $330,000 | 11 | 2025-05 | +| Celestial Aerospace | 2024-04-10 | $10,200,000 | 31% | $38,500,000 | $4,450,000 | $5,100,000 | $425,000 | $630,000 | 16 | 2026-06 | +| Resonance Audio | 2023-10-20 | $2,100,000 | 16% | $14,000,000 | $1,650,000 | $1,920,000 | $160,000 | $240,000 | 9 | 2025-07 | +| Axiom MedTech | 2024-01-20 | $8,200,000 | 28% | $33,500,000 | $3,850,000 | $4,440,000 | $370,000 | $550,000 | 15 | 2026-01 | +| Cascade Software | 2023-12-10 | $3,800,000 | 21% | $19,500,000 | $2,300,000 | $2,640,000 | $220,000 | $340,000 | 11 | 2025-09 | +| Momentum Electric | 2024-03-28 | $7,300,000 | 27% | $31,000,000 | $3,600,000 | $4,080,000 | $340,000 | $510,000 | 14 | 2026-04 | +| Velvet Hospitality | 2023-06-25 | $2,800,000 | 18% | $16,500,000 | $1,950,000 | $2,280,000 | $190,000 | $280,000 | 10 | 2025-04 | +| Paragon AI | 2024-02-10 | $11,800,000 | 32% | $42,500,000 | $4,900,000 | $5,640,000 | $470,000 | $700,000 | 17 | 2026-04 | +| Emerald Renewables | 2023-08-10 | $4,600,000 | 23% | $22,000,000 | $2,550,000 | $3,000,000 | $250,000 | $370,000 | 12 | 2025-06 | +| Pantheon Blockchain | 2024-04-25 | $6,400,000 | 25% | $28,000,000 | $3,250,000 | $3,720,000 | $310,000 | $460,000 | 14 | 2026-05 | +| Quantum Agriculture | 2023-11-25 | $3,100,000 | 19% | $17,500,000 | $2,050,000 | $2,400,000 | $200,000 | $300,000 | 10 | 2025-09 | +| Solaris Energy | 2024-01-08 | $8,700,000 | 29% | $34,500,000 | $4,000,000 | $4,560,000 | $380,000 | $570,000 | 15 | 2025-12 | +| Argon Security | 2023-05-05 | $4,300,000 | 22% | $21,000,000 | $2,450,000 | $2,820,000 | $235,000 | $360,000 | 12 | 2025-01 | +| Zenith Data Systems | 2024-03-10 | $7,400,000 | 27% | $31,500,000 | $3,650,000 | $4,200,000 | $350,000 | $520,000 | 14 | 2026-02 | +| Lumen Biotech | 2023-09-15 | $5,100,000 | 24% | $23,000,000 | $2,700,000 | $3,120,000 | $260,000 | $390,000 | 13 | 2025-07 | +| Aurora MedSystems | 2024-02-17 | $9,600,000 | 30% | $37,500,000 | $4,350,000 | $4,980,000 | $415,000 | $620,000 | 16 | 2026-03 | +| Cerulean Water Tech | 2023-07-10 | $3,600,000 | 20% | $19,000,000 | $2,250,000 | $2,580,000 | $215,000 | $330,000 | 11 | 2025-04 | +| Nebula Space Tech | 2024-04-08 | $10,800,000 | 31% | $40,000,000 | $4,600,000 | $5,280,000 | $440,000 | $660,000 | 16 | 2026-06 | +| Meridian Networks | 2023-10-28 | $2,400,000 | 17% | $15,000,000 | $1,750,000 | $2,040,000 | $170,000 | $260,000 | 9 | 2025-08 | +| Vertex IoT | 2024-01-13 | $5,800,000 | 25% | $26,000,000 | $3,050,000 | $3,480,000 | $290,000 | $430,000 | 14 | 2025-12 | +| Equinox Logistics | 2023-12-15 | $4,000,000 | 22% | $20,000,000 | $2,350,000 | $2,700,000 | $225,000 | $350,000 | 11 | 2025-10 | +| Pulse Digital Health | 2024-03-30 | $6,000,000 | 25% | $26,500,000 | $3,100,000 | $3,540,000 | $295,000 | $440,000 | 14 | 2026-03 | +| Sapphire Technologies | 2023-06-15 | $3,000,000 | 19% | $17,000,000 | $2,000,000 | $2,280,000 | $190,000 | $300,000 | 10 | 2025-03 | +| Onyx Cybersecurity | 2024-02-02 | $7,600,000 | 27% | $32,000,000 | $3,700,000 | $4,260,000 | $355,000 | $530,000 | 14 | 2026-02 | +| Ember Renewable Energy | 2023-08-25 | $4,800,000 | 24% | $22,500,000 | $2,600,000 | $3,000,000 | $250,000 | $380,000 | 13 | 2025-06 | +| Titan Manufacturing Tech | 2024-04-28 | $8,900,000 | 29% | $35,500,000 | $4,100,000 | $4,740,000 | $395,000 | $590,000 | 15 | 2026-07 | +| Oceanic DataSystems | 2023-11-20 | $3,300,000 | 20% | $18,000,000 | $2,100,000 | $2,460,000 | $205,000 | $310,000 | 11 | 2025-09 | +| Phoenix Quantum | 2024-01-05 | $12,500,000 | 33% | $44,000,000 | $5,100,000 | $5,880,000 | $490,000 | $730,000 | 17 | 2026-01 | +| Eclipse Healthcare | 2023-05-25 | $4,500,000 | 23% | $21,500,000 | $2,500,000 | $2,880,000 | $240,000 | $370,000 | 12 | 2025-02 | +| Orion Telecom | 2024-03-20 | $6,100,000 | 25% | $27,000,000 | $3,150,000 | $3,600,000 | $300,000 | $450,000 | 14 | 2026-02 | +| Nova Pharmaceuticals | 2023-09-25 | $5,300,000 | 24% | $24,000,000 | $2,800,000 | $3,240,000 | $270,000 | $400,000 | 13 | 2025-08 | +| Polaris Aerospace | 2024-02-27 | $9,900,000 | 30% | $38,000,000 | $4,400,000 | $5,040,000 | $420,000 | $630,000 | 16 | 2026-03 | +| Crest Software | 2023-07-05 | $3,700,000 | 21% | $19,000,000 | $2,250,000 | $2,580,000 | $215,000 | $330,000 | 11 | 2025-04 | +| Fusion Robotics | 2024-04-15 | $8,500,000 | 28% | $34,000,000 | $3,950,000 | $4,500,000 | $375,000 | $560,000 | 15 | 2026-05 | +| Solstice Analytics | 2023-10-18 | $2,600,000 | 18% | $15,500,000 | $1,800,000 | $2,100,000 | $175,000 | $270,000 | 10 | 2025-07 | +| Radiant Health Tech | 2024-01-28 | $7,900,000 | 28% | $32,500,000 | $3,800,000 | $4,320,000 | $360,000 | $540,000 | 15 | 2026-02 | diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e36eb48 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +langchain-community +langchain_openai +openai +fastapi +uvicorn +faiss-cpu +python-dotenv \ No newline at end of file diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/__pycache__/__init__.cpython-312.pyc b/scripts/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..07c0157 Binary files /dev/null and b/scripts/__pycache__/__init__.cpython-312.pyc differ diff --git a/scripts/__pycache__/rag.cpython-312.pyc b/scripts/__pycache__/rag.cpython-312.pyc new file mode 100644 index 0000000..444cbc9 Binary files /dev/null and b/scripts/__pycache__/rag.cpython-312.pyc differ diff --git a/scripts/rag.py b/scripts/rag.py new file mode 100644 index 0000000..ade2b3f --- /dev/null +++ b/scripts/rag.py @@ -0,0 +1,111 @@ +import faiss +from langchain_community.docstore.in_memory import InMemoryDocstore +from langchain_community.vectorstores import FAISS +from langchain_core.prompts import ChatPromptTemplate +from langchain.chains import create_retrieval_chain +from langchain.chains.combine_documents import create_stuff_documents_chain +from langchain_openai import OpenAIEmbeddings, ChatOpenAI +import openai +from openai import OpenAI +from langchain_community.document_loaders.csv_loader import CSVLoader +from pathlib import Path +from langchain_openai import ChatOpenAI,OpenAIEmbeddings +import os +from dotenv import load_dotenv +from fastapi import FastAPI, HTTPException +from pydantic import BaseModel + +# Load environment variables from a .env file +load_dotenv() +OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") +client = OpenAI(api_key=OPENAI_API_KEY) + +# Initialize FastAPI app +app = FastAPI() + +# Define a request model +class QuestionRequest(BaseModel): + question: str + +@app.post("/update-stack/v1/ask") +def ask_question(request: QuestionRequest): + try: + # Use the RAG system to get the answer + calculation_data = get_answer(rag_chain, request.question) + final_response = response_agent(request.question, calculation_data) + return {"answer": final_response} + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + +def setup_rag_system(file_path, llm, embedding_function): + loader = CSVLoader(file_path=file_path) + docs = loader.load_and_split() + + index = faiss.IndexFlatL2(len(embedding_function.embed_query(" "))) + vector_store = FAISS( + embedding_function=embedding_function, + index=index, + docstore=InMemoryDocstore(), + index_to_docstore_id={} + ) + vector_store.add_documents(documents=docs) + + retriever = vector_store.as_retriever() + + system_prompt = ( + "You are an AI assistant that provides investment insights. " + "Use the Relevant Data to answer " + "the question. If you don't know the answer, say that you " + "don't know. Keep the " + "answer concise." + "\n\n" + "{context}" + ) + + prompt = ChatPromptTemplate.from_messages([ + ("system", system_prompt), + ("human", "{input}"), + ]) + + question_answer_chain = create_stuff_documents_chain(llm, prompt) + return create_retrieval_chain(retriever, question_answer_chain) + +def get_answer(rag_chain, user_input): + answer = rag_chain.invoke({"input": user_input}) + return answer['answer'] + +def response_agent(user_question, calculation_data): + response = client.chat.completions.create( + model="gpt-4o-mini", + messages=[ + { + "role": "system", + "content": """ + You are in a multi-agent system where your primary role is to provide investment insights. + Based on calculation data from another agent, + your primary goal is to carefully look at the user question and the calculation data from the user + and provide the response in a more direct and concise manner without mentioning calculation jargons. + + Example: + If the user asks, 'Which company is better in terms of ROI, Company A or Company B?', + the first agent might respond with calculations and comparisons. However, your role is to provide a + clear and direct answer like: 'Company B is better than Company A in terms of ROI.' + """ + }, + {"role": "user", "content": f"""User question: {user_question}\nCalculation data: {calculation_data}"""} + ], + temperature=0.5 + ) + return response.choices[0].message.content + + +if __name__ == "__main__": + # Initialize OpenAI LLM and Embeddings + llm = ChatOpenAI(model="gpt-4o-mini") # Use the appropriate model + embedding_function = OpenAIEmbeddings() + + # Set up the RAG system + file_path = r'/Users/macbook/Downloads/UpdateAI_training-company-data.md' + rag_chain = setup_rag_system(file_path, llm, embedding_function) + +