feat: Implement company querying functionality with natural language processing and logging
This commit is contained in:
+25
-1
@@ -1,4 +1,6 @@
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pandas as pd
|
||||
from db.db import Base, db_dependency, engine
|
||||
@@ -13,7 +15,8 @@ from routers import (
|
||||
projects,
|
||||
report_route,
|
||||
)
|
||||
from schemas.router_schemas import InvestmentResponse, PaginatedResponse
|
||||
from schemas.router_schemas import CompanyData, InvestmentResponse, PaginatedResponse
|
||||
from services.company_querying import CompanyQueryProcessor
|
||||
from services.llm_parser import InvestorProcessor
|
||||
from services.querying import QueryProcessor
|
||||
|
||||
@@ -114,6 +117,27 @@ async def query_investors(request: QueryRequest):
|
||||
return results
|
||||
|
||||
|
||||
@app.post(
|
||||
"/query-companies", response_model=PaginatedResponse[CompanyData], tags=["Querying"]
|
||||
)
|
||||
async def query_companies(request: QueryRequest):
|
||||
"""
|
||||
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"
|
||||
"""
|
||||
processor = CompanyQueryProcessor()
|
||||
results = processor.process_query(request.question)
|
||||
return results
|
||||
|
||||
|
||||
app.include_router(investors.router)
|
||||
app.include_router(companies.router)
|
||||
app.include_router(projects.router)
|
||||
|
||||
Reference in New Issue
Block a user