Kaito117's picture
add readme, add defaults and uuid creation in routes
8cf6b7b
from fastapi import APIRouter
import uuid
from pydantic import BaseModel
from app.core.job_parser import JobParserAgent
from app.models.schemas import JobProcessingRequest, JobProcessingResponse
from app.services.agent import LinkedInSourcingAgent
router = APIRouter()
class HTTPJobRequest(BaseModel):
job_id: str = None
search_query: str
max_candidates: int = 50
include_github: bool = False
confidence_threshold: float = 0.3
@router.post("/jobs", response_model=JobProcessingResponse)
async def process_job(req: HTTPJobRequest):
req.job_id = str(uuid.uuid4())
parser = JobParserAgent()
job_desc = await parser.parse(req.search_query)
request = JobProcessingRequest(
job_description=job_desc,
max_candidates=req.max_candidates,
include_github=req.include_github,
confidence_threshold=req.confidence_threshold,
)
agent = LinkedInSourcingAgent()
response = await agent.process_job(request)
response.job_id = req.job_id
return response