Files
Anton_wireframe/app/__pycache__/main.cpython-312.pyc
T

71 lines
6.5 KiB
Plaintext
Raw Normal View History

Ë
äÂÿhtãólddlZddlZddlZddlZddlmZmZmZddl m
Z
ddl m Z m
Z
mZmZddlmZddlmZmZmZmZmZmZddlmZmZmZddlmZdd lm Z dd
l!m"Z"e
«ejFejHd ejJ«g¬ «ejLe'«Z(e(jSd
ejTd««dZ+e+«e «Z,Gdde«Z-e,j]d«d«Z/e,jaddge1e2¬«e
d«ed«fdedede3fd«Z4e,jadeedg¬«de-fd „«Z5e,jad!eedg¬«de-fd"„«Z6e,joejp«e,joejp«e,joejp«e,joejp«e,joejp«e,joejp«e'd#k(rddl9Z9e9jtd$d%d&¬'«yy)(éN)ÚBaseÚ
db_dependencyÚengine)Ú load_dotenv)ÚFastAPIÚFileÚFormÚ
UploadFile)Ú BaseModel)Ú companiesÚfolk_crmÚ
insight_routeÚ investorsÚprojectsÚ report_route)Ú CompanyDataÚInvestmentResponseÚPaginatedResponse)ÚCompanyQueryProcessor)ÚInvestorProcessor)ÚQueryProcessorz4%(asctime)s - %(name)s - %(levelname)s - %(message)s)ÚlevelÚformatÚhandlerszfolk api key: Ú FOLK_API_KEYcóLtjjt¬«y)z.Initialize the database by creating all tables)ÚbindN)rÚmetadataÚ
create_allr©óú?/home/oluwasanmi/Documents/Work/MKD/anton_wireframe/app/main.pyÚ
init_databaser#"sä‡MM×Ѥ&ÐÕ)r!có,eZdZUeed<Gdd«Zy)Ú QueryRequestÚquestioncóeZdZdddiiZy)úQueryRequest.ConfigÚexampler&zDFind me deep tech investors that do deals in Europe under 5 million.N)Ú__name__Ú
__module__Ú __qualname__Újson_schema_extrar r!r"ÚConfigr(0sà ØÐð
Ñr!r.N)r*r+r,ÚstrÚ__annotations__r.r r!r"r%r%-s؃M÷
ò
r!r%ú/có
ddiS)HelloÚWorldr r r!r"Úhealthr58s
à  Ðr!z
/parse-csvz
CSV Upload)ÚtagsÚresponse_model.ÚdbÚfileÚ is_investorcƒóFK|j«ƒd{}tjtj|j d«««}t
«}|dk(r|j|d¬«ƒd{}|S|j|d¬«ƒd{}|S7Œ„7Œ%7Œ
­w)a{
Parse and import CSV data into the database.
**For investors:**
- Expected columns: Name, Website, Final Investor Profile, Final Profile sourcing
- Manually parses JSON profiles for efficiency
- Uses LLM only for currency conversion to USD
- Handles AUM, fund sizes, and check sizes as integers
**For companies:**
- Expected columns: Name, Website, Perplexity Gap Output (or Final Investor Profile)
- 100% manual JSON parsing - no LLM needed
- **Only extracts:** founded_year and key_executives
- **Only updates companies already in the database** (syncs with existing records)
- Skips companies not found in the database
**Benefits:**
- Fast processing (5-10s per record)
- Low cost (minimal or no LLM usage)
- Accurate data extraction
- Automatic database persistence
- Safe: won't create duplicate companies
Nzutf-8éT)Ú
save_to_db) ÚreadÚpdÚread_csvÚioÚStringIOÚdecoderÚparse_investorsÚparse_companies)r8r9r:ÚcontentÚdfÚ processorÚresultss r"Ú parse_csvrJ=s—èø€ð8—I‘I“K×€GÜ ”R—[‘[ §¡°Ó!8Ó9Ó :€Bô#€Iàà!×1°"ÀÐF×Fˆàˆð"×1°"ÀÐàˆð øðGøð
Gús4B!B—A B!Á7BÁ8B!ÂBÂB!ÂB!ÂB!z/queryÚQuerying)r7r6ÚrequestcƒóXKt«}|j|j«}|S­w)
Query investors using natural language.
Returns fund-level matches (one row per fund) with investor details.
This ensures only relevant funds are included in the response.
Supports queries like:
- "Show me seed stage investors"
- "Find fintech investors in Silicon Valley"
- "Growth stage investors with $5M+ check sizes"
- "Healthcare investors in Europe"
)rÚ
process_queryr&©rLrHrIs r"Úquery_investorsrPks+èø€ô Ó €IØ×% g×&6Ñ&6Ó7€GØ €Nùó(*z/query-companiescƒóXKt«}|j|j«}|S­w)a
Query companies using natural language.
Returns company matches with their investor relationships, team members, and sectors.
Supports queries like:
- "Show me fintech companies founded in 2020"
- "Find healthcare companies in San Francisco"
- "Companies in the AI sector"
- "Companies that received funding from Sequoia"
- "European startups founded after 2019"