{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/frank-elite/miniconda3/envs/paintrekbot/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "import os\n", "\n", "from typing import Annotated, Literal\n", "from typing_extensions import TypedDict\n", "from langgraph.prebuilt import ToolNode\n", "from langchain_core.messages import HumanMessage\n", "from langgraph.graph import StateGraph, MessagesState, START, END\n", "from langgraph.checkpoint.memory import MemorySaver\n", "from langchain_google_genai import ChatGoogleGenerativeAI\n", "from tools import get_job, get_resume" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "GOOGLE_API_KEY=\"AIzaSyA8eIxHBqeBWEP1g3t8bpvLxNaH5Lquemo\"\n", "os.environ[\"GOOGLE_API_KEY\"] = GOOGLE_API_KEY\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "tools = [get_job, get_resume]\n", "llm = ChatGoogleGenerativeAI(model=\"gemini-1.5-flash-latest\").bind_tools(tools)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "def expert(state: MessagesState):\n", " system_message = \"\"\"\n", " You are a resume expert. You are tasked with improving the user resume based on a job description.\n", " You can access the resume and job data using the provided tools.\n", "\n", " You must NEVER provide information that the user does not have.\n", " These include, skills or experiences that are not in the resume. Do not make things up.\n", " \"\"\"\n", " messages = state[\"messages\"]\n", " response = llm.invoke([system_message] + messages)\n", " return {\"messages\": [response]}\n", "\n", "tool_node = ToolNode(tools)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "def should_continue(state: MessagesState) -> Literal[\"tools\", END]:\n", " messages = state['messages']\n", " last_message = messages[-1]\n", " if last_message.tool_calls:\n", " return \"tools\"\n", " return END" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "graph = StateGraph(MessagesState)\n", "\n", "graph.add_node(\"expert\", expert)\n", "graph.add_node(\"tools\", tool_node)\n", "\n", "graph.add_edge(START, \"expert\")\n", "graph.add_conditional_edges(\"expert\", should_continue)\n", "graph.add_edge(\"tools\", \"expert\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "checkpointer = MemorySaver()\n", "\n", "app = graph.compile(checkpointer=checkpointer)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "I can access and process information from a resume and a job description using the `get_resume()` and `get_job()` functions. Based on the content of both, I can identify areas where the resume could be improved to better match the job description. However, I will only use information explicitly present in the provided resume and job description. I cannot add skills or experiences that are not already listed in the resume.\n", "Based on the job title \"Software Engineer\" and the skills listed in the resume (\"Software Architecture\", \"System Optimization\", \"Team Mentorship\", \"Project Management\", \"API Development\", \"Continuous Integration/Continuous Deployment\", \"Bilingual\"), I can offer the following suggestions for improving the resume:\n", "\n", "* **Highlight relevant skills:** The resume should emphasize skills directly relevant to the \"Software Engineer\" role. For example, the \"API Development\" and \"Continuous Integration/Continuous Deployment\" skills should be prominently featured, perhaps with examples of projects where these skills were used.\n", "\n", "* **Quantify achievements:** Whenever possible, quantify accomplishments. Instead of simply listing \"Project Management,\" describe specific projects, the size of the team managed, and the positive outcomes achieved. Similarly, quantify successes in system optimization or software architecture.\n", "\n", "* **Tailor to the job description:** If the job description provides more detail (which it currently doesn't), further adjustments can be made to align the resume even more closely. For instance, if the job description emphasizes a specific programming language or framework, ensure that expertise in that area is highlighted.\n", "\n", "* **Consider adding a summary:** A brief summary at the beginning of the resume could highlight the most relevant skills and experience, immediately grabbing the reader's attention.\n", "\n", "I cannot make specific changes to the resume's content without knowing more about the specific projects and experiences. The suggestions above focus on improving the presentation and emphasizing the existing information to better match the job description.\n", "Exiting...\n" ] } ], "source": [ "while True:\n", " user_input = input(\">> \")\n", " if user_input.lower() in [\"quit\", \"exit\"]:\n", " print(\"Exiting...\")\n", " break\n", "\n", " response = app.invoke(\n", " {\"messages\": [HumanMessage(content=user_input)]},\n", " config={\"configurable\": {\"thread_id\": 1}}\n", " )\n", "\n", " print(response[\"messages\"][-1].content)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "paintrekbot", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.8" } }, "nbformat": 4, "nbformat_minor": 2 }