From 88fa6d670c1b04334ad8a74b57085600e5d1f7d3 Mon Sep 17 00:00:00 2001 From: om_karande Date: Tue, 6 Oct 2026 12:29:33 +0530 Subject: [PATCH] feat: initial commit of Autonomous AI Job Discovery Agent --- .gitignore | 15 +++++ README.md | 73 +++++++++++++++++++++++ job_agent.py | 127 ++++++++++++++++++++++++++++++++++++++++ llama3_terminal_chat.py | 49 ++++++++++++++++ requirements.txt | 5 ++ 5 files changed, 269 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 job_agent.py create mode 100644 llama3_terminal_chat.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe2df28 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# Environments +.venv/ +venv/ +ENV/ +env/ + +# Python cache +__pycache__/ +*.py[cod] +*$py.class + +# Secrets & Local Config +.env +*.local +*.log \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..af5c890 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# Autonomous AI Job Discovery & Evaluation Agent + +An autonomous agentic workflow combining **live web search** (DuckDuckGo Search) and **local LLM reasoning** (Ollama + Llama 3 8B via LangChain) to discover, filter, match, and draft tailored application pitches for remote AI/ML and GenAI engineering roles. + +--- + +## 📌 Architecture & Features + +```text +[ Target Job Queries ] + │ + ▼ +[ LiveJobFetcher ] ───> DuckDuckGo Live Search API (LinkedIn, Naukri, Indeed) + │ + ▼ +[ Anti-Spam Filter ] ───> Excludes fraudulent listings (registration fees, deposits) + │ + ▼ +[ AIJobAgent ] ───> Local Ollama (Llama 3 8B) + LangChain PromptTemplate + │ + ▼ +[ Output Report ] + ├── 🎯 Objective Match Score (0 - 100%) + ├── 💡 Core Matching Skills + ├── ✉️ Tailored 3-Sentence HR Pitch + └── 🔗 Direct Apply Link +``` + +### Key Components + +1. **`job_agent.py`**: + - Multi-query search aggregator querying verified job listings from LinkedIn, Naukri, and Indeed. + - Built-in anti-spam heuristics. + - Profile-aware evaluation using LangChain's pipeline (`prompt | llm`). +2. **`llama3_terminal_chat.py`**: + - Interactive terminal chat assistant supporting multilingual dialogue (Marathi & English) with streaming generation and conversational memory. + +--- + +## 🚀 Quick Start + +### 1. Prerequisites + +Ensure you have [Ollama](https://ollama.com/) installed and running locally with the `llama3:8b` model pulled: + +```bash +ollama pull llama3:8b +ollama serve +``` + +### 2. Install Dependencies + +```bash +python -m venv venv +# Windows: +.\venv\Scripts\activate +# Linux/macOS: +source venv/bin/activate + +pip install -r requirements.txt +``` + +### 3. Run the Job Discovery Agent + +```bash +python job_agent.py +``` + +### 4. Run the Interactive Chat Assistant + +```bash +python llama3_terminal_chat.py +``` \ No newline at end of file diff --git a/job_agent.py b/job_agent.py new file mode 100644 index 0000000..d060ac0 --- /dev/null +++ b/job_agent.py @@ -0,0 +1,127 @@ +import time +from ddgs import DDGS +from langchain_ollama import OllamaLLM +from langchain_core.prompts import PromptTemplate + +# Broad & High-Yield Search Queries (LinkedIn, Naukri, Indeed) +TARGET_QUERIES = [ + "AI ML Engineer Intern Remote jobs LinkedIn Naukri", + "Generative AI Developer Remote internship Naukri Indeed", + "Data Engineer Intern Remote jobs LinkedIn" +] + +# ------------------------------------------------------------------- +# 1. Open Live Web Search Aggregator +# ------------------------------------------------------------------- +class LiveJobFetcher: + def __init__(self): + self.ddgs = DDGS() + + def fetch_jobs(self, query): + print(f"🔍 Searching Live Jobs: '{query}'...") + cleaned_jobs = [] + try: + # Fetching fresh web results + results = list(self.ddgs.text(query, max_results=5)) + for item in results: + title = item.get("title", "N/A") + snippet = item.get("body", "") + link = item.get("href", "N/A") + + # Anti-Spam Check + if "registration fee" in snippet.lower() or "deposit" in snippet.lower(): + continue + + cleaned_jobs.append({ + "title": title, + "company": "Verified Portal Listing", + "platform": "Live Web Search", + "location": "Remote", + "jd": snippet[:400], + "apply_link": link + }) + return cleaned_jobs + except Exception as e: + print(f"❌ Fetch Error: {e}") + return [] + + +# ------------------------------------------------------------------- +# 2. AI Evaluator Agent (Llama 3 8B) +# ------------------------------------------------------------------- +class AIJobAgent: + def __init__(self): + self.llm = OllamaLLM(model="llama3:8b", temperature=0.1, num_ctx=1024) + + def evaluate_and_match(self, user_resume, job_details): + prompt = PromptTemplate.from_template( + """ + You are a Senior AI Recruiter. Evaluate this live job opportunity for a candidate. + + Candidate Resume Profile: + {resume} + + Live Job Listing Title: {job_title} + Job Details/Snippet: + {jd} + + Perform the following analysis: + 1. Match Score (%): Objective score from 0% to 100% based on technical skills. + 2. Core Matching Skills: List top 2-3 matching technical skills. + 3. HR Outreach Note: Draft a concise 3-sentence application pitch for HR. + + Output Format: + Match Score: [Score]% + Key Matches: [Skills] + Tailored HR Pitch: [Message] + """ + ) + + chain = prompt | self.llm + return chain.invoke({ + "resume": user_resume, + "job_title": job_details["title"], + "jd": job_details["jd"] + }) + + +# ------------------------------------------------------------------- +# 3. Main Execution Workflow +# ------------------------------------------------------------------- +if __name__ == "__main__": + fetcher = LiveJobFetcher() + agent = AIJobAgent() + + my_resume_profile = """ + B.Tech AI/ML Student skilled in Python, SQL, PyTorch, LangChain, ChromaDB, + Ollama (Llama 3 8B), Streamlit, RAG Systems, Data Structures, and Agentic Workflows. + """ + + print("="*65) + print("🤖 Autonomous AI Job Discovery Agent (Live Engine)") + print("="*65 + "\n") + + all_fetched_jobs = [] + seen_links = set() + + for query in TARGET_QUERIES: + jobs = fetcher.fetch_jobs(query) + for j in jobs: + if j["apply_link"] not in seen_links: + seen_links.add(j["apply_link"]) + all_fetched_jobs.append(j) + time.sleep(1) + + print(f"\n✅ Total Unique Live Jobs Found: {len(all_fetched_jobs)}\n") + + if all_fetched_jobs: + for idx, job in enumerate(all_fetched_jobs[:3], 1): + print(f"--- 📍 Job #{idx}: {job['title']} ---") + + evaluation = agent.evaluate_and_match(my_resume_profile, job) + print("\n🧠 AI Evaluation & HR Pitch:") + print(evaluation) + print(f"\n🔗 Direct Apply Link: {job['apply_link']}") + print("-" * 65 + "\n") + else: + print("⚠️ No jobs found.") \ No newline at end of file diff --git a/llama3_terminal_chat.py b/llama3_terminal_chat.py new file mode 100644 index 0000000..324d5d9 --- /dev/null +++ b/llama3_terminal_chat.py @@ -0,0 +1,49 @@ +import ollama + +print("="*50) +print("🤖 Llama 3 (8B) AI Bot - Memory Mode Enabled") +print("💡 बाहेर पडण्यासाठी 'exit' किंवा हिस्ट्री साफ करण्यासाठी 'clear' टाईप करा.") +print("="*50 + "\n") + +# चॅट हिस्ट्री स्टोअर करण्यासाठी रिकामी लिस्ट +conversation_history = [] + +while True: + user_input = input("\nYou: ") + + # बाहेर पडण्यासाठी + if user_input.lower() == 'exit': + print("\nBot: धन्यवाद! पुन्हा भेटूया 👋") + break + + # जुनी हिस्ट्री क्लिअर करण्यासाठी + if user_input.lower() == 'clear': + conversation_history = [] + print("\n🧹 चॅट हिस्ट्री क्लिअर झाली आहे!") + continue + + if not user_input.strip(): + continue + + # युझरचा मेसेज लिस्टमध्ये ॲड करणे + conversation_history.append({'role': 'user', 'content': user_input}) + + print("\nAI Bot: ", end="", flush=True) + + # संपूर्ण हिस्ट्री Ollama ला पाठवणे + stream = ollama.chat( + model='llama3:8b', + messages=conversation_history, + stream=True, + ) + + full_response = "" + for chunk in stream: + content = chunk['message']['content'] + print(content, end='', flush=True) + full_response += content + + print() # New line + + # AI चे उत्तरसुद्धा लिस्टमध्ये सेव्ह करणे (पुढच्या संवादासाठी) + conversation_history.append({'role': 'assistant', 'content': full_response})! \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..39e4b96 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +duckduckgo_search>=6.0.0 +langchain>=0.2.0 +langchain-ollama>=0.1.0 +langchain-core>=0.2.0 +ollama>=0.2.0 \ No newline at end of file