Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
outputs
*.jsonl
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"accelerate>=1.11.0",
"boto3>=1.40.18",
"matplotlib>=3.10.6",
"numpy>=2.3.3",
Expand All @@ -20,18 +21,15 @@ dependencies = [
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
only-include = [
"evaluation.py",
"plot_precision_vs_cache_hit_ratio.py",
]

[dependency-groups]
dev = [
"black>=25.1.0",
"isort>=6.0.1",
"pylint>=3.3.7",
]
llm-sim-eval = [
"llm-sim-eval>=0.2.0",
]

[tool.black]
line-length = 120
Expand All @@ -43,3 +41,6 @@ line_length = 120

[tool.pylint]
max-line-length = 120

[project.scripts]
langcache-eval = "customer_analysis.cli.evaluation:run"
12 changes: 7 additions & 5 deletions evaluation.py → src/customer_analysis/cli/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
except ImportError:
HAS_LLM_SIM_EVAL = False

from src.customer_analysis import (
from customer_analysis import (
FileHandler,
generate_plots,
load_data,
Expand Down Expand Up @@ -71,9 +71,7 @@ def run_chr_analysis(queries: pd.DataFrame, args):

# Sweep cache hit ratios
similarity_scores = queries["best_scores"].values
results_df = sweep_thresholds_on_results(
pd.DataFrame({"similarity_score": similarity_scores})
)
results_df = sweep_thresholds_on_results(pd.DataFrame({"similarity_score": similarity_scores}))

# Save sweep results
FileHandler.write_csv(results_df, args.output_dir, "chr_sweep.csv")
Expand Down Expand Up @@ -169,7 +167,7 @@ def main(args):
print("\nDone!")


if __name__ == "__main__":
def run():
parser = argparse.ArgumentParser(
description="Semantic cache evaluation: CHR-only (default) or full evaluation with LLM-as-a-Judge (--full)"
)
Expand Down Expand Up @@ -228,3 +226,7 @@ def main(args):
args = parser.parse_args()

main(args)


if __name__ == "__main__":
run()
6 changes: 3 additions & 3 deletions src/customer_analysis/data_processing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pandas as pd
import torch

from src.customer_analysis.embedding_interface import NeuralEmbedding
from src.customer_analysis.file_handler import FileHandler
from src.customer_analysis.query_engine import RedisVectorIndex
from customer_analysis.embedding_interface import NeuralEmbedding
from customer_analysis.file_handler import FileHandler
from customer_analysis.query_engine import RedisVectorIndex

RANDOM_SEED = 42

Expand Down
2 changes: 1 addition & 1 deletion src/customer_analysis/file_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import matplotlib.pyplot as plt
import pandas as pd

from src.customer_analysis.s3_util import s3_upload_dataframe_csv, s3_upload_matplotlib_png
from customer_analysis.s3_util import s3_upload_dataframe_csv, s3_upload_matplotlib_png


def make_output_path(output_dir: str, filename: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/customer_analysis/plotting.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import matplotlib.pyplot as plt
import pandas as pd

from src.customer_analysis.file_handler import FileHandler
from customer_analysis.file_handler import FileHandler


def generate_plots(
Expand Down
2,417 changes: 2,417 additions & 0 deletions uv.lock

Large diffs are not rendered by default.