Skip to content

Commit

Permalink
fixing tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
takline committed Jul 8, 2024
1 parent ea6db3d commit 31fe94f
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 234 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ ResumeGPT then creates a new resume YAML file in a new folder named after the jo
<img src="images/example_resume_output.png" alt="Resume Example" width="400"/>
</p>




## Discussions
Feel free to give feedback, ask questions, report a bug, or suggest improvements:

Expand All @@ -85,3 +88,6 @@ Feel free to give feedback, ask questions, report a bug, or suggest improvements

## Contributors
⭐️ Please star, fork, explore, and contribute to ResumeGPT. There's a lot of work room for improvement so any contributions are appreciated.



2 changes: 1 addition & 1 deletion config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
logger = logging.getLogger(__name__)

# Your resume filename here:
YOUR_RESUME_NAME = "example_resume.yaml"
YOUR_RESUME_NAME = "sample_resume.yaml"

# Define project paths
PROJECT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down
82 changes: 0 additions & 82 deletions data/example_resume.yaml

This file was deleted.

7 changes: 6 additions & 1 deletion services/langchain_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@
from typing import List
from dateutil import parser as dateparser
from dateutil.relativedelta import relativedelta
from langchain.cache import InMemoryCache
from langchain_openai import ChatOpenAI
import langchain
from langchain_community.cache import InMemoryCache
from .. import config

# Set up LLM cache
langchain.llm_cache = InMemoryCache()


def create_llm(**kwargs):
"""Create an LLM instance with specified parameters."""
chat_model = kwargs.pop("chat_model", ChatOpenAI)
kwargs.setdefault("model_name", "gpt-4o")
kwargs.setdefault("cache", False)
return chat_model(**kwargs)


def format_list_as_string(lst: list, list_sep: str = "\n- ") -> str:
"""Format a list as a string with a specified separator."""
if isinstance(lst, list):
return list_sep + list_sep.join(lst)
return str(lst)


def format_prompt_inputs_as_strings(prompt_inputs: list[str], **kwargs):
"""Convert values to string for all keys in kwargs matching list in prompt inputs."""
return {
k: format_list_as_string(v) for k, v in kwargs.items() if k in prompt_inputs
}


def parse_date(date_str: str) -> datetime:
"""Given an arbitrary string, parse it to a date."""
default_date = datetime(datetime.today().year, 1, 1)
Expand All @@ -39,6 +43,7 @@ def parse_date(date_str: str) -> datetime:
config.logger.error(f"Date input `{date_str}` could not be parsed.")
raise e


def datediff_years(start_date: str, end_date: str) -> float:
"""Get difference between arbitrarily formatted dates in fractional years to the floor month."""
datediff = relativedelta(parse_date(end_date), parse_date(start_date))
Expand Down
Loading

0 comments on commit 31fe94f

Please sign in to comment.