Problem
Every pipeline run makes ~8 LLM calls with no caching. If:
- User tweaks one section and re-runs → all 8 calls fire again
- Same JD is used for multiple resumes → JD parsing repeats
- Pipeline crashes mid-way → all progress lost, must restart from scratch
Solution
1. Hash-based file cache for LLM results
import hashlib, json, pathlib
CACHE_DIR = pathlib.Path(".zlm_cache")
def cached_llm_call(prompt: str, schema: type, model: str) -> dict:
cache_key = hashlib.sha256(
f"{prompt}:{schema.__name__}:{model}".encode()
).hexdigest()[:16]
cache_file = CACHE_DIR / f"{cache_key}.json"
if cache_file.exists():
return json.loads(cache_file.read_text())
result = llm_call(prompt, schema, model)
cache_file.write_text(json.dumps(result))
return result
2. Cache keys
- JD extraction: hash(url + model)
- Resume parsing: hash(resume_content + model)
- Section generation: hash(section_name + jd_hash + user_data_hash + model)
3. Cache invalidation
- Manual:
--no-cache flag
- Automatic: cache entries expire after 24h
- Per-section: re-run only changed sections
Acceptance Criteria
Files
zlm/utils/cache.py (new)
zlm/__init__.py (integrate caching)
main.py (add --no-cache flag)
Problem
Every pipeline run makes ~8 LLM calls with no caching. If:
Solution
1. Hash-based file cache for LLM results
2. Cache keys
3. Cache invalidation
--no-cacheflagAcceptance Criteria
--no-cacheCLI flag to bypassFiles
zlm/utils/cache.py(new)zlm/__init__.py(integrate caching)main.py(add --no-cache flag)