TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

AI_ML architecture

How TalentSync wires models, prompts, and LangChain into the FastAPI backend.

Repository layout#

The AI/ML architecture spans two primary environments:

  • Standalone analysis service: A Streamlit-based application that loads pre-trained models and performs inference on uploaded resumes.
  • Production backend: A FastAPI application exposing REST endpoints that integrate with LangChain-based workflows and agents.

Building blocks#

  • Standalone analysis service: Loads a trained gradient boosting classifier and a fitted TF-IDF vectorizer to predict candidate categories from resumes. It supports single-file and ZIP-based batch processing and writes results to a MySQL-compatible database.
  • Production backend: Exposes REST endpoints for resume analysis, ATS evaluation, cold mail generation, cover letter generation, and tailored resume creation. It integrates LangChain-based workflows and agents for complex reasoning and orchestration.
  • Prompt engineering framework: Centralized prompt templates under data/prompt/* for consistent instruction formatting across workflows.
  • Agent framework: Specialized agents (web search, GitHub, content retrieval) that can be orchestrated by services to augment AI workflows.
  • Model artifacts: Persisted model and vectorizer artifacts for inference in both analysis and production contexts.

Code to read:

  • Standalone inference pipeline and model persistence
  • Production API routing and middleware
  • Agent definitions and usage patterns

How it fits together#

The system employs a hybrid architecture:

  • Batch processing: The analysis notebook trains and evaluates models offline, generating artifacts consumed by the standalone service.
  • Real-time inference: The standalone service performs on-demand inference on uploaded resumes and stores results.
  • Production workflows: The backend exposes endpoints that delegate complex tasks to LangChain-based services and agents, enabling dynamic prompt engineering and multi-step reasoning.

Standalone analysis service#

The standalone service encapsulates:

  • Text preprocessing: Cleaning, lemmatization, and stopword removal using spaCy and NLTK.
  • Feature extraction: TF-IDF vectorization applied to cleaned text.
  • Prediction: Gradient boosting classifier predicts candidate categories.
  • Output: Writes structured results to a database table and displays them via Streamlit.

Production API endpoints and routing#

The backend defines a detailed set of routes organized by feature domains:

  • v1 and v2 endpoints for resume analysis, ATS evaluation, cold mail, cover letter, tailored resume, JD editor, and interview workflows.
  • Middleware for request/response logging and request ID correlation.
  • CORS configuration for frontend-backend integration.

Prompt engineering framework#

The prompt engineering framework centralizes instructions and templates:

  • Located under data/prompt/* for each domain (ATS analysis, cold mail, interview evaluator, etc.).
  • Services import and format prompts consistently, enabling iterative improvements without code changes.

Agent-Based workflows#

The agent framework provides reusable capabilities:

  • Web search agent for external information retrieval.
  • GitHub agent for repository and code analysis.
  • Web content agent for fetching and processing online content.

These agents can be invoked by services to augment workflows with external data and reasoning.

Machine learning pipeline#

The ML pipeline comprises:

  • Data preparation: Cleaning and normalization of resume text.
  • Feature extraction: TF-IDF vectorization.
  • Model training: Gradient boosting classifier with hyperparameter tuning.
  • Persistence: Saved model and vectorizer artifacts for inference.

Integration between analysis notebook, models, and production API#

  • The notebook trains and persists the model and vectorizer.
  • The standalone service loads these artifacts for inference.
  • The production backend routes requests to services that may use LangChain agents and prompts for richer workflows.

Dependencies#

Backend layers stay distinct:

  • Routes depend on services for business logic.
  • Services depend on agents, prompts, and core infrastructure.
  • Core provides LLM configuration, encryption, logging, and settings.
  • Data/prompt contains centralized prompt templates.
  • Agents encapsulate specialized capabilities.

Performance#

  • Batch vs. real-time inference: The analysis notebook and standalone service are suited for batch processing; the backend focuses on real-time inference via LangChain workflows.
  • Model artifacts: Persisted models and vectorizers enable fast inference without retraining overhead.
  • Prompt caching: Centralized prompt templates reduce repeated computation and improve consistency.
  • Middleware logging: Structured request/response logging aids in performance monitoring and debugging.
  • Asynchronous design: The backend uses async-first patterns for I/O-bound operations.

[No sources needed since this section provides general guidance]

Troubleshooting#

Common issues:

  • Model loading errors: Verify persisted model and vectorizer paths and ensure correct serialization format.
  • Prompt formatting problems: Confirm prompt templates exist and are properly imported by services.
  • Agent invocation failures: Validate agent availability and required credentials or environment variables.
  • CORS and middleware: Ensure CORS origins and middleware are configured correctly for frontend-backend communication.
  • Database connectivity: Confirm database credentials and connection parameters for result storage.