CoolFace
Apppublic

martinimarcello00/personal-cv-langgraph

sourceHugging Facemitupdated 3d agoView on Hugging Face
0likes
App README

LangGraph CV Agent

An autonomous agent designed to answer questions about Marcello Martini's professional profile, portfolio, and expertise. This agent leverages LangGraph for orchestration and RAG (Retrieval Augmented Generation) to provide accurate, context-aware responses based on structured data and project documentation.

✨ Features

  • Autonomous Reasoning: Uses LangGraph to plan multi-step actions and execute tool calls efficiently.
  • Advanced RAG & Retrieval:
  • Hybrid Search: Combines semantic vector search with BM25 keyword matching for superior retrieval accuracy
  • Optimized Embeddings: Uses BAAI/bge-small-en-v1.5 for better semantic understanding
  • Smart Chunking: Markdown-aware chunking preserves document structure
  • Cached Performance: Vector store caching for faster repeated queries
  • Intelligent Introduction Management: Dedicated greeting system for natural first interactions
  • Portfolio Tools:
  • Tech Stack Search: Filter projects by technology (e.g., "projects using LangGraph", "Kubernetes projects")
  • Portfolio Retrieval: Searches and retrieves details about specific projects
  • Structured Data Access: Queries structured YAML data for Experience, Education, and Certifications
  • Email Capability: Can send CV via Mailgun
  • Optimized Memory: Reduced context window (4 messages) for faster processing
  • Robustness & Security:
  • Rate Limiting: Integrated slowapi to limit requests (e.g., 5 requests/minute)
  • Token Usage Tracking: Monitors execution to stay within daily budget
  • Interactive UI: Built-in Gradio interface for easy interaction
  • API First: FastAPI endpoints with optional streaming support

🚀 Setup locally

Prerequisites

  • Python 3.10+
  • Docker (optional)

Installation

  1. 1.Clone the repository
bash
   git clone https://github.com/martinimarcello00/langgraph-cv-agent.git
   cd langgraph-cv-agent
  1. 1.Create a virtual environment
bash
   python -m venv .venv
   source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. 1.Install dependencies
bash
   pip install -r requirements.txt
  1. 1.Configuration Copy the example environment file and configure your keys:
bash
   cp .env.example .env

Edit .env and add your OPENAI_API_KEY.

  1. 1.Build the index & run The index and the prompt catalogue are built from corpus/corpus.json, which is synced from the website. The Docker image bakes them in at build time; locally you build them once:
bash
   python build_index.py
   uvicorn api:app --reload --port 8000

Access the UI at http://localhost:8000.

🔑 Environment Variables

See .env.example for a complete list.

VariableDescriptionRequired
OPENAI_API_KEYYour OpenAI API Key (GPT-4o/GPT-5-nano).Yes
OPENAI_ADMIN_API_KEYFallback key for usage tracking if distinct from main key.No
DAILY_TOKEN_LIMITMax tokens per day (default 50000).No
MAILGUN_API_KEYAPI Key for Mailgun (if email features needed).No
MAILGUN_URLMailgun API Base URL.No
MAILGUN_SENDERSender email address for Mailgun.No

🛠️ API Endpoint

The agent exposes a REST API via FastAPI.

Endpoint: POST /chat

Request:

json
{
  "message": "What is Marcello's latest project?",
  "thread_id": "user-session-123"
}

Response:

json
{
  "response": "Marcello's latest project is..."
}

☁️ Hosting on Hugging Face Spaces

This project is configured to deploy easily to Hugging Face Spaces using the Docker SDK.

1. Create a Space

  1. 1.Go to Hugging Face Spaces and create a new Space.
  2. 2.Select Docker as the SDK.

2. Configure Secrets (on Hugging Face)

In your Space settings, go to the Settings tab and find Variables and secrets. Add the following Secrets:

  • OPENAI_API_KEY: Your OpenAI API Key.
  • (Optional) MAILGUN_API_KEY, etc.

3. Continuous Deployment (GitHub Actions)

This repo includes a GitHub Action (.github/workflows/sync-hf-space.yml) to automatically sync changes to your Space.

Setup GitHub Secrets:

  1. 1.Go to your GitHub repository Settings -> Secrets and variables -> Actions.
  2. 2.Add the following Repository Secrets:
  3. 3.HF_TOKEN: A Hugging Face Access Token with write permissions (create one in your HF settings).
  1. 1.Add the following Repository Variables:
  2. 2.HF_USERNAME: Your Hugging Face username.
  3. 3.HF_SPACE_NAME: The name of the Space you created (e.g., langgraph-cv-agent).

Once configured, every push to the main branch will automatically build and deploy the latest version to your Hugging Face Space.