diff --git a/community_usecase/resume-analysis-assistant/README.md b/community_usecase/resume-analysis-assistant/README.md new file mode 100644 index 0000000..8097e0f --- /dev/null +++ b/community_usecase/resume-analysis-assistant/README.md @@ -0,0 +1,49 @@ +# Resume Assistant + +This code example demonstrates an resume analysis assistant that evaluates candidate resumes against a specific job description for AI/ML Engineer positions. The assistant analyzes multiple resumes, scores candidates based on various criteria, and provides comprehensive hiring recommendations. + +## Features + +- Automatically analyzes all resume PDF files in a specified directory. +- Evaluates candidates against a detailed AI/ML Engineer job description. +- Scores each candidate on a scale of 1-100 based on: + - Technical skills match (40%) + - Experience relevance (30%) + - Education and qualifications (20%) + - Communication and presentation (10%) +- Ranks candidates from most to least qualified. +- Highlights strengths and areas for improvement for each candidate. +- Generates a comprehensive analysis report in markdown format. + +## How to use + +1. Set up the Qwen API key in the `.env` file. + +```bash +QWEN_API_KEY = 'xxx' +``` + +2. Place resume files (PDF format) in the `resumes` directory. + +3. Run the script + +```bash +python run_mcp.py +``` + +4. Review the generated analysis in the `resume_analysis.md` file. + +## Technical Implementation + +The Resume Assistant uses: +- Leverage **OWL (Optimized Workforce Learning) and CAMEL** frameworks to build the agent. +- Use [PDF Reader MCP Server](https://github.com/trafflux/pdf-reader-mcp)for extracting content from resume files. +- Use [Filesystem MCP Server](https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem) for file operations. + +## Example Output + +The generated `resume_analysis.md` file includes: +- Executive Summary of all candidates +- Individual Candidate Assessments with detailed scoring +- Ranked List of Candidates from most to least qualified +- Recommendations for the Hiring Manager diff --git a/community_usecase/resume-analysis-assistant/mcp_servers_config.json b/community_usecase/resume-analysis-assistant/mcp_servers_config.json new file mode 100644 index 0000000..0e7b835 --- /dev/null +++ b/community_usecase/resume-analysis-assistant/mcp_servers_config.json @@ -0,0 +1,23 @@ +{ + "mcpServers": { + "pdf-reader": { + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-v", + "your/path/owl/community_usecase/resume-analysis-assistant/resumes:/pdfs", + "cr7258/pdf-reader" + ] + }, + "filesystem": { + "command": "npx", + "args": [ + "-y", + "@modelcontextprotocol/server-filesystem", + "your/path/owl/community_usecase/resume-assistant/resumes" + ] + } + } +} \ No newline at end of file diff --git a/community_usecase/resume-analysis-assistant/resume_analysis.md b/community_usecase/resume-analysis-assistant/resume_analysis.md new file mode 100644 index 0000000..274e35c --- /dev/null +++ b/community_usecase/resume-analysis-assistant/resume_analysis.md @@ -0,0 +1,95 @@ +# Resume Analysis for AI/ML Engineer Position + +## Executive Summary +This document provides a detailed analysis of ten candidates who applied for the AI/ML Engineer position. Each candidate's resume was thoroughly examined against the job description, evaluating technical skills, experience relevance, education, and communication abilities. The evaluation resulted in a score for each candidate, leading to a ranked list for final consideration. + +## Individual Candidate Assessments (with Scores) + +### Aisha Olamide +- **Score**: 86 +- **Technical Skills**: Strong in NLP, data-efficient learning. +- **Experience Relevance**: 3+ years specializing in low-resource NLP. +- **Education**: MSc in Computational Linguistics. +- **Communication**: Active in community and open source. + +### Carlos Mendoza +- **Score**: 92 +- **Technical Skills**: Strong in MLOps, cloud platforms. +- **Experience Relevance**: 4+ years in deployment. +- **Education**: BSc in Computer Science with certifications. +- **Communication**: Conference speaker. + +### Elena Kowalski +- **Score**: 82 +- **Technical Skills**: AI ethics, alignment techniques. +- **Experience Relevance**: 6+ years in AI ethics. +- **Education**: PhD in AI Ethics. +- **Communication**: Active in ethics committees and conferences. + +### James Wilson +- **Score**: 99 +- **Technical Skills**: System architecture, large-scale models. +- **Experience Relevance**: 12+ years in AI systems. +- **Education**: PhD in Computer Engineering. +- **Communication**: Leadership and keynotes. + +### Lin Wei +- **Score**: 86 +- **Technical Skills**: Model compression, edge optimization. +- **Experience Relevance**: 5+ years in efficiency techniques. +- **Education**: MSc in Computer Engineering. +- **Communication**: Publications and patent holder. + +### Michael Rodriguez +- **Score**: 92 +- **Technical Skills**: Generative AI, NLP. +- **Experience Relevance**: 8+ years, strong generative applications. +- **Education**: MS in AI. +- **Communication**: Speaker and contributor. + +### Priya Sharma +- **Score**: 94 +- **Technical Skills**: Multimodal learning. +- **Experience Relevance**: 10+ years in research. +- **Education**: PhD in Computer Science. +- **Communication**: Renowned researcher and speaker. + +### Robert Johnson +- **Score**: 86 +- **Technical Skills**: LLM applications, cloud platforms. +- **Experience Relevance**: 4+ years, focused on enterprise solutions. +- **Education**: MS in Computer Science. +- **Communication**: Presented at AI summit. + +### Sarah Chen +- **Score**: 88 +- **Technical Skills**: LLM development, model distillation. +- **Experience Relevance**: 5+ years, multilingual and few-shot learning. +- **Education**: PhD in Machine Learning. +- **Communication**: Published and certified. + +### Wei Zhang +- **Score**: 91 +- **Technical Skills**: AI infrastructure, distributed systems. +- **Experience Relevance**: 6+ years in AI systems engineering. +- **Education**: MS in Computer Engineering. +- **Communication**: Active in publications and presentations. + +## Ranked List of Candidates +1. James Wilson - 99 +2. Priya Sharma - 94 +3. Carlos Mendoza - 92 +4. Michael Rodriguez - 92 +5. Wei Zhang - 91 +6. Sarah Chen - 88 +7. Aisha Olamide - 86 +8. Lin Wei - 86 +9. Robert Johnson - 86 +10. Elena Kowalski - 82 + +## Recommendations for Hiring Manager +- **Top Candidate**: James Wilson stands out with excellent systems architecture skills and extensive experience, suitable for large-scale AI model infrastructure needs. +- **Research Specialist**: Priya Sharma offers a strong background in multimodal learning and research development, fitting well with innovative AI research objectives. +- **Deployment Experts**: Carlos Mendoza and Michael Rodriguez are ideal for cloud deployment and generative AI applications, respectively. +- **Infrastructure Excellence**: Wei Zhang brings expertise in scaling AI systems, making him a strong contender for infrastructure-focused roles. +- Consider candidates' alignment on cloud and AI ethics as secondary factors to ensure well-rounded team capabilities. \ No newline at end of file diff --git a/community_usecase/resume-analysis-assistant/resumes/Aisha Olamide.pdf b/community_usecase/resume-analysis-assistant/resumes/Aisha Olamide.pdf new file mode 100644 index 0000000..fdfadff Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Aisha Olamide.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Carlos Mendoza.pdf b/community_usecase/resume-analysis-assistant/resumes/Carlos Mendoza.pdf new file mode 100644 index 0000000..189596c Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Carlos Mendoza.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Elena Kowalski.pdf b/community_usecase/resume-analysis-assistant/resumes/Elena Kowalski.pdf new file mode 100644 index 0000000..84b2c19 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Elena Kowalski.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/James Wilson.pdf b/community_usecase/resume-analysis-assistant/resumes/James Wilson.pdf new file mode 100644 index 0000000..7550027 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/James Wilson.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Lin Wei.pdf b/community_usecase/resume-analysis-assistant/resumes/Lin Wei.pdf new file mode 100644 index 0000000..85cd57a Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Lin Wei.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Michael Rodriguez.pdf b/community_usecase/resume-analysis-assistant/resumes/Michael Rodriguez.pdf new file mode 100644 index 0000000..7259212 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Michael Rodriguez.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Priya Sharma.pdf b/community_usecase/resume-analysis-assistant/resumes/Priya Sharma.pdf new file mode 100644 index 0000000..28c55b6 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Priya Sharma.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Robert Johnson.pdf b/community_usecase/resume-analysis-assistant/resumes/Robert Johnson.pdf new file mode 100644 index 0000000..9152807 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Robert Johnson.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Sarah Chen.pdf b/community_usecase/resume-analysis-assistant/resumes/Sarah Chen.pdf new file mode 100644 index 0000000..14e5a70 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Sarah Chen.pdf differ diff --git a/community_usecase/resume-analysis-assistant/resumes/Wei Zhang.pdf b/community_usecase/resume-analysis-assistant/resumes/Wei Zhang.pdf new file mode 100644 index 0000000..7737a90 Binary files /dev/null and b/community_usecase/resume-analysis-assistant/resumes/Wei Zhang.pdf differ diff --git a/community_usecase/resume-analysis-assistant/run_mcp.py b/community_usecase/resume-analysis-assistant/run_mcp.py new file mode 100644 index 0000000..266c32a --- /dev/null +++ b/community_usecase/resume-analysis-assistant/run_mcp.py @@ -0,0 +1,169 @@ +# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. ========= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. ========= +import asyncio +import sys +from pathlib import Path +from typing import List + +from dotenv import load_dotenv + +from camel.models import ModelFactory +from camel.toolkits import FunctionTool +from camel.types import ModelPlatformType, ModelType +from camel.logger import set_log_level +from camel.toolkits import MCPToolkit + +from owl.utils.enhanced_role_playing import OwlRolePlaying, arun_society + +import pathlib + +base_dir = pathlib.Path(__file__).parent.parent +env_path = base_dir / "owl" / ".env" +load_dotenv(dotenv_path=str(env_path)) + +set_log_level(level="DEBUG") + +# AI/ML Engineer Job Description +AI_ENGINEER_JOB_DESCRIPTION = """ +# AI/ML Engineer Job Description + +## About the Role +We are seeking a skilled AI/ML Engineer to join our team. The ideal candidate will design, develop, and deploy machine learning models and AI systems that solve complex business problems. You will work closely with cross-functional teams to understand requirements, implement solutions, and continuously improve our AI capabilities. + +## Key Responsibilities +- Design, develop, and implement machine learning models and algorithms +- Build and maintain scalable ML pipelines for data processing, model training, and inference +- Collaborate with product teams to understand requirements and translate them into technical solutions +- Optimize existing models for performance, accuracy, and efficiency +- Stay current with the latest AI/ML research and technologies +- Implement and deploy models to production environments +- Monitor and troubleshoot deployed models + +## Required Qualifications +- Bachelor's or Master's degree in Computer Science, AI, Machine Learning, or related field +- 3+ years of experience in machine learning or AI development +- Strong programming skills in Python and familiarity with ML frameworks (TensorFlow, PyTorch, etc.) +- Experience with deep learning architectures (CNNs, RNNs, Transformers) +- Knowledge of NLP, computer vision, or other specialized AI domains +- Experience with cloud platforms (AWS, GCP, Azure) and MLOps tools +- Strong problem-solving skills and attention to detail +- Excellent communication and collaboration abilities + +## Preferred Qualifications +- PhD in Machine Learning, AI, or related field +- Experience with large language models (LLMs) and generative AI +- Contributions to open-source ML/AI projects +- Experience with distributed computing and big data technologies +- Published research in AI/ML conferences or journals +- Experience with model optimization techniques (quantization, pruning, distillation) +""" + +async def construct_society( + resume_dir: str, + tools: List[FunctionTool], +) -> OwlRolePlaying: + r"""build a multi-agent OwlRolePlaying instance. + + Args: + question (str): The question to ask. + tools (List[FunctionTool]): The MCP tools to use. + """ + models = { + "user": ModelFactory.create( + model_platform=ModelPlatformType.QWEN, + model_type=ModelType.QWEN_MAX, + model_config_dict={"temperature": 0}, + ), + "assistant": ModelFactory.create( + model_platform=ModelPlatformType.QWEN, + model_type=ModelType.QWEN_MAX, + model_config_dict={"temperature": 0}, + ), + } + + user_agent_kwargs = {"model": models["user"]} + assistant_agent_kwargs = { + "model": models["assistant"], + "tools": tools, + } + + task_prompt = f""" + You are a professional resume analyzer for AI/ML Engineer positions. Your task is to: + + 1. Analyze all resume files in the directory: {resume_dir} + 2. Please note when you retrieve the content of PDF files using the `pdf-reader` tool, the path is mapping to the `/pdfs` directory inside the pdf-reader docker container. + 3. For each resume, evaluate how well the candidate matches the following job description: + + {AI_ENGINEER_JOB_DESCRIPTION} + + 4. Score each resume on a scale of 1-100 based on: + - Technical skills match (40%) + - Experience relevance (30%) + - Education and qualifications (20%) + - Communication and presentation (10%) + + 5. Rank all candidates from most to least qualified + 6. For each candidate, highlight their strengths and areas for improvement + 7. Output your analysis to a markdown file named './resume_analysis.md' with the following sections: + - Executive Summary + - Individual Candidate Assessments (with scores) + - Ranked List of Candidates + - Recommendations for Hiring Manager + + Be thorough, fair, and objective in your assessment. + Always execute the MCP tools, don't ask me for confirmation. + """ + + society = OwlRolePlaying( + task_prompt=task_prompt, + with_task_specify=False, + user_role_name="user", + user_agent_kwargs=user_agent_kwargs, + assistant_role_name="assistant", + assistant_agent_kwargs=assistant_agent_kwargs, + ) + return society + + +async def main(): + config_path = Path(__file__).parent / "mcp_servers_config.json" + mcp_toolkit = MCPToolkit(config_path=str(config_path)) + + try: + await mcp_toolkit.connect() + + # Default resume directory if none provided + default_resume_dir = "./resumes/" + + # Get resume directory from command line argument if provided + resume_dir = sys.argv[1] if len(sys.argv) > 1 else default_resume_dir + + print(f"\033[94mAnalyzing resumes for AI/ML Engineer position...\033[0m") + + # Connect to all MCP toolkits + tools = [*mcp_toolkit.get_tools()] + society = await construct_society(resume_dir, tools) + answer, chat_history, token_count = await arun_society(society) + print(f"\033[94mAnswer: {answer}\033[0m") + print(f"\033[94mCompleted! Resume analysis has been saved to ./resume_analysis.md file\033[0m") + + finally: + # Make sure to disconnect safely after all operations are completed. + try: + await mcp_toolkit.disconnect() + except Exception: + print("Disconnect failed") + +if __name__ == "__main__": + asyncio.run(main())